| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?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);
- }
- /**
- * @description: 查询订单的支付情况
- * @return {*}
- */
- public function check()
- {
- $id = request()->input('id');
- if(empty($id)){
- return $this->error(HttpStatus::CUSTOM_ERROR,'参数错误');
- }
- try {
- $result = PaymentOrderService::singlePayOrder($id);
- $this->success([],$result['message'] ?? '操作成功');
- } catch (Exception $e) {
- return $this->error(intval($e->getCode()));
- }
- return $this->success([],$result['message'] ?? '操作成功');
- }
- }
|