PaymentOrder.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. *
  17. */
  18. public function index()
  19. {
  20. try {
  21. $params = request()->validate([
  22. 'page' => ['nullable', 'integer', 'min:1'],
  23. 'limit' => ['nullable', 'integer', 'min:1'],
  24. 'type' => ['required', 'integer', 'in:0,1,2'],
  25. 'order_no' => ['nullable', 'string'],
  26. ]);
  27. $result = PaymentOrderService::paginate($params);
  28. } catch (ValidationException $e) {
  29. return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
  30. } catch (Exception $e) {
  31. return $this->error(intval($e->getCode()));
  32. }
  33. return $this->success($result);
  34. }
  35. }