初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
96
app/Http/Controllers/Wx/ListController.php
Normal file
96
app/Http/Controllers/Wx/ListController.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wx;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\wx\WxListService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* 小程序清单
|
||||
*/
|
||||
class ListController extends BaseController
|
||||
{
|
||||
protected array $exceptRoute = ['option'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = WxListService::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->create(request()->post()), '创建成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 改清单名称与备注
|
||||
* @Method POST
|
||||
*/
|
||||
public function update(): JsonResponse
|
||||
{
|
||||
return jok(
|
||||
$this->service->update((int) request()->post('id', 0), request()->post()),
|
||||
'保存成功'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除清单
|
||||
* @Method POST
|
||||
*/
|
||||
public function delete(): JsonResponse
|
||||
{
|
||||
return jok($this->service->delete(request()->post('ids', [])), '删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除清单明细
|
||||
* @Method POST
|
||||
*/
|
||||
public function deleteItem(): JsonResponse
|
||||
{
|
||||
return jok($this->service->deleteItem(request()->post('ids', [])), '删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入清单
|
||||
* @Method POST
|
||||
*/
|
||||
public function toCart(): JsonResponse
|
||||
{
|
||||
return jok($this->service->toCart(request()->post()), '添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 改明细的规格与数量
|
||||
* @Method POST
|
||||
*/
|
||||
public function updateItem(): JsonResponse
|
||||
{
|
||||
return jok($this->service->updateItem(request()->post()), '保存成功');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user