ThirdPartyDeposit.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. 'account' => ['nullable', 'string', 'max:64'],
  18. 'payment_company' => ['nullable', 'string', 'in:sanjin,jd,no,zimu'],
  19. 'payment_method' => ['nullable', 'string', 'max:100'],
  20. 'channel' => ['nullable', 'string', 'max:50'],
  21. 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
  22. 'platform' => ['nullable', 'string', 'max:32'],
  23. 'submit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:submit_end_date'],
  24. 'submit_end_date' => [
  25. 'nullable', 'date_format:Y-m-d', 'required_with:submit_start_date', 'after_or_equal:submit_start_date',
  26. ],
  27. 'credit_start_date' => ['nullable', 'date_format:Y-m-d', 'required_with:credit_end_date'],
  28. 'credit_end_date' => [
  29. 'nullable', 'date_format:Y-m-d', 'required_with:credit_start_date', 'after_or_equal:credit_start_date',
  30. ],
  31. ]);
  32. return $this->success(ThirdPartyDepositService::list($params));
  33. } catch (ValidationException $e) {
  34. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  35. } catch (Exception $e) {
  36. return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
  37. }
  38. }
  39. public function detail()
  40. {
  41. try {
  42. $params = request()->validate([
  43. 'id' => ['required', 'integer', 'min:1'],
  44. ]);
  45. return $this->success(ThirdPartyDepositService::detail((int)$params['id']));
  46. } catch (ValidationException $e) {
  47. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  48. } catch (Exception $e) {
  49. return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
  50. }
  51. }
  52. }