作者 lyh

gx

... ... @@ -110,7 +110,7 @@ class DetailController extends BaseController
'product_id.required' => '产品id不能为空',
'data.required' => 'data不能为空',
]);
$data = $logic->saveDetail();
$data = $logic->saveDetail($this->param['product_id'],$this->param['data']);
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -50,15 +50,15 @@ class DetailLogic extends BaseLogic
* @method :post
* @time :2024/11/13 9:30
*/
public function saveDetail(){
if(!empty($this->param['data'])){
public function saveDetail($product_id,$data){
if(!empty($data)){
try {
foreach ($this->param['data'] as $data){
foreach ($data as $v){
foreach ($data as $val){
foreach ($val as $v){
$save_data = [
'sort'=>$v['sort'],
'column_id'=>$v['column_id'],
'product_id'=>$this->param['product_id'],
'product_id'=>$product_id,
'text_type'=>$v['text_type'],
'title'=>$v['title'] ?? '',
'content'=>json_encode($v['content'] ?? [],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
... ... @@ -75,6 +75,6 @@ class DetailLogic extends BaseLogic
$this->fail('保存失败,请联系管理员.错误:'.$e->getMessage());
}
}
return $this->success(['product_id'=>$this->param['product_id']]);
return $this->success(['product_id'=>$product_id]);
}
}
... ...
... ... @@ -67,6 +67,9 @@ class ProductLogic extends BaseLogic
//产品分类关联
CategoryRelated::saveRelated($id, $category_ids);
KeywordRelated::saveRelated($id,$category_ids);
//更新产品新描述
$detailLogic = new DetailLogic();
$detailLogic->saveDetail($id,$this->param['data'] ?? []);
//保存扩展字段
$this->saveExtendInfo($id,$extend);
}catch (\Exception $e){
... ...