|
@@ -318,6 +318,19 @@ class Data extends Core
|
|
|
return $this->data['cart'];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function scan()
|
|
|
+ {
|
|
|
+ $goods = Dever::load('goods/lib/info')->getGoodsByCode($this->shop_id, 1, true);
|
|
|
+ if ($goods) {
|
|
|
+ Dever::setInput('goods_id', $goods['id']);
|
|
|
+ Dever::setInput('price_id', $goods['sku']['id']);
|
|
|
+
|
|
|
+ return $this->addCart();
|
|
|
+ }
|
|
|
+ Dever::alert('错误的商品');
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function addCart()
|
|
|
{
|
|
@@ -330,7 +343,7 @@ class Data extends Core
|
|
|
|
|
|
$info = Dever::db('shop/shop_cart')->find($where);
|
|
|
|
|
|
- $where['num'] = Dever::input('num');
|
|
|
+ $where['num'] = Dever::input('num', 1);
|
|
|
if (!$info) {
|
|
|
|
|
|
Dever::load('shop/lib/info')->checkTotal($where['num'], $where['goods_id'], $this->shop_id, $where['sku_id'], 2);
|