作者 赵彬吉
@@ -206,8 +206,12 @@ class ProductController extends BaseController @@ -206,8 +206,12 @@ class ProductController extends BaseController
206 $query = $query->where('created_uid',$this->map['created_uid']); 206 $query = $query->where('created_uid',$this->map['created_uid']);
207 } 207 }
208 if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){ 208 if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){
  209 + if($this->user['project_id'] == 2059){
  210 + $query->where('send_time', '>=' ,$this->param['start_at'].' 00:00:00')->where('send_time', '<=' ,$this->param['end_at'].' 59:59:59');
  211 + }else{
209 $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59'); 212 $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59');
210 } 213 }
  214 + }
211 $this->param['featured_status'] = $this->param['featured_status'] ?? 0; 215 $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
212 if($this->param['featured_status'] != Category::STATUS_ACTIVE) { 216 if($this->param['featured_status'] != Category::STATUS_ACTIVE) {
213 $cateModel = new Category(); 217 $cateModel = new Category();
@@ -56,7 +56,9 @@ class ProductLogic extends BaseLogic @@ -56,7 +56,9 @@ class ProductLogic extends BaseLogic
56 $id = $this->param['id']; 56 $id = $this->param['id'];
57 }else{ 57 }else{
58 $this->param = $this->addHandleParam($this->param); 58 $this->param = $this->addHandleParam($this->param);
59 - $this->param['sort'] = $this->setNewsSort(); 59 + if($this->user['project_id'] != 2059){//2059项目不处理排序
  60 + $this->param['sort'] = $this->setProductSort();
  61 + }
60 $id = $this->model->addReturnId($this->param); 62 $id = $this->model->addReturnId($this->param);
61 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 63 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
62 $this->model->edit(['route'=>$route],['id'=>$id]); 64 $this->model->edit(['route'=>$route],['id'=>$id]);
@@ -81,7 +83,7 @@ class ProductLogic extends BaseLogic @@ -81,7 +83,7 @@ class ProductLogic extends BaseLogic
81 * @method :post 83 * @method :post
82 * @time :2023/12/25 9:27 84 * @time :2023/12/25 9:27
83 */ 85 */
84 - public function setNewsSort(){ 86 + public function setProductSort(){
85 $info = $this->model->orderBy('sort','desc')->first(); 87 $info = $this->model->orderBy('sort','desc')->first();
86 if(empty($info)){ 88 if(empty($info)){
87 return 1; 89 return 1;
@@ -948,8 +950,18 @@ class ProductLogic extends BaseLogic @@ -948,8 +950,18 @@ class ProductLogic extends BaseLogic
948 * @time :2024/9/20 16:48 950 * @time :2024/9/20 16:48
949 */ 951 */
950 public function batchSetKeyword(){ 952 public function batchSetKeyword(){
  953 + if(isset($this->param['is_cover']) && $this->param['is_cover'] == 1){//覆盖
951 $this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).','; 954 $this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).',';
952 $this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]); 955 $this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]);
  956 + }else{
  957 + foreach ($this->param['id'] as $id){
  958 + //获取当前产品的分类
  959 + $productInfo = $this->model->read(['id'=>$id],['id','keyword_id']);
  960 + $keyword_ids_arr = array_values(array_unique(array_merge($productInfo['keyword_id'],$this->param['keyword_id'])));
  961 + $keyword_ids = ','.implode(',',$keyword_ids_arr).',';
  962 + $this->model->edit(['keyword_id'=>$keyword_ids],['id'=>$id]);
  963 + }
  964 + }
953 return $this->success(); 965 return $this->success();
954 } 966 }
955 } 967 }