| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Http\Controllers\admin;
- use App\Constants\HttpStatus;
- use App\Http\Controllers\Controller;
- use App\Services\ThirdGameOrderService;
- use Exception;
- use Illuminate\Http\JsonResponse;
- use Illuminate\Validation\ValidationException;
- class ThirdGameOrder extends Controller
- {
- public function index(ThirdGameOrderService $service): JsonResponse
- {
- try {
- $params = request()->validate([
- 'page' => ['nullable', 'integer', 'min:1'],
- 'limit' => ['nullable', 'integer', 'min:1', 'max:200'],
- 'user_id' => ['nullable', 'integer', 'min:1'],
- 'member_id' => ['nullable', 'string', 'max:64'],
- 'username' => ['nullable', 'string', 'max:128'],
- 'first_name' => ['nullable', 'string', 'max:128'],
- 'player_id' => ['nullable', 'string', 'max:32'],
- 'platform' => ['nullable', 'string', 'max:32'],
- 'game_order_id' => ['nullable', 'string', 'max:128'],
- 'game_type' => ['nullable', 'integer', 'in:1,2,3,4,5,6,7'],
- 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
- 'start_time' => ['nullable', 'date_format:Y-m-d H:i:s', 'required_with:end_time'],
- 'end_time' => [
- 'nullable', 'date_format:Y-m-d H:i:s', 'required_with:start_time', 'after_or_equal:start_time',
- ],
- ]);
- $sync = $service->syncForList($params);
- $result = $service->paginate($params);
- $result['sync'] = $sync;
- return $this->success($result);
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
- }
- }
- }
|