|
|
@@ -121,20 +121,9 @@ class ProductDao extends BaseDao
|
|
121
|
121
|
$query -> where("type != 7");
|
|
122
|
122
|
$query->withSearch($keyArray, $whereArr);
|
|
123
|
123
|
|
|
124
|
|
- if($mer_type==1 && $merId==324){
|
|
125
|
|
- $merIds=Db::name('merchant')->where('mer_type',1)->column('mer_id');
|
|
126
|
|
- //一壶茶会员专区
|
|
127
|
|
- $query->when($merIds, function ($query) use ($merIds) {
|
|
128
|
|
- $query->whereIn('mer_id', $merIds);
|
|
129
|
|
- });
|
|
130
|
|
- }else{
|
|
131
|
|
- $query->when(($merId !== null), function ($query) use ($merId) {
|
|
132
|
|
- $query->where('mer_id', $merId);
|
|
133
|
|
- });
|
|
134
|
|
- }
|
|
135
|
|
-
|
|
136
|
|
-
|
|
137
|
|
- $query->when(isset($where['hot_type']) && $where['hot_type'] !== '', function ($query) use ($where) {
|
|
|
124
|
+ $query->when(!empty($merId), function ($query) use ($merId) {
|
|
|
125
|
+ $query->where('mer_id', $merId);
|
|
|
126
|
+ })->when(isset($where['hot_type']) && $where['hot_type'] !== '', function ($query) use ($where) {
|
|
138
|
127
|
if ($where['hot_type'] == 'new')
|
|
139
|
128
|
$query->where('is_new', 1);
|
|
140
|
129
|
else if ($where['hot_type'] == 'hot')
|
|
|
@@ -162,16 +151,7 @@ class ProductDao extends BaseDao
|
|
162
|
151
|
unset($where['keyword']);
|
|
163
|
152
|
})->when(isset($where['volunteer']),function ($query) use ($where){
|
|
164
|
153
|
$query-> where('volunteer',$where['volunteer']);
|
|
165
|
|
- });
|
|
166
|
|
- $source = request()->header('source');
|
|
167
|
|
- $merId= request()->header('merId');
|
|
168
|
|
- if($source=='yhc' && $merId){
|
|
169
|
|
-// $query->where('spu_id = "" || spu_id is null');
|
|
170
|
|
-// $query->where('type',17);
|
|
171
|
|
- $query->where('is_good',1);
|
|
172
|
|
- }
|
|
173
|
|
-
|
|
174
|
|
- $query->when(isset($where['order']),function($query)use($where){
|
|
|
154
|
+ })->when(isset($where['order']),function($query)use($where){
|
|
175
|
155
|
$query->when(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales', 'create_time']), function ($query) use ($where) {
|
|
176
|
156
|
if ($where['order'] == 'price_asc') {
|
|
177
|
157
|
$where['order'] = 'price ASC';
|