|
@@ -117,7 +117,7 @@ class Cart extends Base
|
|
|
*/
|
|
|
public function add()
|
|
|
{
|
|
|
- $id = $this->request->get('id', 0);
|
|
|
+ $id = input('id', 0);
|
|
|
|
|
|
$id = \addons\unishop\extend\Hashids::decodeHex($id);
|
|
|
|
|
@@ -126,7 +126,7 @@ class Cart extends Base
|
|
|
$this->error('产品不存在或已下架');
|
|
|
}
|
|
|
|
|
|
- $spec = $this->request->get('spec', '');
|
|
|
+ $spec = input('spec', '');
|
|
|
$productBase = (new \addons\unishop\extend\Product())->getBaseData($product->getData(), $spec);
|
|
|
if (!$productBase['stock'] || $productBase['stock'] <= 0) {
|
|
|
$this->error('库存不足');
|
|
@@ -169,7 +169,7 @@ class Cart extends Base
|
|
|
*/
|
|
|
public function delete()
|
|
|
{
|
|
|
- $id = $this->request->post('id', 0);
|
|
|
+ $id = input('id', 0);
|
|
|
$userId = $this->auth->id;
|
|
|
$result = CartModel::destroy(function ($query) use ($id, $userId) {
|
|
|
$query->whereIn('id', $id)->where(['user_id' => $userId]);
|
|
@@ -192,8 +192,8 @@ class Cart extends Base
|
|
|
*/
|
|
|
public function number_change()
|
|
|
{
|
|
|
- $cart_id = $this->request->get('id', 0);
|
|
|
- $number = $this->request->get('number', 1);
|
|
|
+ $cart_id = input('id', 0);
|
|
|
+ $number = input('number', 1);
|
|
|
$cart = CartModel::get(['id' => $cart_id, 'user_id' => $this->auth->id]);
|
|
|
if (empty($cart)) {
|
|
|
$this->error('此商品不存在购物车');
|
|
@@ -218,8 +218,8 @@ class Cart extends Base
|
|
|
*/
|
|
|
public function choose_change()
|
|
|
{
|
|
|
- $trueArr = $this->request->post('trueArr', false);
|
|
|
- $falseArr = $this->request->post('falseArr', false);
|
|
|
+ $trueArr = input('trueArr', false);
|
|
|
+ $falseArr = input('falseArr', false);
|
|
|
$user_id = $this->auth->id;
|
|
|
try {
|
|
|
$cart = new CartModel();
|