fix(fsgx): 修复 issues-0325-1 前端与后端问题
UniApp:会员码图片兜底、海报下载 Promise、账单移除公排退款、 佣金状态与资产页 NavBar、资产接口 total_points_earned。 后端:推荐人须自报单才得周期佣金;升级前快照等级再发积分; 积分按报单商品数量倍乘;伞下级差按伞下基数传递;直推/伞下任务 统计补充 refund_status;周期佣金在事务内锁推荐人行防竞态; 新增 hjf:verify-agent-config 命令做等级与任务 e2e 验收。 Made-with: Cursor
This commit is contained in:
@@ -48,6 +48,7 @@ class HjfOrderPayJob extends BaseJobs
|
||||
return false;
|
||||
}
|
||||
|
||||
$preUpgradeLevels = [];
|
||||
try {
|
||||
/** @var UserServices $userServices */
|
||||
$userServices = app()->make(UserServices::class);
|
||||
@@ -59,6 +60,13 @@ class HjfOrderPayJob extends BaseJobs
|
||||
}
|
||||
$uids = array_unique([$uid, $spreadUid, $twoSpreadUid]);
|
||||
|
||||
// fsgx B2:在升级前快照各上级用户的 agent_level,避免触发升级的那笔订单发放积分
|
||||
foreach ($uids as $u) {
|
||||
if ($u <= 0) continue;
|
||||
$uInfo = $userServices->get((int)$u, ['uid', 'agent_level']);
|
||||
$preUpgradeLevels[(int)$u] = $uInfo ? (int)($uInfo['agent_level'] ?? 0) : 0;
|
||||
}
|
||||
|
||||
/** @var AgentLevelServices $agentLevelServices */
|
||||
$agentLevelServices = app()->make(AgentLevelServices::class);
|
||||
$agentLevelServices->checkUserLevelFinish($uid, $uids);
|
||||
@@ -76,10 +84,30 @@ class HjfOrderPayJob extends BaseJobs
|
||||
->field('id,uid,is_queue_goods')
|
||||
->find();
|
||||
if ($orderRow) {
|
||||
// fsgx B3:计算订单中报单商品的总数量,积分按数量倍乘
|
||||
$queueQty = 1;
|
||||
try {
|
||||
$cartRows = Db::name('store_order_cart_info')
|
||||
->where('oid', (int)$orderRow['id'])
|
||||
->column('cart_info');
|
||||
$qtySum = 0;
|
||||
foreach ($cartRows as $row) {
|
||||
$item = is_string($row) ? json_decode($row, true) : $row;
|
||||
if (!empty($item['productInfo']['is_queue_goods'])) {
|
||||
$qtySum += (int)($item['cart_num'] ?? 1);
|
||||
}
|
||||
}
|
||||
if ($qtySum > 0) {
|
||||
$queueQty = $qtySum;
|
||||
}
|
||||
} catch (\Throwable $qe) {
|
||||
Log::warning("[HjfOrderPay] 计算报单商品数量异常,使用默认值1: " . $qe->getMessage());
|
||||
}
|
||||
|
||||
/** @var PointsRewardServices $pointsService */
|
||||
$pointsService = app()->make(PointsRewardServices::class);
|
||||
$pointsService->reward($uid, $orderId, (int)$orderRow['id']);
|
||||
Log::info("[HjfOrderPay] 积分奖励发放完成 uid={$uid} orderId={$orderId}");
|
||||
$pointsService->reward($uid, $orderId, (int)$orderRow['id'], $preUpgradeLevels, $queueQty);
|
||||
Log::info("[HjfOrderPay] 积分奖励发放完成 uid={$uid} orderId={$orderId} qty={$queueQty}");
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::error("[HjfOrderPay] 积分奖励发放失败 uid={$uid} orderId={$orderId}: " . $e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user