fix: point exp
This commit is contained in:
@@ -332,11 +332,24 @@ const downloadWallpaper = async (item) => {
|
||||
}
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
await saveRemoteImageToLocal(item.imageUrl);
|
||||
await saveRecordRequest("", item.id, "wallpaper_download", item.imageUrl);
|
||||
try {
|
||||
// Parallelize save record and download
|
||||
// Wait for saveRecordRequest to ensure backend deducts points
|
||||
await Promise.all([
|
||||
saveRecordRequest("", item.id, "wallpaper_download", item.imageUrl),
|
||||
saveRemoteImageToLocal(item.imageUrl),
|
||||
]);
|
||||
|
||||
await userStore.fetchUserAssets();
|
||||
uni.showToast({ title: "保存成功 消耗 20 积分", icon: "success" });
|
||||
// Refresh user assets to show updated points
|
||||
await userStore.fetchUserAssets();
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存成功 消耗 20 积分", icon: "success" });
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
console.error("Download failed", e);
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const shareWallpaper = (item) => {};
|
||||
|
||||
Reference in New Issue
Block a user