80 lines
1.7 KiB
PHP
80 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\BaseApp\BaseController;
|
|
use App\Service\business\OrderService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* 订单管理
|
|
*/
|
|
class OrderController extends BaseController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->service = OrderService::getInstance();
|
|
$this->insertField = ['list_id'];
|
|
$this->updateField = ['id'];
|
|
$this->notRequest = [
|
|
'receiver_name', 'receiver_phone', 'receiver_address',
|
|
'remark', 'delivery_type',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 概览统计
|
|
* @Method GET
|
|
*/
|
|
public function stat(): JsonResponse
|
|
{
|
|
return jok($this->service->stat());
|
|
}
|
|
|
|
/**
|
|
* 某用户的订单
|
|
* @Method GET
|
|
*/
|
|
public function byUser(): JsonResponse
|
|
{
|
|
return jok($this->service->byUser((int) request()->get('user_id', 0)));
|
|
}
|
|
|
|
/**
|
|
* 审核转账凭证
|
|
* @Method POST
|
|
*/
|
|
public function auditPayment(): JsonResponse
|
|
{
|
|
return jok($this->service->auditPayment(request()->post()), '处理成功');
|
|
}
|
|
|
|
/**
|
|
* 发货
|
|
* @Method POST
|
|
*/
|
|
public function ship(): JsonResponse
|
|
{
|
|
return jok($this->service->ship(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)), '已完成');
|
|
}
|
|
}
|