作者 SHW\戥岁。。

规格购物车数量

@@ -404,7 +404,7 @@ class Classification extends Api @@ -404,7 +404,7 @@ class Classification extends Api
404 ->paginate(10, false, ['page' => $page]) 404 ->paginate(10, false, ['page' => $page])
405 ->each(function (&$item) { 405 ->each(function (&$item) {
406 if ($this->auth->isLogin()) { 406 if ($this->auth->isLogin()) {
407 - $item['cart_number'] = Db::name('cart') 407 + $item['cart_number'] = Db::name('cart')
408 ->where('user_id', $this->auth->id) 408 ->where('user_id', $this->auth->id)
409 ->where('goods_id', $item['goods_id']) 409 ->where('goods_id', $item['goods_id'])
410 ->sum('number'); 410 ->sum('number');
@@ -451,6 +451,10 @@ class Classification extends Api @@ -451,6 +451,10 @@ class Classification extends Api
451 } 451 }
452 $goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]); 452 $goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
453 foreach ($goods_spec as &$spec_value) { 453 foreach ($goods_spec as &$spec_value) {
  454 + //规格下的购物车数量
  455 + $spec_value['cart_number'] = Db::name('cart')
  456 + ->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
  457 + ->value('number');
454 //判断是否打折 458 //判断是否打折
455 $spec_value['is_discount'] = 'is'; 459 $spec_value['is_discount'] = 'is';
456 if ($spec_value['goods_price'] == $spec_value['line_price']) { 460 if ($spec_value['goods_price'] == $spec_value['line_price']) {
@@ -515,6 +519,11 @@ class Classification extends Api @@ -515,6 +519,11 @@ class Classification extends Api
515 } 519 }
516 $goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]); 520 $goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
517 foreach ($goods_spec as &$spec_value) { 521 foreach ($goods_spec as &$spec_value) {
  522 +
  523 + //规格下的购物车数量
  524 + $spec_value['cart_number'] = Db::name('cart')
  525 + ->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
  526 + ->value('number');
518 //判断是否打折 527 //判断是否打折
519 $spec_value['is_discount'] = 'is'; 528 $spec_value['is_discount'] = 'is';
520 if ($spec_value['goods_price'] == $spec_value['line_price']) { 529 if ($spec_value['goods_price'] == $spec_value['line_price']) {
@@ -12,6 +12,16 @@ return [ @@ -12,6 +12,16 @@ return [
12 ], 12 ],
13 'config_init' => [ 13 'config_init' => [
14 'nkeditor', 14 'nkeditor',
  15 + 'qcloudsms',
  16 + ],
  17 + 'sms_send' => [
  18 + 'qcloudsms',
  19 + ],
  20 + 'sms_notice' => [
  21 + 'qcloudsms',
  22 + ],
  23 + 'sms_check' => [
  24 + 'qcloudsms',
15 ], 25 ],
16 'upload_config_init' => [ 26 'upload_config_init' => [
17 'qiniu', 27 'qiniu',