diff --git a/app/Http/Controllers/Api/CartController.php b/app/Http/Controllers/Api/CartController.php
index 6e86eb2..43c869e 100644
--- a/app/Http/Controllers/Api/CartController.php
+++ b/app/Http/Controllers/Api/CartController.php
@@ -42,13 +42,7 @@ class CartController extends CommonController
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
- $res = Cart::cartAdd($data);
- if($res !== true)
- {
- return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
- }
-
- return ReturnData::create(ReturnData::SUCCESS);
+ return Cart::cartAdd($data);
}
//删除购物车
diff --git a/app/Http/Model/Cart.php b/app/Http/Model/Cart.php
index e596bec..9352a5f 100644
--- a/app/Http/Model/Cart.php
+++ b/app/Http/Model/Cart.php
@@ -1,5 +1,6 @@
$user_id])->count() >= 20)
{
- return '购物车商品最多20件';
+ return ReturnData::create(ReturnData::PARAMS_ERROR,null,'购物车商品最多20件');
}
//查看是否已经有购物车插入记录
@@ -151,6 +152,8 @@ class Cart extends BaseModel
);
self::where(array('id'=>$cart->id))->update($updateArr);
+
+ $cart_id = $cart->id;
}
else
{
@@ -162,10 +165,10 @@ class Cart extends BaseModel
'add_time' => time(),
);
- self::insertGetId($cartInsert);
+ $cart_id = self::insertGetId($cartInsert);
}
- return true;
+ return ReturnData::create(ReturnData::SUCCESS,$cart_id,'购物车添加成功');
}
/**
diff --git a/resources/views/weixin/cart/index.blade.php b/resources/views/weixin/cart/index.blade.php
index 9720568..2b1ccdb 100644
--- a/resources/views/weixin/cart/index.blade.php
+++ b/resources/views/weixin/cart/index.blade.php
@@ -31,7 +31,7 @@
-
+
@@ -117,6 +117,28 @@