| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Http\Controllers\admin;
- use App\Constants\HttpStatus;
- use App\Http\Controllers\Controller;
- use App\Services\PcIssueService;
- use Illuminate\Validation\ValidationException;
- use Exception;
- use App\Models\PcIssue as PcIssueModel;
- class PcIssue extends Controller
- {
- /**
- * @api {get} /admin/pcIssue 极速28
- * @apiGroup 极速28
- *
- * @apiUse result
- * @apiUse header
- * @apiVersion 1.0.0
- *
- * @apiParam {int} [page=1]
- * @apiParam {int} [limit=10]
- * @apiParam {string} [issue_no] 期号
- */
- public function index()
- {
- try {
- $search = request()->validate([
- 'page' => ['nullable', 'integer', 'min:1'],
- 'limit' => ['nullable', 'integer', 'min:1'],
- 'issue_no' => ['nullable', 'string'],
- ]);
- $page = request()->input('page', 1);
- $limit = request()->input('limit', 15);
- $search['issue_no'] = intval($search['issue_no']);
- $result['keno'] = PcIssueService::getMatchingNumbers($search['issue_no']);
- $result['winning_numbers'] = PcIssueService:: getWinningNumbers($result['keno']);
- $result['winning_numbers'][] = $search['issue_no'];
- $code1 = [
- $result['keno'][1],
- $result['keno'][4],
- $result['keno'][7],
- $result['keno'][10],
- $result['keno'][13],
- $result['keno'][16],
- ];
- $result['open1'] = '';
- foreach ($code1 as $item){
- $result['open1'].="{$item}+";
- }
- $result['keno'] = implode(',', $result['keno']);
- $result['winning_numbers'] = $result['winning_numbers'][0] . " + "
- . $result['winning_numbers'][1] . ' + ' . $result['winning_numbers'][2] . ' = ' . $result['winning_numbers'][3];
- // $result['total'] = PcIssueModel::where(PcIssueModel::getWhere($search))->count();
- // $result['data'] = PcIssueModel::where(PcIssueModel::getWhere($search))
- // ->orderByDesc('id')->forPage($page, $limit)->get();
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(intval($e->getCode()));
- }
- return $this->success($result);
- }
- }
|