|
@@ -90,6 +90,10 @@ class Buy extends Core
|
|
|
if ($this->data['cart']) {
|
|
|
foreach ($this->data['cart'] as $k => $v) {
|
|
|
$this->data['cart'][$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
|
|
|
+
|
|
|
+ if (isset($this->data['cart'][$k]['goods']['sku_id'])) {
|
|
|
+ $this->data['cart'][$k]['price_id'] = $this->data['cart'][$k]['goods']['sku_id'];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -144,19 +148,27 @@ class Buy extends Core
|
|
|
$where['id'] = Dever::input('cart_id');
|
|
|
|
|
|
$status = Dever::input('status', 1);
|
|
|
+ $type = Dever::input('type', 1);
|
|
|
$num = Dever::input('num');
|
|
|
|
|
|
$info = Dever::db('shop/cart')->find($where);
|
|
|
|
|
|
$state = false;
|
|
|
+
|
|
|
if ($info) {
|
|
|
+ if ($type == 1) {
|
|
|
+ $num = $info['num'] + $num;
|
|
|
+ } else {
|
|
|
+ $num = $info['num'] - $num;
|
|
|
+ }
|
|
|
$where = array();
|
|
|
$where['where_id'] = $info['id'];
|
|
|
if ($num <= 0) {
|
|
|
$state = Dever::db('shop/cart')->delete($where);
|
|
|
} else {
|
|
|
$where['status'] = $status;
|
|
|
- $where['num'] = $info['num'] + $num;
|
|
|
+ $where['num'] = $num;
|
|
|
+
|
|
|
# 验证库存
|
|
|
Dever::load('shop/lib/info')->checkTotal($where['num'], $info['goods_id'], $this->shop_id, $info['sku_id'], 2);
|
|
|
$state = Dever::db('shop/cart')->update($where);
|