|
|
@@ -51,23 +51,30 @@ class PcIssue extends Controller
|
|
|
{
|
|
|
try {
|
|
|
request()->validate([
|
|
|
- 'he' => ['required', 'integer','min:0','max:27'],
|
|
|
+ 'issue_no' => ['required', 'string'],
|
|
|
+ 'he' => ['required', 'integer', 'min:0', 'max:27'],
|
|
|
]);
|
|
|
+ $issueNo = request()->input('issue_no');
|
|
|
$he = request()->input('he');
|
|
|
$he = intval($he);
|
|
|
- $result['keno'] = PcIssueService::getMatchingNumbers($he);
|
|
|
- $result['winning_numbers'] = PcIssueService:: getWinningNumbers($result['keno']);
|
|
|
- $result['winning_numbers'][] = $he;
|
|
|
- $result['keno'] = implode(',', $result['keno']);
|
|
|
- $result['winning_numbers'] = $result['winning_numbers'][0] . "+"
|
|
|
- . $result['winning_numbers'][1] . '+' . $result['winning_numbers'][2] . '=' . $result['winning_numbers'][3];
|
|
|
-
|
|
|
+ $pcIssue = PcIssueModel::where('issue_no', $issueNo)->first();
|
|
|
+ if (!$pcIssue) throw new Exception('期号错误', HttpStatus::CUSTOM_ERROR);
|
|
|
+ if (!in_array($pcIssue->status, [PcIssueModel::STATUS_BETTING, PcIssueModel::STATUS_CLOSE])) {
|
|
|
+ throw new Exception('预开奖失败;状态不正确', HttpStatus::CUSTOM_ERROR);
|
|
|
+ }
|
|
|
+ $keno = PcIssueService::getMatchingNumbers($he);
|
|
|
+ $pcIssue->advance_keno = json_encode($keno);
|
|
|
+ $pcIssue->advance_code = $he;
|
|
|
+ $pcIssue->save();
|
|
|
} catch (ValidationException $e) {
|
|
|
return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
|
|
|
} catch (Exception $e) {
|
|
|
+ if ($e->getCode() == HttpStatus::CUSTOM_ERROR) {
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
|
|
|
+ }
|
|
|
return $this->error(intval($e->getCode()));
|
|
|
}
|
|
|
- return $this->success($result);
|
|
|
+ return $this->success();
|
|
|
|
|
|
}
|
|
|
}
|