作者 赵彬吉
... ... @@ -206,7 +206,11 @@ class ProductController extends BaseController
$query = $query->where('created_uid',$this->map['created_uid']);
}
if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){
$query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59');
if($this->user['project_id'] == 2059){
$query->where('send_time', '>=' ,$this->param['start_at'].' 00:00:00')->where('send_time', '<=' ,$this->param['end_at'].' 59:59:59');
}else{
$query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59');
}
}
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if($this->param['featured_status'] != Category::STATUS_ACTIVE) {
... ...
... ... @@ -56,7 +56,9 @@ class ProductLogic extends BaseLogic
$id = $this->param['id'];
}else{
$this->param = $this->addHandleParam($this->param);
$this->param['sort'] = $this->setNewsSort();
if($this->user['project_id'] != 2059){//2059项目不处理排序
$this->param['sort'] = $this->setProductSort();
}
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
... ... @@ -81,7 +83,7 @@ class ProductLogic extends BaseLogic
* @method :post
* @time :2023/12/25 9:27
*/
public function setNewsSort(){
public function setProductSort(){
$info = $this->model->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
... ... @@ -948,8 +950,18 @@ class ProductLogic extends BaseLogic
* @time :2024/9/20 16:48
*/
public function batchSetKeyword(){
$this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).',';
$this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]);
if(isset($this->param['is_cover']) && $this->param['is_cover'] == 1){//覆盖
$this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).',';
$this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]);
}else{
foreach ($this->param['id'] as $id){
//获取当前产品的分类
$productInfo = $this->model->read(['id'=>$id],['id','keyword_id']);
$keyword_ids_arr = array_values(array_unique(array_merge($productInfo['keyword_id'],$this->param['keyword_id'])));
$keyword_ids = ','.implode(',',$keyword_ids_arr).',';
$this->model->edit(['keyword_id'=>$keyword_ids],['id'=>$id]);
}
}
return $this->success();
}
}
... ...