| | |
| | | |
| | | namespace app\api\model\supplier\page; |
| | | |
| | | use app\api\model\plus\release\Project; |
| | | use app\api\model\product\Product as ProductModel; |
| | | use app\api\model\plus\article\Article; |
| | | use app\common\model\supplier\page\Page as PageModel; |
| | |
| | | isset($detail['page_data']['page']) && $items['page'] = $detail['page_data']['page']; |
| | | // 获取动态数据 |
| | | $model = new self; |
| | | |
| | | $page = (new \app\api\model\page\Page())::getDefault(); |
| | | foreach ($items as $key => $item) { |
| | | unset($items[$key]['defaultData']); |
| | | if ($item['type'] === 'window') { |
| | | $items[$key]['data'] = array_values($item['data']); |
| | | } else if ($item['type'] === 'product') { |
| | | if (!empty($page)) { |
| | | if ($page['page_id'] == 10079){ |
| | | $item['params']['auto']['category']=197; |
| | | } |
| | | } |
| | | $items[$key]['data'] = $model->getProductList($user, $item,$city_supplier_ids,$shop_supplier_id); |
| | | } else if ($item['type'] === 'coupon') { |
| | | $items[$key]['data'] = $model->getCouponList($user, $item, true, 1); |
| | |
| | | $items[$key]['data'] = $model->getArticleList($item); |
| | | } else if ($item['type'] === 'special') { |
| | | $items[$key]['data'] = $model->getSpecialList($item); |
| | | }else if ($item['type'] === 'hdzq') { |
| | | $items[$key]['data'] = $model->getReleaseList($item,$user); |
| | | }else if ($item['type'] === 'gxpp') { |
| | | $items[$key]['data'] = $model->getReleaseList($item,$user); |
| | | } else if ($item['type'] === 'seckillProduct') { |
| | | // 如果没有活动,则不显示 |
| | | $item_data = $model->getSeckillList($item); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取供需列表 |
| | | */ |
| | | private function getReleaseList($item,$user=[]) |
| | | { |
| | | // 获取数据 |
| | | $model = new Project; |
| | | $list = $model->getIndexList($user,$item['params']['auto']['showNum']); |
| | | return $list->isEmpty() ? [] : $list->toArray()['data']; |
| | | } |
| | | /** |
| | | * 商品组件:获取商品列表 |
| | | */ |
| | | private function getProductList($user, $item,$city_supplier_ids='',$shop_supplier_id=0) |
| | |
| | | 'list_rows' => $item['params']['auto']['showNum'], |
| | | 'audit_status' => 10, |
| | | 'city_supplier_ids' => $city_supplier_ids, |
| | | 'is_gift_pack' => 0, |
| | | ], $user); |
| | | } |
| | | if ($productList->isEmpty()) return []; |
| | |
| | | 'product_id' => $product['product_id'], |
| | | 'product_name' => $product['product_name'], |
| | | 'selling_point' => $product['selling_point'], |
| | | 'is_price_negotiable' => $product['is_price_negotiable'], |
| | | 'image' => $product['image'][0]['file_path'], |
| | | 'product_image' => $product['image'][0]['file_path'], |
| | | 'product_price' => $show_sku['product_price'], |