|
...
|
...
|
@@ -75,12 +75,8 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2023/10/26 9:49
|
|
|
|
*/
|
|
|
|
public function editList(){
|
|
|
|
if(isset($this->param['category_id']) && !empty($this->param['category_id'])){
|
|
|
|
$this->param['category_id'] = $this->getLastCategory($this->param['category_id']);
|
|
|
|
}
|
|
|
|
if(isset($this->param['keyword_id']) && !empty($this->param['keyword_id'])){
|
|
|
|
$this->param['keyword_id'] = ','.implode(',',$this->saveKeyword($this->param['keyword_id'])).',';
|
|
|
|
}
|
|
|
|
$this->param['category_id'] = $this->getLastCategory($this->param['category_id']);
|
|
|
|
$this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
...
|
...
|
@@ -93,8 +89,9 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2023/10/26 9:51
|
|
|
|
*/
|
|
|
|
public function saveKeyword($keyword){
|
|
|
|
$arr = [];
|
|
|
|
$str = '';
|
|
|
|
if(!empty($keyword) && is_array($keyword)){
|
|
|
|
$arr = [];
|
|
|
|
$keywordModel = new Keyword();
|
|
|
|
foreach ($keyword as $v){
|
|
|
|
//查询当前关键字是否存在
|
|
...
|
...
|
@@ -114,8 +111,9 @@ class ProductLogic extends BaseLogic |
|
|
|
$arr[] = $info['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$str = ','.implode(',',$arr).',';
|
|
|
|
}
|
|
|
|
return $arr;
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -137,9 +135,7 @@ class ProductLogic extends BaseLogic |
|
|
|
}
|
|
|
|
$param['attrs'] = Arr::a2s($param['attrs'] ?? '');
|
|
|
|
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
|
|
|
|
if(isset($param['category_id']) && !empty($param['category_id'])){
|
|
|
|
$param['category_id'] = $this->getLastCategory($param['category_id']);
|
|
|
|
}
|
|
|
|
$param['category_id'] = $this->getLastCategory($param['category_id']);
|
|
|
|
if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
|
|
|
|
$param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).',';
|
|
|
|
}
|
|
...
|
...
|
@@ -166,11 +162,13 @@ class ProductLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function getLastCategory($category){
|
|
|
|
$str = '';
|
|
|
|
$cateModel = new Category();
|
|
|
|
foreach ($category as $v){
|
|
|
|
$info = $cateModel->read(['pid'=>$v]);
|
|
|
|
if($info === false){
|
|
|
|
$str .= $v.',';
|
|
|
|
if(isset($category) && !empty($category)){
|
|
|
|
$cateModel = new Category();
|
|
|
|
foreach ($category as $v){
|
|
|
|
$info = $cateModel->read(['pid'=>$v]);
|
|
|
|
if($info === false){
|
|
|
|
$str .= $v.',';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ','.$str;
|
...
|
...
|
|