| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Http\Controllers\admin;
- use App\Constants\HttpStatus;
- use App\Http\Controllers\Controller;
- use App\Services\ThirdPartyDepositService;
- use Exception;
- use Illuminate\Validation\ValidationException;
- class ThirdPartyDeposit extends Controller
- {
- public function index()
- {
- try {
- $params = request()->validate([
- 'page' => ['nullable', 'integer', 'min:1'],
- 'limit' => ['nullable', 'integer', 'min:1', 'max:200'],
- 'member_id' => ['nullable', 'string', 'max:64'],
- 'payment_company' => ['nullable', 'string', 'in:sanjin,jd,no,zimu'],
- 'payment_method' => ['nullable', 'string', 'max:100'],
- 'channel' => ['nullable', 'string', 'max:50'],
- 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
- 'platform' => ['nullable', 'string', 'max:32'],
- 'submit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:submit_end_date'],
- 'submit_end_date' => [
- 'nullable', 'date_format:Y-m-d', 'required_with:submit_start_date', 'after_or_equal:submit_start_date',
- ],
- 'credit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:credit_end_date'],
- 'credit_end_date' => [
- 'nullable', 'date_format:Y-m-d', 'required_with:credit_start_date', 'after_or_equal:credit_start_date',
- ],
- ]);
- return $this->success(ThirdPartyDepositService::list($params));
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
- }
- }
- public function detail()
- {
- try {
- $params = request()->validate([
- 'id' => ['required', 'integer', 'min:1'],
- ]);
- return $this->success(ThirdPartyDepositService::detail((int)$params['id']));
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
- }
- }
- }
|