Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
5 个修改的文件
包含
15 行增加
和
13 行删除
| @@ -77,7 +77,7 @@ class AyrReleaseController extends BaseController | @@ -77,7 +77,7 @@ class AyrReleaseController extends BaseController | ||
| 77 | //统一生成发布 | 77 | //统一生成发布 |
| 78 | foreach ($this->param['platforms'] as $value){ | 78 | foreach ($this->param['platforms'] as $value){ |
| 79 | if($value == 'youtube'){ | 79 | if($value == 'youtube'){ |
| 80 | - $param['youTubeOptions'] = json_encode(['title'=>$this->param['title']]); | 80 | + $param['youTubeOptions'] = ['title'=>$this->param['title']]; |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 |
| @@ -40,7 +40,7 @@ class CategoryController extends BaseController | @@ -40,7 +40,7 @@ class CategoryController extends BaseController | ||
| 40 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id | 40 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id |
| 41 | foreach ($list as $k =>$v){ | 41 | foreach ($list as $k =>$v){ |
| 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| 43 | - $v['product_num'] = $category->getProductNum($v['id']); | 43 | + $v['product_num'] = $category->getProductNum($list,$v['id']); |
| 44 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); | 44 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); | 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); |
| 46 | $list[$k] = $v; | 46 | $list[$k] = $v; |
| @@ -115,9 +115,12 @@ class ProductController extends BaseController | @@ -115,9 +115,12 @@ class ProductController extends BaseController | ||
| 115 | $query = $query->where('project_id',$this->user['project_id']); | 115 | $query = $query->where('project_id',$this->user['project_id']); |
| 116 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 116 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 117 | $str[] = $this->map['category_id']; | 117 | $str[] = $this->map['category_id']; |
| 118 | - $str = $this->getAllSub($this->map['category_id'],$str); | ||
| 119 | - $productArr = CategoryRelated::whereIn('cate_id',$str)->pluck('product_id')->toArray(); | ||
| 120 | - $query->whereIn('id',$productArr); | 118 | + $this->getAllSub($this->map['category_id'],$str); |
| 119 | + $query->where(function ($subQuery) use ($str) { | ||
| 120 | + foreach ($str as $v) { | ||
| 121 | + $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 122 | + } | ||
| 123 | + }); | ||
| 121 | } | 124 | } |
| 122 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 125 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 123 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 126 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
| @@ -215,7 +215,7 @@ class ProductLogic extends BaseLogic | @@ -215,7 +215,7 @@ class ProductLogic extends BaseLogic | ||
| 215 | try { | 215 | try { |
| 216 | if(isset($this->param['route']) && !empty($this->param['route'])){ | 216 | if(isset($this->param['route']) && !empty($this->param['route'])){ |
| 217 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 217 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 218 | - $this->editProductRoute($this->param['id'],$this->param['route']); | 218 | +// $this->editProductRoute($this->param['id'],$this->param['route']); |
| 219 | } | 219 | } |
| 220 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 220 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 221 | //产品分类关联 | 221 | //产品分类关联 |
| @@ -48,12 +48,11 @@ class Category extends Base | @@ -48,12 +48,11 @@ class Category extends Base | ||
| 48 | * @method :post | 48 | * @method :post |
| 49 | * @time :2023/10/18 15:10 | 49 | * @time :2023/10/18 15:10 |
| 50 | */ | 50 | */ |
| 51 | - public function getAllSub($id,&$str = []){ | ||
| 52 | - $list = $this->list(['pid'=>$id,'status'=>1],['id','pid']); | ||
| 53 | - if(!empty($list)){ | ||
| 54 | - foreach ($list as $v){ | 51 | + public function getAllSub($list,$id,&$str = []){ |
| 52 | + foreach ($list as $k =>$v){ | ||
| 53 | + if($v['pid'] == $id){ | ||
| 55 | $str[] = $v['id']; | 54 | $str[] = $v['id']; |
| 56 | - $this->getAllSub($v['id'],$str); | 55 | + $this->getAllSub($list,$v['id'],$str); |
| 57 | } | 56 | } |
| 58 | } | 57 | } |
| 59 | return $str; | 58 | return $str; |
| @@ -66,9 +65,9 @@ class Category extends Base | @@ -66,9 +65,9 @@ class Category extends Base | ||
| 66 | * @author zbj | 65 | * @author zbj |
| 67 | * @date 2023/4/28 | 66 | * @date 2023/4/28 |
| 68 | */ | 67 | */ |
| 69 | - public function getProductNum($cate_id){ | 68 | + public function getProductNum($list,$cate_id){ |
| 70 | $str[] = $cate_id; | 69 | $str[] = $cate_id; |
| 71 | - $cate_ids = $this->getAllSub($cate_id,$str); | 70 | + $cate_ids = $this->getAllSub($list,$cate_id,$str); |
| 72 | $productArr = CategoryRelated::whereIn('cate_id',$cate_ids)->pluck('product_id')->unique()->toArray(); | 71 | $productArr = CategoryRelated::whereIn('cate_id',$cate_ids)->pluck('product_id')->unique()->toArray(); |
| 73 | $count = count($productArr); | 72 | $count = count($productArr); |
| 74 | return $count; | 73 | return $count; |
-
请 注册 或 登录 后发表评论