|
@@ -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']) {
|