fix(shopro): 修复体育游戏自动退坑和更新用户得分逻辑

- 在 Game 控制器中,为 teamAuser 查询添加 status > -1 的条件,以确保只更新有效用户的得分
- 在 OrderAutoOper 任务中,修复 GameJoin 表格的 status 字段更新逻辑,并添加 Participant 表格的状态更新
This commit is contained in:
2025-05-31 22:22:47 +08:00
parent 35725ffd2d
commit 1b63962bff
2 changed files with 6 additions and 2 deletions

View File

@@ -388,7 +388,9 @@ class Game extends Base
// 更新用户得分
$teamA = json_decode($match->teamA, true);
$teamAuser = Participant::where('game_id', $game['id'])->where('user_id', 'IN', array_column($teamA['user'], 'user_id'))->select();
$teamAuser = Participant::where('game_id', $game['id'])
->where('user_id', 'IN', array_column($teamA['user'], 'user_id'))
->where('status', '>', -1)->select();
// dd($teamAuser);
foreach ($teamAuser as $u) {
$u->team = $teamA['name']; //队伍名

View File

@@ -2,6 +2,7 @@
namespace addons\shopro\job;
use think;
use think\Db;
use think\Log;
use think\queue\Job;
@@ -41,10 +42,11 @@ class OrderAutoOper extends BaseJob
Db::transaction(function () use ($order, $data) {
$orderOper = new OrderOper();
$order = $orderOper->close($order, null, 'system');
// zy体育报名处理(未支付,自动退坑)
$join = GameJoin::where('order_id', $data['order']['id'])->find();
if (!empty($join)) {
$join->save([' status' => -1]);
$join->save(['status' => -1]);
Participant::where('game_join_id', $join['id'])->update(['status' => -1]);
}
return $order;