PaymentOrder.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers\admin;
  3. use App\Constants\HttpStatus;
  4. use App\Http\Controllers\Controller;
  5. use App\Services\PaymentOrderService;
  6. use Exception;
  7. use Illuminate\Validation\ValidationException;
  8. class PaymentOrder extends Controller
  9. {
  10. /**
  11. * @apiParam {int} [page]
  12. * @apiParam {int} [limit]
  13. * @apiParam {int=0,1,2} type 类型 0全部 1=代收,2=代付
  14. * @apiParam {String} order_no 订单号
  15. * @apiPaaram {String} member_id 会员ID
  16. * @apiParam {int=0,1,2,3} [status] 状态:0待处理 1处理中 2成功 3失败
  17. *
  18. */
  19. public function index()
  20. {
  21. try {
  22. $params = request()->validate([
  23. 'page' => ['nullable', 'integer', 'min:1'],
  24. 'limit' => ['nullable', 'integer', 'min:1'],
  25. 'type' => ['required', 'integer', 'in:0,1,2'],
  26. 'order_no' => ['nullable', 'string'],
  27. 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
  28. ]);
  29. $result = PaymentOrderService::paginate($params);
  30. } catch (ValidationException $e) {
  31. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  32. } catch (Exception $e) {
  33. return $this->error(intval($e->getCode()));
  34. }
  35. return $this->success($result);
  36. }
  37. }