refactor(shopro): 优化代码中的用户 ID 处理逻辑

This commit is contained in:
2025-06-14 16:59:21 +08:00
parent 70baaa2fd5
commit 0432965b88
2 changed files with 6 additions and 5 deletions

View File

@@ -77,7 +77,7 @@ class Game extends Base
$this->model->where('id', $model['id'])->setInc('attention');
$model['cost'] = json_decode($model['cost'] ?? '[]', true);
$model['referee'] = explode(',', $model['referee']);
$model['referee'] = explode(',', $model['referee'] ?? '');
$this->success('Success', $model);
}
@@ -261,7 +261,7 @@ class Game extends Base
$this->error('用户不存在');
}
$game = $this->model->get($user['game_id']);
$referee = explode(',', $game['referee']); //裁判
$referee = explode(',', $game['referee'] ?? ''); //裁判
$menber = Menber::where(['club_id' => $game['club_id'], 'user_id' => $this->auth->id])->where('role', '>', 1)->find();
if (empty($menber) && !in_array($this->auth->id, $referee)) {
$this->error('您没有权限');
@@ -354,7 +354,7 @@ class Game extends Base
$this->error('对阵记录不存在');
}
$game = $this->model->get($match['game_id']);
$referee = explode(',', $game['referee']);
$referee = explode(',', $game['referee']?? '');
if (empty($referee)) {
$this->error('请先设置裁判');
}