|
|
@@ -230,22 +230,30 @@ class Merchant extends BaseController
|
|
230
|
230
|
}
|
|
231
|
231
|
|
|
232
|
232
|
if (!empty($pageMatchIds)) {
|
|
233
|
|
- // 4. 通过 productList 获取完整格式的推荐商品数据
|
|
234
|
|
- $recommendWhere = $where;
|
|
235
|
|
- unset($recommendWhere['keyword'], $recommendWhere['order'], $recommendWhere['mer_cate_id'], $recommendWhere['cate_id'], $recommendWhere['price_on'], $recommendWhere['price_off'], $recommendWhere['brand_id']);
|
|
236
|
|
- $recommendResult = $this->repository->productList($id, array_merge($recommendWhere, [
|
|
237
|
|
- 'is_gift_bag' => 0,
|
|
238
|
|
- 'is_used' => 1,
|
|
239
|
|
- 'product_type' => 0,
|
|
240
|
|
- 'is_hide' => 0,
|
|
241
|
|
- ]), 1, count($pageMatchIds), $this->userInfo, $type439, $is_commercetrade);
|
|
|
233
|
+ // 4. 直接用 pageMatchIds 查询 store_product 表获取基础数据
|
|
|
234
|
+ // 再通过 pvParm 补充 yanglao/pv/jifen/gongxian 等格式化字段
|
|
|
235
|
+ $baseProducts = Db::name('store_product')
|
|
|
236
|
+ ->where('mer_id', $id)
|
|
|
237
|
+ ->whereIn('product_id', $pageMatchIds)
|
|
|
238
|
+ ->where('is_show', 1)
|
|
|
239
|
+ ->where('status', 1)
|
|
|
240
|
+ ->where('is_del', 0)
|
|
|
241
|
+ ->select();
|
|
|
242
|
+ $baseProducts = $baseProducts->toArray();
|
|
242
|
243
|
|
|
243
|
244
|
$matchList = [];
|
|
244
|
|
- if (!empty($recommendResult['list'])) {
|
|
245
|
|
- foreach ($recommendResult['list'] as $rp) {
|
|
246
|
|
- if (in_array($rp['product_id'], $pageMatchIds) && !in_array($rp['product_id'], $existIds)) {
|
|
247
|
|
- $matchList[] = $rp;
|
|
248
|
|
- }
|
|
|
245
|
+ if (!empty($baseProducts)) {
|
|
|
246
|
+ foreach ($baseProducts as $bp) {
|
|
|
247
|
+ // 补充 pv/yanglao/jifen/gongxian 等字段
|
|
|
248
|
+ $pvData = app()->make(ProductRepository::class)->pvParm($bp['product_id']);
|
|
|
249
|
+ $bp['yanglao'] = $pvData['yanglao'] ?? '';
|
|
|
250
|
+ $bp['pv'] = $pvData['pv'] ?? '';
|
|
|
251
|
+ $bp['jifen'] = $pvData['jifen'] ?? '';
|
|
|
252
|
+ $bp['gongxian'] = $pvData['gongxian'] ?? '';
|
|
|
253
|
+ $bp['jfduihuan'] = $pvData['jfduihuan'] ?? '';
|
|
|
254
|
+ $bp['jdduihuan'] = $pvData['jdduihuan'] ?? '';
|
|
|
255
|
+ $bp['fzone_paytype'] = $pvData['fzone_paytype'] ?? '';
|
|
|
256
|
+ $matchList[] = $bp;
|
|
249
|
257
|
}
|
|
250
|
258
|
}
|
|
251
|
259
|
|