check_status == CheckStatus::Success) { throw new BaseException('已经审核过了'); } $status = data_get($options, 'check_status'); $attributes = [ 'check_status' => $status, 'check_remarks' => data_get($options, 'check_remarks'), 'check_user_id' => data_get($options, 'check_user_id', Admin::user()->id), 'check_at' => now(), ]; if ($status == CheckStatus::Success->value) { $attributes['score'] = data_get($options, 'score', 0); if ($attributes['score'] <= 0) { throw new BaseException('得分必填'); } PartyUserService::make()->incrementScore($info->user, $info->type?->key, $attributes['score']); } $info->update($attributes); } public function resloveData($data, $model = null) { if (!$model) { $data['cate_id'] = PartyUser::where('id', $data['user_id'])->value('cate_id'); } return $data; } public function validate($data, $model = null) { $createRules = [ 'type_id' => 'required', 'cate_id' => 'required', 'user_id' => 'required', ]; $updateRules = [ ]; $validator = Validator::make($data, $model ? $updateRules : $createRules, [ 'type_id.required' => __('user_score.type_id') . ' 必填', 'cate_id.required' => __('user_score.cate_id') . ' 必填', 'user_id.required' => __('user_score.user_id') . ' 必填', ]); if ($validator->fails()) { return $validator->errors()->first(); } return true; } }