erp/app/admin/controller/order/CartController.php
2024-04-26 11:26:12 +08:00

95 lines
2.1 KiB
PHP

<?php
namespace app\admin\controller\order;
use app\admin\controller\BaseAdminController;
use app\admin\lists\order\CartLists;
use app\admin\logic\order\CartLogic;
use app\admin\validate\order\CartValidate;
/**
* 购物车表控制器
* Class CartController
* @package app\admin\controller\order
*/
class CartController extends BaseAdminController
{
/**
* @notes 获取购物车表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function lists()
{
return $this->dataLists(new CartLists());
}
/**
* @notes 添加购物车表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function add()
{
$params = (new CartValidate())->post()->goCheck('add');
$result = CartLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CartLogic::getError());
}
/**
* @notes 编辑购物车表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function edit()
{
$params = (new CartValidate())->post()->goCheck('edit');
$result = CartLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CartLogic::getError());
}
/**
* @notes 删除购物车表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function delete()
{
$params = (new CartValidate())->post()->goCheck('delete');
CartLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取购物车表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function detail()
{
$params = (new CartValidate())->goCheck('detail');
$result = CartLogic::detail($params);
return $this->data($result);
}
}