diff --git a/backend/application/common/service/PromotionService.php b/backend/application/common/service/PromotionService.php index 3622626..e1e429b 100644 --- a/backend/application/common/service/PromotionService.php +++ b/backend/application/common/service/PromotionService.php @@ -56,7 +56,8 @@ class PromotionService */ public static function isEnabled(): bool { - return intval(config('site.enable_promotion_commission') ?? 0) === 1; + //后台配置为 switch 类型,开启存 '1',关闭存 '0' + return (string)config('site.enable_promotion_commission') === '1'; } /** diff --git a/frontend/miniapp/pages/promoter/index/index.js b/frontend/miniapp/pages/promoter/index/index.js index 827dfa4..9e5a1e5 100644 --- a/frontend/miniapp/pages/promoter/index/index.js +++ b/frontend/miniapp/pages/promoter/index/index.js @@ -10,6 +10,8 @@ Page({ // demand_ratio_percent 需求订单佣金比例(%)、invite_count 推广用户数、 // order_count 推广订单数、settled_amount 累计已结算佣金(元)、pending_count 待结算订单数 overview: {}, + overviewStatus: 'loading', // 概览加载状态 loading=加载中 success=成功 failed=失败 + overviewError: '', // 概览加载失败原因 list: [], // 推广订单列表 page: 1, // 下一次请求的页码 hasMore: true, // 是否还有更多数据 @@ -47,11 +49,14 @@ Page({ async loadOverview() { try { const res = await fetchPromoterInfo(); - if (res.code === 1) { - this.setData({ overview: res.data }); + if (res.code !== 1) { + this.setData({ overviewStatus: 'failed', overviewError: res.msg || '推广信息加载失败' }); + return; } + this.setData({ overview: res.data, overviewStatus: 'success', overviewError: '' }); } catch (err) { console.error('fetchPromoterInfo failed:', err); + this.setData({ overviewStatus: 'failed', overviewError: '网络异常,请下拉刷新重试' }); } }, diff --git a/frontend/miniapp/pages/promoter/index/index.wxml b/frontend/miniapp/pages/promoter/index/index.wxml index 29041a2..ec60036 100644 --- a/frontend/miniapp/pages/promoter/index/index.wxml +++ b/frontend/miniapp/pages/promoter/index/index.wxml @@ -26,7 +26,9 @@ - + 加载中... + {{overviewError}} + 好友通过你的分享链接或二维码进入并下单,订单交易完成后按实付金额结算佣金,自动存入余额,可直接提现: · 软件订单:{{overview.soft_ratio_percent > 0 ? overview.soft_ratio_percent + '%' : '暂无佣金'}} · 定制需求订单:{{overview.demand_ratio_percent > 0 ? overview.demand_ratio_percent + '%' : '暂无佣金'}}