85 lines
1.7 KiB
PHP
85 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Wx;
|
||
|
|
|
||
|
|
use App\BaseApp\BaseController;
|
||
|
|
use App\Service\wx\WxOrderService;
|
||
|
|
use Illuminate\Http\JsonResponse;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 小程序订单
|
||
|
|
*/
|
||
|
|
class OrderController extends BaseController
|
||
|
|
{
|
||
|
|
protected array $exceptRoute = ['option', 'update', 'delete'];
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
parent::__construct();
|
||
|
|
$this->service = WxOrderService::getInstance();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 我的订单
|
||
|
|
* @Method GET
|
||
|
|
*/
|
||
|
|
public function list(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->list());
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 订单详情
|
||
|
|
* @Method GET
|
||
|
|
*/
|
||
|
|
public function detail(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->detail((int) request()->get('id', 0)));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 清单转订单
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function create(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->createFromList(request()->post()), '下单成功');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 上传转账凭证
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function voucher(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->submitVoucher(request()->post()), '已提交,等待审核');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 调起微信支付
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function wechatPay(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->wechatPay(request()->post()));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 取消订单
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function cancel(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->cancel((int) request()->post('id', 0)), '已取消');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 确认收货
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function complete(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->complete((int) request()->post('id', 0)), '已完成');
|
||
|
|
}
|
||
|
|
}
|