| | |
| | | |
| | | use app\api\model\product\Product as ProductModel; |
| | | use app\api\model\plus\article\Article; |
| | | use app\api\model\supplier\Category; |
| | | use app\common\enum\supplier\SupplierType; |
| | | use app\common\model\page\Page as PageModel; |
| | | use app\api\model\plus\coupon\Coupon; |
| | | use app\api\model\plus\seckill\Product as SeckillProductModel; |
| | |
| | | use app\api\model\plus\bargain\Product as BargainProductModel; |
| | | use app\api\model\plus\bargain\Active as BargainActiveModel; |
| | | use app\api\model\plus\live\Room as RoomModel; |
| | | |
| | | use app\api\model\plus\release\Project; |
| | | use app\api\model\supplier\Supplier as SupplierModel; |
| | | /** |
| | | * 首页模型 |
| | | */ |
| | |
| | | /** |
| | | * DIY页面详情 |
| | | */ |
| | | public static function getPageData($user, $page_id = null,$city_supplier_ids='') |
| | | public static function getPageData($user, $page_id = null,$city_supplier_ids='',$latitude=0,$longitude=0) |
| | | { |
| | | // 页面详情 |
| | | $detail = $page_id > 0 ? parent::detail($page_id) : parent::getDefault(); |
| | |
| | | $items[$key]['data'] = $model->getCouponList($user, $item, true, 1); |
| | | } else if ($item['type'] === 'article') { |
| | | $items[$key]['data'] = $model->getArticleList($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'] === 'special') { |
| | | $items[$key]['data'] = $model->getSpecialList($item); |
| | | } else if ($item['type'] === 'seckillProduct') { |
| | |
| | | $items[$key]['data'] = $model->getLiveList($item); |
| | | } else if ($item['type'] === 'previewProduct') { |
| | | $items[$key]['data'] = $model->getPreviewList($user, $item); |
| | | } else if ($item['type'] === 'groupBuy') { |
| | | // 团购组件 |
| | | //$items[$key]['data'] = $model->getGroupBuyList($user, $item, $city_supplier_ids, $latitude, $longitude); |
| | | $items[$key]['style']['server_score_image']=$items[$key]['style']['server_score_image']==self::$base_url . 'image/diy/product/01.png'?'':$items[$key]['style']['server_score_image']; |
| | | //$items[$key]['category']=(new Category())->getALL(['category_type'=>SupplierType::GROUPBUYING]); |
| | | } |
| | | } |
| | | return ['page' => $items['page'], 'items' => $items]; |
| | |
| | | 'list_rows' => $item['params']['auto']['showNum'], |
| | | 'audit_status' => 10, |
| | | 'city_supplier_ids' => $city_supplier_ids, |
| | | 'is_gift_pack' => 0, |
| | | ], $user); |
| | | } |
| | | if ($productList->isEmpty()) return []; |
| | |
| | | $model = new Article; |
| | | $articleList = $model->getList($item['params']['auto']['category'], $item['params']['auto']['showNum']); |
| | | return $articleList->isEmpty() ? [] : $articleList->toArray()['data']; |
| | | } |
| | | |
| | | /** |
| | | * 获取供需列表 |
| | | */ |
| | | private function getReleaseList($item,$user=[]) |
| | | { |
| | | // 获取数据 |
| | | $model = new Project; |
| | | $list = $model->getIndexList($user,$item['params']['auto']['showNum']); |
| | | return $list->isEmpty() ? [] : $list->toArray()['data']; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return $data; |
| | | } |
| | | public function getSupplierList($item) |
| | | { |
| | | $model = new SupplierModel(); |
| | | $list = $model->getList([ |
| | | 'list_rows' => $item['params']['showNum'] |
| | | ]); |
| | | return $list->isEmpty() ? [] : $list->toArray()['data']; |
| | | } |
| | | |
| | | /** |
| | | * 团购组件:获取团购商户列表 |
| | | */ |
| | | private function getGroupBuyList($user, $item, $city_supplier_ids = '', $latitude = 0, $longitude = 0) |
| | | { |
| | | // 获取团购数据 |
| | | $model = new SupplierModel(); |
| | | $params = [ |
| | | 'list_rows' => isset($item['params']['showNum']) ? $item['params']['showNum'] : 10, |
| | | 'sortType' => isset($item['params']['merchantSort']) ? $item['params']['merchantSort'] : 'all', |
| | | 'product_num' => isset($item['params']['product_num']) ? $item['params']['product_num'] : 3, |
| | | 'city_supplier_ids' => $city_supplier_ids, |
| | | 'latitude' => $latitude, |
| | | 'longitude' => $longitude, |
| | | ]; |
| | | |
| | | // 如果有分类筛选 |
| | | if (isset($item['params']['category_id']) && $item['params']['category_id']) { |
| | | $params['category_id'] = $item['params']['category_id']; |
| | | } |
| | | |
| | | $list = $model->getGroupBuyList($params); |
| | | return empty($list['data']) ? [] : $list['data']; |
| | | } |
| | | } |