Cart.php
819 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace addons\shopro\controller;
use addons\shopro\model\Cart as CartModel;
class Cart extends Base
{
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
public function index()
{
$data = CartModel::info();
$this->success('我的购物车', $data);
}
public function add()
{
$params = $this->request->post();
// 表单验证
$this->shoproValidate($params, get_class(), 'add');
$goodsList = $params['goods_list'];
$this->success('已添加', CartModel::add($goodsList));
}
public function edit()
{
$params = $this->request->post();
// 表单验证
$this->shoproValidate($params, get_class(), 'edit');
$this->success('', CartModel::edit($params));
}
}