| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Http\Controllers\agent;
- use App\Http\Controllers\AgentApiController;
- use App\Services\Agent\AgentMemberService;
- use Illuminate\Http\Request;
- class MemberController extends AgentApiController
- {
- public function index(Request $request, AgentMemberService $service)
- {
- return $this->execute(fn() => $service->paginate($this->currentAgent(), $this->validateList($request)));
- }
- public function finance(Request $request, AgentMemberService $service)
- {
- return $this->execute(fn() => $service->finance($this->currentAgent(), $this->validateList($request)));
- }
- public function bets(Request $request, AgentMemberService $service)
- {
- return $this->execute(function () use ($request, $service) {
- $data = $request->validate([
- 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1', 'max:100'],
- 'source' => ['nullable', 'in:pc28,sport,jisu,lhc,third'], 'member_id' => ['nullable', 'string', 'max:64'],
- 'username' => ['nullable', 'string', 'max:128'], 'status' => ['nullable', 'integer'],
- 'start_date' => ['nullable', 'date_format:Y-m-d'], 'end_date' => ['nullable', 'date_format:Y-m-d', 'after_or_equal:start_date'],
- ]);
- return $service->bets($this->currentAgent(), $data);
- });
- }
- private function validateList(Request $request): array
- {
- return $request->validate([
- 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1', 'max:100'],
- 'keyword' => ['nullable', 'string', 'max:128'], 'agent_id' => ['nullable', 'integer'],
- 'status' => ['nullable', 'integer'], 'start_date' => ['nullable', 'date_format:Y-m-d'],
- 'end_date' => ['nullable', 'date_format:Y-m-d', 'after_or_equal:start_date'],
- ]);
- }
- }
|