作者 Your Name
@@ -649,6 +649,14 @@ class ProjectUpdate extends Command @@ -649,6 +649,14 @@ class ProjectUpdate extends Command
649 $new_img = $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url); 649 $new_img = $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url);
650 //名称去掉特殊符号 650 //名称去掉特殊符号
651 $item['title'] = $this->special2str($item['title'] ?? ''); 651 $item['title'] = $this->special2str($item['title'] ?? '');
  652 + //排序
  653 + $sort = 0;
  654 + if(isset($item['listorder'])){
  655 + $sort = $item['listorder'];
  656 + }
  657 + if(isset($item['sort'])){
  658 + $sort = $item['sort'];
  659 + }
652 660
653 try { 661 try {
654 $custom_content = $model->read(['route' => $route], ['id','six_read']); 662 $custom_content = $model->read(['route' => $route], ['id','six_read']);
@@ -659,7 +667,7 @@ class ProjectUpdate extends Command @@ -659,7 +667,7 @@ class ProjectUpdate extends Command
659 'module_id' => $custom_info['id'], 667 'module_id' => $custom_info['id'],
660 'category_id' => $category_id, 668 'category_id' => $category_id,
661 'content' => $item['content'] ?? '', 669 'content' => $item['content'] ?? '',
662 - 'sort' => $item['sort'] ?? 0, 670 + 'sort' => $sort,
663 'image' => $new_img, 671 'image' => $new_img,
664 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 672 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
665 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 673 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
@@ -154,11 +154,9 @@ class ProductController extends BaseController @@ -154,11 +154,9 @@ class ProductController extends BaseController
154 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { 154 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) {
155 $str[] = $this->map['category_id']; 155 $str[] = $this->map['category_id'];
156 $this->getAllSub($this->map['category_id'],$str); 156 $this->getAllSub($this->map['category_id'],$str);
157 - $query->where(function ($subQuery) use ($str) {  
158 - foreach ($str as $v) {  
159 - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]);  
160 - }  
161 - }); 157 + $categoryRelatedModel = new CategoryRelated();
  158 + $product_id_arr = $categoryRelatedModel->whereIn('cate_id',$str)->pluck('product_id')->toArray();
  159 + $query = $query->whereIn('id',$product_id_arr);
162 } 160 }
163 if(isset($this->map['title']) && !empty($this->map['title'])){ 161 if(isset($this->map['title']) && !empty($this->map['title'])){
164 $query = $query->where('title','like','%'.$this->map['title'].'%'); 162 $query = $query->where('title','like','%'.$this->map['title'].'%');