| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Http\Controllers\admin;
- use App\Constants\HttpStatus;
- use App\Http\Controllers\Controller;
- use App\Services\PaymentOrderService;
- use Exception;
- use Illuminate\Validation\ValidationException;
- class PaymentOrder extends Controller
- {
- /**
- * @apiParam {int} [page]
- * @apiParam {int} [limit]
- * @apiParam {int=0,1,2} type 类型 0全部 1=代收,2=代付
- * @apiParam {String} order_no 订单号
- * @apiPaaram {String} member_id 会员ID
- * @apiParam {int=0,1,2,3} [status] 状态:0待处理 1处理中 2成功 3失败
- *
- */
- public function index()
- {
- try {
- $params = request()->validate([
- 'page' => ['nullable', 'integer', 'min:1'],
- 'limit' => ['nullable', 'integer', 'min:1'],
- 'type' => ['required', 'integer', 'in:0,1,2'],
- 'order_no' => ['nullable', 'string'],
- 'status' => ['nullable', 'integer', 'in:0,1,2,3'],
- ]);
- $result = PaymentOrderService::paginate($params);
- } catch (ValidationException $e) {
- return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
- } catch (Exception $e) {
- return $this->error(intval($e->getCode()));
- }
- return $this->success($result);
- }
- }
|