...
|
...
|
@@ -404,7 +404,7 @@ class Classification extends Api |
|
|
->paginate(10, false, ['page' => $page])
|
|
|
->each(function (&$item) {
|
|
|
if ($this->auth->isLogin()) {
|
|
|
$item['cart_number'] = Db::name('cart')
|
|
|
$item['cart_number'] = Db::name('cart')
|
|
|
->where('user_id', $this->auth->id)
|
|
|
->where('goods_id', $item['goods_id'])
|
|
|
->sum('number');
|
...
|
...
|
@@ -451,6 +451,10 @@ class Classification extends Api |
|
|
}
|
|
|
$goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
|
|
|
foreach ($goods_spec as &$spec_value) {
|
|
|
//规格下的购物车数量
|
|
|
$spec_value['cart_number'] = Db::name('cart')
|
|
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
|
|
->value('number');
|
|
|
//判断是否打折
|
|
|
$spec_value['is_discount'] = 'is';
|
|
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|
...
|
...
|
@@ -515,6 +519,11 @@ class Classification extends Api |
|
|
}
|
|
|
$goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
|
|
|
foreach ($goods_spec as &$spec_value) {
|
|
|
|
|
|
//规格下的购物车数量
|
|
|
$spec_value['cart_number'] = Db::name('cart')
|
|
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
|
|
->value('number');
|
|
|
//判断是否打折
|
|
|
$spec_value['is_discount'] = 'is';
|
|
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|
...
|
...
|
|