|
...
|
...
|
@@ -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();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|