refactor(shopro): 优化代码中的用户 ID 处理逻辑
This commit is contained in:
@@ -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('请先设置裁判');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user