fix: user deduct point
This commit is contained in:
@@ -314,10 +314,7 @@ const downloadAvatar = async (item) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"avatar_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
const canProceed = await checkAbilityAndHandle("avatar_download");
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
|
||||
@@ -213,13 +213,14 @@ import {
|
||||
onReachBottom,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import {
|
||||
getAvatarSystemList,
|
||||
getAvatarFrameList,
|
||||
getAvatarDecorList,
|
||||
avatarCreateComplete,
|
||||
} from "@/api/avatar.js";
|
||||
import { getShareReward } from "@/api/system.js";
|
||||
import {
|
||||
saveRecordRequest,
|
||||
getShareToken,
|
||||
@@ -685,29 +686,14 @@ const saveAndUse = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const abilityRes = await abilityCheck("avatar_download");
|
||||
if (!abilityRes.canUse) {
|
||||
if (
|
||||
abilityRes?.blockType === "need_share" &&
|
||||
abilityRes?.message === "分享可继续"
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "分享给好友可继续使用",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "您今日头像下载次数已用完,明日再试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const canProceed = await checkAbilityAndHandle("avatar_download");
|
||||
if (!canProceed) return;
|
||||
|
||||
const tempPath = await saveByCanvas(true);
|
||||
const id = createAvatarId();
|
||||
saveRecordRequest(tempPath, id, "avatar_download");
|
||||
await saveRecordRequest(tempPath, id, "avatar_download");
|
||||
completeCardInfo(id);
|
||||
userStore.fetchUserAssets();
|
||||
return;
|
||||
// 调用avatarDownloadRecord API记录下载次数
|
||||
// await avatarDownloadRecord({
|
||||
|
||||
@@ -125,19 +125,19 @@ import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { abilityCheck } from "@/api/system.js";
|
||||
import { drawFortune } from "@/api/fortune.js";
|
||||
import { getShareReward } from "@/api/system.js";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import {
|
||||
getShareToken,
|
||||
saveRemoteImageToLocal,
|
||||
saveRecordRequest,
|
||||
saveRemoteImageToLocal,
|
||||
getShareToken,
|
||||
saveViewRequest,
|
||||
trackRecord,
|
||||
} from "@/utils/common.js";
|
||||
import { drawFortune } from "@/api/fortune.js";
|
||||
import { abilityCheck } from "@/api/system.js";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
@@ -238,10 +238,8 @@ const startShake = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (remainingCount.value <= 0) {
|
||||
uni.showToast({ title: "今日次数已用完", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const canProceed = await checkAbilityAndHandle("fortune_draw");
|
||||
if (!canProceed) return;
|
||||
|
||||
status.value = "shaking";
|
||||
|
||||
|
||||
@@ -246,12 +246,8 @@ import { ref, onMounted, computed } from "vue";
|
||||
import { getStatusBarHeight } from "@/utils/system";
|
||||
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import {
|
||||
getRecommendList,
|
||||
getRankList,
|
||||
abilityCheck,
|
||||
watchAdReward,
|
||||
} from "@/api/system";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import { getRecommendList, getRankList, watchAdReward } from "@/api/system";
|
||||
import { saveRemoteImageToLocal, saveRecordRequest } from "@/utils/common";
|
||||
import { getUserSignInfo, userSignIn } from "@/api/user";
|
||||
import { avatarDownloadRecord } from "@/api/avatar";
|
||||
@@ -481,40 +477,8 @@ const handleDownload = async (item) => {
|
||||
|
||||
const type =
|
||||
item.type === "wallpaper" ? "wallpaper_download" : "avatar_download";
|
||||
const abilityRes = await abilityCheck(type);
|
||||
|
||||
if (!abilityRes.canUse) {
|
||||
if (
|
||||
abilityRes?.blockType === "need_share" &&
|
||||
abilityRes?.message === "分享可继续"
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "分享给好友即可下载",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (
|
||||
abilityRes?.blockType === "need_ad" &&
|
||||
abilityRes?.message === "观看广告可继续"
|
||||
) {
|
||||
uni.showModal({
|
||||
title: "积分不足",
|
||||
content: "观看广告可获得50积分,继续下载",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
rewardAdRef.value.show();
|
||||
}
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "您今日下载次数已用完,明日再试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const canProceed = await checkAbilityAndHandle(type);
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
try {
|
||||
|
||||
@@ -563,12 +563,8 @@ import {
|
||||
getCardTemplateTitleList,
|
||||
getCardMusicList,
|
||||
} from "@/api/make";
|
||||
import {
|
||||
abilityCheck,
|
||||
getShareReward,
|
||||
msgCheckApi,
|
||||
watchAdReward,
|
||||
} from "@/api/system";
|
||||
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
@@ -1505,24 +1501,9 @@ const preview = async () => {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
const abilityRes = await abilityCheck("card_generate");
|
||||
if (!abilityRes.canUse) {
|
||||
if (
|
||||
abilityRes?.blockType === "need_share" &&
|
||||
abilityRes?.message === "分享可继续"
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "分享给好友可继续使用",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "您今日祝福卡下载次数已用完,直接分享给好友或者明日再试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const canProceed = await checkAbilityAndHandle("card_generate");
|
||||
if (!canProceed) return;
|
||||
|
||||
const tempPath = await saveByCanvas(true);
|
||||
const id = createCard();
|
||||
shareOrSave(id);
|
||||
|
||||
@@ -288,10 +288,7 @@ const downloadWallpaper = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"wallpaper_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
const canProceed = await checkAbilityAndHandle("wallpaper_download");
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
|
||||
@@ -304,10 +304,7 @@ const downloadWallpaper = async (item) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"wallpaper_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
const canProceed = await checkAbilityAndHandle("wallpaper_download");
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
|
||||
Reference in New Issue
Block a user