|
@@ -1571,26 +1571,38 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
->select('good.id', 'good.name', 'good.imgurl', 'good.description', 'good.updated_at', 'good.com',
|
|
|
'good.catid','good.type_id','good.website_id','good.cat_arr_id','good.created_at','good.city_id')
|
|
|
->latest('updated_at');
|
|
|
- $result['type1_count'] = $query->clone()->where('type_id', 1)->count();
|
|
|
- // 获取 type_id 为 1 的数据
|
|
|
- $result['type1'] = $this->processGoods(
|
|
|
- $query->clone()
|
|
|
- ->where('type_id', 1)
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->get(),
|
|
|
- $data
|
|
|
- );
|
|
|
- $result['type2_count'] = $query->clone()->where('type_id', 2)->count();
|
|
|
- // 获取 type_id 为 2 的数据
|
|
|
- $result['type2'] = $this->processGoods(
|
|
|
- $query->clone()
|
|
|
- ->where('type_id', 2)
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->get(),
|
|
|
- $data
|
|
|
- );
|
|
|
+ if(isset($data['ismix']) && $data['ismix'] == 1){
|
|
|
+ $result['count'] = $query->clone()->count();
|
|
|
+ $result['goods'] = $this->processGoods(
|
|
|
+ $query->clone()
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get(),
|
|
|
+ $data
|
|
|
+ );
|
|
|
+ }else{
|
|
|
+ $result['type1_count'] = $query->clone()->where('type_id', 1)->count();
|
|
|
+ // 获取 type_id 为 1 的数据
|
|
|
+ $result['type1'] = $this->processGoods(
|
|
|
+ $query->clone()
|
|
|
+ ->where('type_id', 1)
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get(),
|
|
|
+ $data
|
|
|
+ );
|
|
|
+ $result['type2_count'] = $query->clone()->where('type_id', 2)->count();
|
|
|
+ // 获取 type_id 为 2 的数据
|
|
|
+ $result['type2'] = $this->processGoods(
|
|
|
+ $query->clone()
|
|
|
+ ->where('type_id', 2)
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get(),
|
|
|
+ $data
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
if(empty($result)){
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|