| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Http\Controllers\admin;
- use App\Constants\HttpStatus;
- use App\Http\Controllers\Controller;
- use App\Services\BetService;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Validation\ValidationException;
- use Exception;
- class Bet extends Controller
- {
- function index()
- {
- try {
- $params = request()->validate([
- 'page' => ['nullable', 'integer', 'min:1'],
- 'limit' => ['nullable', 'integer', 'min:1'],
- 'member_id' => ['nullable', 'string'],
- 'keywords' => ['nullable', 'string', 'min:1'],
- 'issue_no' => ['nullable', 'string'],
- 'id' => ['nullable', 'string'],
- 'status' => ['nullable', 'integer', 'in:1,2'],
- 'username' => ['nullable', 'string', 'min:1'],
- 'start_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:end_time'],
- 'end_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:start_time'],
- 'is_winner'=>['nullable','integer','in:0,1'],
- ]);
- $result = BetService::paginate($params);
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(intval($e->getCode()));
- }
- return $this->success($result);
- }
- // 模拟下注
- public function fake()
- {
- BetService::randomVirtualBetting(3);
- return $this->success();
- }
- }
|