ThirdPartyDeposit.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Http\Controllers\admin;
  3. use App\Constants\HttpStatus;
  4. use App\Http\Controllers\Controller;
  5. use App\Services\ThirdPartyDepositService;
  6. use Exception;
  7. use Illuminate\Validation\ValidationException;
  8. class ThirdPartyDeposit extends Controller
  9. {
  10. public function index()
  11. {
  12. try {
  13. $params = request()->validate([
  14. 'page' => ['nullable', 'integer', 'min:1'],
  15. 'limit' => ['nullable', 'integer', 'min:1', 'max:200'],
  16. 'member_id' => ['nullable', 'string', 'max:64'],
  17. 'payment_company' => ['nullable', 'string', 'in:sanjin,jd,no,zimu'],
  18. 'payment_method' => ['nullable', 'string', 'max:100'],
  19. 'channel' => ['nullable', 'string', 'max:50'],
  20. 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
  21. 'platform' => ['nullable', 'string', 'max:32'],
  22. 'submit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:submit_end_date'],
  23. 'submit_end_date' => [
  24. 'nullable', 'date_format:Y-m-d', 'required_with:submit_start_date', 'after_or_equal:submit_start_date',
  25. ],
  26. 'credit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:credit_end_date'],
  27. 'credit_end_date' => [
  28. 'nullable', 'date_format:Y-m-d', 'required_with:credit_start_date', 'after_or_equal:credit_start_date',
  29. ],
  30. ]);
  31. return $this->success(ThirdPartyDepositService::list($params));
  32. } catch (ValidationException $e) {
  33. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  34. } catch (Exception $e) {
  35. return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
  36. }
  37. }
  38. public function detail()
  39. {
  40. try {
  41. $params = request()->validate([
  42. 'id' => ['required', 'integer', 'min:1'],
  43. ]);
  44. return $this->success(ThirdPartyDepositService::detail((int)$params['id']));
  45. } catch (ValidationException $e) {
  46. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  47. } catch (Exception $e) {
  48. return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
  49. }
  50. }
  51. }