|
@@ -4,6 +4,7 @@ namespace app\api\controller;
|
|
|
|
|
|
|
|
use app\admin\model\system\SystemAttachment;
|
|
use app\admin\model\system\SystemAttachment;
|
|
|
use app\models\store\StoreCategory;
|
|
use app\models\store\StoreCategory;
|
|
|
|
|
+use app\models\store\StoreCoupon;
|
|
|
use app\models\store\StoreCouponIssue;
|
|
use app\models\store\StoreCouponIssue;
|
|
|
use app\models\store\StoreOrder;
|
|
use app\models\store\StoreOrder;
|
|
|
use app\models\store\StoreOrderCartInfo;
|
|
use app\models\store\StoreOrderCartInfo;
|
|
@@ -301,10 +302,11 @@ class PublicController
|
|
|
$list = [];
|
|
$list = [];
|
|
|
} else{
|
|
} else{
|
|
|
foreach ($list as &$item) {
|
|
foreach ($list as &$item) {
|
|
|
- $item['coupon'] = StoreProduct::field('id,store_name,price,ot_price')->where('coupon', $item['id'])->where('id', '>', 2)->select();
|
|
|
|
|
|
|
+ $coupon = StoreCoupon::where('store_id', $item['id'])->column('id');
|
|
|
|
|
+ $item['coupon'] = StoreProduct::field('id,store_name,price,ot_price')->where('coupon', 'in',$coupon)->where('id', '>', 2)->select();
|
|
|
$id = StoreProduct::where('coupon', $item['id'])->where('id', '>', 2)->column('id');
|
|
$id = StoreProduct::where('coupon', $item['id'])->where('id', '>', 2)->column('id');
|
|
|
$orderId = StoreOrderCartInfo::where('product_id', 'in',$id)->column('oid');
|
|
$orderId = StoreOrderCartInfo::where('product_id', 'in',$id)->column('oid');
|
|
|
- $item['count'] = count($orderId) > 0?StoreOrder::where('id', $orderId)->where('status', '>', 2)->count():0;
|
|
|
|
|
|
|
+ $item['count'] = count($orderId) > 0?StoreOrder::where('id', 'in',$orderId)->where('status', '>', 2)->count():0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$data['list'] = $list;
|
|
$data['list'] = $list;
|
|
@@ -357,7 +359,8 @@ class PublicController
|
|
|
$data = empty($data) ? [] : $data->toArray();
|
|
$data = empty($data) ? [] : $data->toArray();
|
|
|
$data['slider_image'] = json_decode($data['slider_image']);
|
|
$data['slider_image'] = json_decode($data['slider_image']);
|
|
|
$data['images'] = json_decode($data['gatehead']);
|
|
$data['images'] = json_decode($data['gatehead']);
|
|
|
- $data['coupon'] = StoreProduct::field('id,store_name,price,ot_price,image')->where('coupon', $data['id'])->where('id', '>', 2)->select();
|
|
|
|
|
|
|
+ $coupon = StoreCoupon::where('store_id', $data['id'])->column('id');
|
|
|
|
|
+ $data['coupon'] = StoreProduct::field('id,store_name,price,ot_price,image')->where('coupon', 'in',$coupon)->where('id', '>', 2)->select();
|
|
|
return app('json')->successful($data);
|
|
return app('json')->successful($data);
|
|
|
}
|
|
}
|
|
|
|
|
|