feat: 新增运营活动购买道具提醒
This commit is contained in:
parent
a5dd07c9cb
commit
4b817b320c
@ -315,7 +315,30 @@ func (ctrl *ActivityController) PurchaseItem(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换响应
|
// 非 active 阶段:通过 message 信号返回 200 + activity_status
|
||||||
|
activityStatusMap := map[string]string{
|
||||||
|
"activity:expired": "expired",
|
||||||
|
"activity:pending": "pending",
|
||||||
|
"activity:completed": "completed",
|
||||||
|
"activity:incomplete": "incomplete",
|
||||||
|
"activity:active": "active",
|
||||||
|
}
|
||||||
|
activityMessageMap := map[string]string{
|
||||||
|
"expired": "活动已结束",
|
||||||
|
"pending": "活动未开始",
|
||||||
|
"completed": "活动已完成",
|
||||||
|
"incomplete": "活动未完成",
|
||||||
|
"active": "活动进行中",
|
||||||
|
}
|
||||||
|
if status, ok := activityStatusMap[resp.Base.Message]; ok {
|
||||||
|
response.Success(c, map[string]interface{}{
|
||||||
|
"activity_status": status,
|
||||||
|
"message": activityMessageMap[status],
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正常购买成功
|
||||||
data := convertPurchaseResponse(resp)
|
data := convertPurchaseResponse(resp)
|
||||||
response.Success(c, data)
|
response.Success(c, data)
|
||||||
}
|
}
|
||||||
@ -415,27 +438,41 @@ func (ctrl *ActivityController) GetContributionRanking(c *gin.Context) {
|
|||||||
response.Success(c, data)
|
response.Success(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// formatTimestamp 将时间戳转换为 YYYY-MM-DD HH:mm:ss 格式
|
||||||
|
// 毫秒级时间戳除以1000转换为秒级
|
||||||
|
func formatTimestamp(timestamp int64) string {
|
||||||
|
if timestamp <= 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
// 毫秒级时间戳(13位以上,如1773411298000)除以1000转为秒级
|
||||||
|
if timestamp >= 1e12 {
|
||||||
|
timestamp = timestamp / 1000
|
||||||
|
}
|
||||||
|
return time.Unix(timestamp, 0).Format("2006-01-02 15:04:05")
|
||||||
|
}
|
||||||
|
|
||||||
// convertActivityListResponse 转换活动列表响应
|
// convertActivityListResponse 转换活动列表响应
|
||||||
func convertActivityListResponse(resp *pbActivity.GetActivityListResponse) map[string]interface{} {
|
func convertActivityListResponse(resp *pbActivity.GetActivityListResponse) map[string]interface{} {
|
||||||
activities := make([]map[string]interface{}, 0, len(resp.Activities))
|
activities := make([]map[string]interface{}, 0, len(resp.Activities))
|
||||||
for _, activity := range resp.Activities {
|
for _, activity := range resp.Activities {
|
||||||
activities = append(activities, map[string]interface{}{
|
activities = append(activities, map[string]interface{}{
|
||||||
"id": activity.Id,
|
"id": activity.Id,
|
||||||
"activity_type": activity.ActivityType,
|
"activity_type": activity.ActivityType,
|
||||||
"title": activity.Title,
|
"title": activity.Title,
|
||||||
"theme": activity.Theme,
|
"theme": activity.Theme,
|
||||||
"description": activity.Description,
|
"description": activity.Description,
|
||||||
"star_id": activity.StarId,
|
"star_id": activity.StarId,
|
||||||
"start_time": activity.StartTime,
|
"start_time": formatTimestamp(activity.StartTime),
|
||||||
"end_time": activity.EndTime,
|
"end_time": formatTimestamp(activity.EndTime),
|
||||||
"target_progress": activity.TargetProgress,
|
"overall_end_time": formatTimestamp(activity.OverallEndTime),
|
||||||
"current_progress": activity.CurrentProgress,
|
"target_progress": activity.TargetProgress,
|
||||||
"status": activity.Status,
|
"current_progress": activity.CurrentProgress,
|
||||||
"current_stage": activity.CurrentStage,
|
"status": activity.Status,
|
||||||
"cover_image": activity.CoverImage,
|
"current_stage": activity.CurrentStage,
|
||||||
"banner_image": activity.BannerImage,
|
"cover_image": activity.CoverImage,
|
||||||
"current_stage_background": activity.CurrentStageBackground,
|
"banner_image": activity.BannerImage,
|
||||||
"current_stage_title": activity.CurrentStageTitle,
|
"current_stage_background": activity.CurrentStageBackground,
|
||||||
|
"current_stage_title": activity.CurrentStageTitle,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,23 +499,24 @@ func convertActivityResponse(activity *pbActivity.Activity) map[string]interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"id": activity.Id,
|
"id": activity.Id,
|
||||||
"activity_type": activity.ActivityType,
|
"activity_type": activity.ActivityType,
|
||||||
"title": activity.Title,
|
"title": activity.Title,
|
||||||
"theme": activity.Theme,
|
"theme": activity.Theme,
|
||||||
"description": activity.Description,
|
"description": activity.Description,
|
||||||
"star_id": activity.StarId,
|
"star_id": activity.StarId,
|
||||||
"start_time": activity.StartTime,
|
"start_time": formatTimestamp(activity.StartTime),
|
||||||
"end_time": activity.EndTime,
|
"end_time": formatTimestamp(activity.EndTime),
|
||||||
"target_progress": activity.TargetProgress,
|
"overall_end_time": formatTimestamp(activity.OverallEndTime),
|
||||||
"current_progress": activity.CurrentProgress,
|
"target_progress": activity.TargetProgress,
|
||||||
"status": activity.Status,
|
"current_progress": activity.CurrentProgress,
|
||||||
"current_stage": activity.CurrentStage,
|
"status": activity.Status,
|
||||||
"cover_image": activity.CoverImage,
|
"current_stage": activity.CurrentStage,
|
||||||
"banner_image": activity.BannerImage,
|
"cover_image": activity.CoverImage,
|
||||||
"current_stage_background": activity.CurrentStageBackground,
|
"banner_image": activity.BannerImage,
|
||||||
"current_stage_title": activity.CurrentStageTitle,
|
"current_stage_background": activity.CurrentStageBackground,
|
||||||
"items": items,
|
"current_stage_title": activity.CurrentStageTitle,
|
||||||
|
"items": items,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +547,7 @@ func convertProgressResponse(resp *pbActivity.GetProgressResponse) map[string]in
|
|||||||
"current_progress": resp.CurrentProgress,
|
"current_progress": resp.CurrentProgress,
|
||||||
"target_progress": resp.TargetProgress,
|
"target_progress": resp.TargetProgress,
|
||||||
"current_stage": resp.CurrentStage,
|
"current_stage": resp.CurrentStage,
|
||||||
"end_time": resp.EndTime,
|
"end_time": formatTimestamp(resp.EndTime),
|
||||||
"status": resp.Status,
|
"status": resp.Status,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,9 @@ type Activity struct {
|
|||||||
Theme string `json:"theme" gorm:"size:100"` // 中文主题
|
Theme string `json:"theme" gorm:"size:100"` // 中文主题
|
||||||
Description string `json:"description" gorm:"type:text"`
|
Description string `json:"description" gorm:"type:text"`
|
||||||
StarID int64 `json:"star_id" gorm:"not null"`
|
StarID int64 `json:"star_id" gorm:"not null"`
|
||||||
StartTime int64 `json:"start_time" gorm:"not null"` // 毫秒时间戳
|
StartTime int64 `json:"start_time" gorm:"not null"` // 毫秒时间戳
|
||||||
EndTime int64 `json:"end_time" gorm:"not null"` // 毫秒时间戳
|
EndTime int64 `json:"end_time" gorm:"not null"` // 毫秒时间戳
|
||||||
|
OverallEndTime int64 `json:"overall_end_time" gorm:"default:0"` // 整体活动结束时间(毫秒时间戳)
|
||||||
TargetProgress int64 `json:"target_progress" gorm:"default:1000"`
|
TargetProgress int64 `json:"target_progress" gorm:"default:1000"`
|
||||||
CurrentProgress int64 `json:"current_progress" gorm:"default:0"`
|
CurrentProgress int64 `json:"current_progress" gorm:"default:0"`
|
||||||
Status string `json:"status" gorm:"size:20;default:pending"` // pending/active/completed/expired
|
Status string `json:"status" gorm:"size:20;default:pending"` // pending/active/completed/expired
|
||||||
|
|||||||
@ -43,6 +43,7 @@ type Activity struct {
|
|||||||
BannerImage string `protobuf:"bytes,14,opt,name=banner_image,json=bannerImage,proto3" json:"banner_image,omitempty"` // 横幅图
|
BannerImage string `protobuf:"bytes,14,opt,name=banner_image,json=bannerImage,proto3" json:"banner_image,omitempty"` // 横幅图
|
||||||
CurrentStageBackground string `protobuf:"bytes,15,opt,name=current_stage_background,json=currentStageBackground,proto3" json:"current_stage_background,omitempty"` // 当前阶段背景图
|
CurrentStageBackground string `protobuf:"bytes,15,opt,name=current_stage_background,json=currentStageBackground,proto3" json:"current_stage_background,omitempty"` // 当前阶段背景图
|
||||||
CurrentStageTitle string `protobuf:"bytes,16,opt,name=current_stage_title,json=currentStageTitle,proto3" json:"current_stage_title,omitempty"` // 当前阶段标题
|
CurrentStageTitle string `protobuf:"bytes,16,opt,name=current_stage_title,json=currentStageTitle,proto3" json:"current_stage_title,omitempty"` // 当前阶段标题
|
||||||
|
OverallEndTime int64 `protobuf:"varint,18,opt,name=overall_end_time,json=overallEndTime,proto3" json:"overall_end_time,omitempty"` // 整体活动结束时间
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -196,6 +197,13 @@ func (x *Activity) GetCurrentStageTitle() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Activity) GetOverallEndTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.OverallEndTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// 活动道具
|
// 活动道具
|
||||||
type ActivityItem struct {
|
type ActivityItem struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@ -1100,7 +1108,7 @@ var File_activity_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_activity_proto_rawDesc = "" +
|
const file_activity_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x0eactivity.proto\x12\x10topfans.activity\x1a\x12proto/common.proto\x1a\x1cgoogle/api/annotations.proto\"\xd5\x04\n" +
|
"\x0eactivity.proto\x12\x10topfans.activity\x1a\x12proto/common.proto\x1a\x1cgoogle/api/annotations.proto\"\xff\x04\n" +
|
||||||
"\bActivity\x12\x0e\n" +
|
"\bActivity\x12\x0e\n" +
|
||||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12#\n" +
|
"\x02id\x18\x01 \x01(\x03R\x02id\x12#\n" +
|
||||||
"\ractivity_type\x18\x02 \x01(\tR\factivityType\x12\x14\n" +
|
"\ractivity_type\x18\x02 \x01(\tR\factivityType\x12\x14\n" +
|
||||||
@ -1121,7 +1129,8 @@ const file_activity_proto_rawDesc = "" +
|
|||||||
"coverImage\x12!\n" +
|
"coverImage\x12!\n" +
|
||||||
"\fbanner_image\x18\x0e \x01(\tR\vbannerImage\x128\n" +
|
"\fbanner_image\x18\x0e \x01(\tR\vbannerImage\x128\n" +
|
||||||
"\x18current_stage_background\x18\x0f \x01(\tR\x16currentStageBackground\x12.\n" +
|
"\x18current_stage_background\x18\x0f \x01(\tR\x16currentStageBackground\x12.\n" +
|
||||||
"\x13current_stage_title\x18\x10 \x01(\tR\x11currentStageTitle\"\xc7\x01\n" +
|
"\x13current_stage_title\x18\x10 \x01(\tR\x11currentStageTitle\x12(\n" +
|
||||||
|
"\x10overall_end_time\x18\x12 \x01(\x03R\x0eoverallEndTime\"\xc7\x01\n" +
|
||||||
"\fActivityItem\x12\x0e\n" +
|
"\fActivityItem\x12\x0e\n" +
|
||||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1b\n" +
|
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1b\n" +
|
||||||
"\titem_type\x18\x02 \x01(\tR\bitemType\x12\x1b\n" +
|
"\titem_type\x18\x02 \x01(\tR\bitemType\x12\x1b\n" +
|
||||||
|
|||||||
@ -28,6 +28,7 @@ message Activity {
|
|||||||
string banner_image = 14; // 横幅图
|
string banner_image = 14; // 横幅图
|
||||||
string current_stage_background = 15; // 当前阶段背景图
|
string current_stage_background = 15; // 当前阶段背景图
|
||||||
string current_stage_title = 16; // 当前阶段标题
|
string current_stage_title = 16; // 当前阶段标题
|
||||||
|
int64 overall_end_time = 18; // 整体活动结束时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// 活动道具
|
// 活动道具
|
||||||
|
|||||||
@ -340,7 +340,7 @@ const fetchActivityList = async () => {
|
|||||||
try {
|
try {
|
||||||
isLoadingActivities.value = true;
|
isLoadingActivities.value = true;
|
||||||
activityLoadError.value = null;
|
activityLoadError.value = null;
|
||||||
const response = await getActivityListApi(starId, 'active', 1, 20);
|
const response = await getActivityListApi(starId, 1, 20);
|
||||||
|
|
||||||
if (response && response.code === 200 && response.data) {
|
if (response && response.code === 200 && response.data) {
|
||||||
activityList.value = response.data.activities || [];
|
activityList.value = response.data.activities || [];
|
||||||
|
|||||||
@ -257,7 +257,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onShow } from 'vue';
|
||||||
import { useStore } from 'vuex';
|
import { useStore } from 'vuex';
|
||||||
import { onReady } from "@dcloudio/uni-app";
|
import { onReady } from "@dcloudio/uni-app";
|
||||||
import Header from '../components/Header.vue';
|
import Header from '../components/Header.vue';
|
||||||
@ -1216,9 +1216,19 @@ onReady(() => {
|
|||||||
// 不再自动触发引导,由用户从引导列表选择后触发
|
// 不再自动触发引导,由用户从引导列表选择后触发
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onShow(() => {
|
||||||
// 每次进入页面都从API刷新用户信息
|
// 每次页面显示时都刷新用户信息并通知 Header 更新余额
|
||||||
fetchUserInfo();
|
fetchUserInfo().then(() => {
|
||||||
|
const cachedUserStr = uni.getStorageSync('user');
|
||||||
|
if (cachedUserStr) {
|
||||||
|
try {
|
||||||
|
const cachedUser = JSON.parse(cachedUserStr);
|
||||||
|
uni.$emit('balanceUpdated', { crystal_balance: cachedUser.crystal_balance || 0 });
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析缓存用户信息失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -242,9 +242,11 @@ async function validateBalance(cost) {
|
|||||||
try {
|
try {
|
||||||
if (!userInfo.value) {
|
if (!userInfo.value) {
|
||||||
const userStr = uni.getStorageSync('user')
|
const userStr = uni.getStorageSync('user')
|
||||||
if (userStr) userInfo.value = JSON.parse(userStr)
|
if (userStr) {
|
||||||
|
userInfo.value = typeof userStr === 'string' ? JSON.parse(userStr) : { ...userStr }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const balance = userInfo.value?.crystal_balance || 0
|
const balance = Number(userInfo.value?.crystal_balance) || 0
|
||||||
return balance >= cost
|
return balance >= cost
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('验证余额失败:', error)
|
console.error('验证余额失败:', error)
|
||||||
@ -258,6 +260,12 @@ async function contributeItem(item, isRetry = false) {
|
|||||||
// 使用 activity-config.js 中的 purchaseItem 函数
|
// 使用 activity-config.js 中的 purchaseItem 函数
|
||||||
const result = await purchaseItem(props.activityId, item.type, 1)
|
const result = await purchaseItem(props.activityId, item.type, 1)
|
||||||
|
|
||||||
|
// 检查购买结果
|
||||||
|
if (!result.success) {
|
||||||
|
showResultToast('', result.message || '活动不在进行中,无法购买')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 成功:触发反馈动画(重试时静默,不触发)
|
// 成功:触发反馈动画(重试时静默,不触发)
|
||||||
if (!isRetry) {
|
if (!isRetry) {
|
||||||
feedbackItem.value = item.type
|
feedbackItem.value = item.type
|
||||||
@ -324,8 +332,18 @@ function deductLocalBalance(cost) {
|
|||||||
try {
|
try {
|
||||||
const userStr = uni.getStorageSync('user')
|
const userStr = uni.getStorageSync('user')
|
||||||
if (userStr) {
|
if (userStr) {
|
||||||
const user = typeof userStr === 'string' ? JSON.parse(userStr) : userStr
|
// 确保正确解析用户对象
|
||||||
user.crystal_balance = Math.max(0, (user.crystal_balance || 0) - cost)
|
let user
|
||||||
|
if (typeof userStr === 'string') {
|
||||||
|
user = JSON.parse(userStr)
|
||||||
|
} else {
|
||||||
|
user = { ...userStr }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扣除余额,确保不为负数
|
||||||
|
user.crystal_balance = Math.max(0, (Number(user.crystal_balance) || 0) - cost)
|
||||||
|
|
||||||
|
// 保存回存储
|
||||||
uni.setStorageSync('user', JSON.stringify(user))
|
uni.setStorageSync('user', JSON.stringify(user))
|
||||||
userInfo.value = user
|
userInfo.value = user
|
||||||
uni.$emit('balanceUpdated', { crystal_balance: user.crystal_balance })
|
uni.$emit('balanceUpdated', { crystal_balance: user.crystal_balance })
|
||||||
@ -340,10 +358,21 @@ function refundLocalBalance(cost) {
|
|||||||
try {
|
try {
|
||||||
const userStr = uni.getStorageSync('user')
|
const userStr = uni.getStorageSync('user')
|
||||||
if (userStr) {
|
if (userStr) {
|
||||||
const user = typeof userStr === 'string' ? JSON.parse(userStr) : userStr
|
// 确保正确解析用户对象
|
||||||
user.crystal_balance = (user.crystal_balance || 0) + cost
|
let user
|
||||||
|
if (typeof userStr === 'string') {
|
||||||
|
user = JSON.parse(userStr)
|
||||||
|
} else {
|
||||||
|
user = { ...userStr }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退还余额
|
||||||
|
user.crystal_balance = (Number(user.crystal_balance) || 0) + cost
|
||||||
|
|
||||||
|
// 保存回存储
|
||||||
uni.setStorageSync('user', JSON.stringify(user))
|
uni.setStorageSync('user', JSON.stringify(user))
|
||||||
userInfo.value = user
|
userInfo.value = user
|
||||||
|
uni.$emit('balanceUpdated', { crystal_balance: user.crystal_balance })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('退还本地余额失败:', error)
|
console.error('退还本地余额失败:', error)
|
||||||
@ -353,11 +382,22 @@ async function updateLocalBalanceFromResult(newBalance) {
|
|||||||
try {
|
try {
|
||||||
const userStr = uni.getStorageSync('user')
|
const userStr = uni.getStorageSync('user')
|
||||||
if (userStr) {
|
if (userStr) {
|
||||||
const user = typeof userStr === 'string' ? JSON.parse(userStr) : userStr
|
// 确保正确解析用户对象
|
||||||
user.crystal_balance = newBalance
|
let user
|
||||||
|
if (typeof userStr === 'string') {
|
||||||
|
user = JSON.parse(userStr)
|
||||||
|
} else {
|
||||||
|
// 如果已经是对象,创建一个新副本避免引用问题
|
||||||
|
user = { ...userStr }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新余额,确保是数字类型
|
||||||
|
user.crystal_balance = Number(newBalance) || 0
|
||||||
|
|
||||||
|
// 保存回存储,确保是字符串格式
|
||||||
uni.setStorageSync('user', JSON.stringify(user))
|
uni.setStorageSync('user', JSON.stringify(user))
|
||||||
userInfo.value = user
|
userInfo.value = user
|
||||||
uni.$emit('balanceUpdated', { crystal_balance: newBalance })
|
uni.$emit('balanceUpdated', { crystal_balance: user.crystal_balance })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('更新本地余额失败:', error)
|
console.error('更新本地余额失败:', error)
|
||||||
|
|||||||
@ -122,18 +122,32 @@ export async function fetchActivityProgress(activityId) {
|
|||||||
export async function purchaseItem(activityId, itemType, quantity = 1) {
|
export async function purchaseItem(activityId, itemType, quantity = 1) {
|
||||||
try {
|
try {
|
||||||
const response = await purchaseActivityItemApi(activityId, itemType, quantity)
|
const response = await purchaseActivityItemApi(activityId, itemType, quantity)
|
||||||
|
// 检查活动状态,只有 active 才能购买
|
||||||
if (response.code === 200 && response.data) {
|
if (response.code === 200 && response.data) {
|
||||||
|
if (response.data.activity_status && response.data.activity_status !== 'active') {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: response.data.message || '活动不在进行中,无法购买'
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
|
success: true,
|
||||||
totalCrystalSpent: response.data.total_crystal_spent,
|
totalCrystalSpent: response.data.total_crystal_spent,
|
||||||
totalContribution: response.data.total_contribution,
|
totalContribution: response.data.total_contribution,
|
||||||
currentProgress: response.data.current_progress,
|
currentProgress: response.data.current_progress,
|
||||||
remainingBalance: response.data.remaining_balance
|
remainingBalance: response.data.remaining_balance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(response.message || '购买道具失败')
|
return {
|
||||||
|
success: false,
|
||||||
|
message: response.message || '购买道具失败'
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('purchaseItem error:', error)
|
console.error('purchaseItem error:', error)
|
||||||
throw error
|
return {
|
||||||
|
success: false,
|
||||||
|
message: error.message || '购买道具失败'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -486,9 +486,9 @@ export function getOriginalRankingApi(dimension = 'total', starId = null, page =
|
|||||||
// 获取活动列表
|
// 获取活动列表
|
||||||
export function getActivityListApi(starId, status = '', page = 1, pageSize = 10) {
|
export function getActivityListApi(starId, status = '', page = 1, pageSize = 10) {
|
||||||
let url = `/api/v1/activities?star_id=${starId}&page=${page}&page_size=${pageSize}`
|
let url = `/api/v1/activities?star_id=${starId}&page=${page}&page_size=${pageSize}`
|
||||||
if (status) {
|
// if (status) {
|
||||||
url += `&status=${status}`
|
// url += `&status=${status}`
|
||||||
}
|
// }
|
||||||
return request({
|
return request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user