作者 lyh

gx脚本更新路由

... ... @@ -41,7 +41,7 @@ class ProductLogic extends BaseLogic
* @time :2023/8/21 18:35
*/
public function productSave(){
// try {
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$data = $this->editProduct();
}else{
... ... @@ -51,10 +51,10 @@ class ProductLogic extends BaseLogic
KeywordRelated::saveRelated($data['id'],$this->param['keyword_id'] ?? []);//关键字关联
$this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段
$this->saveDetail($data['id'],$this->param['detail'] ?? []);
// }catch (\Exception $e){
// Log::info('错误信息---'.$e->getMessage());
// $this->fail('系统错误,请联系管理员');
// }
}catch (\Exception $e){
Log::info('错误信息---'.$e->getMessage());
$this->fail('系统错误,请联系管理员');
}
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? '');
$this->curlDelRoute(['new_route'=>$data['route'] ?? '']);
return $this->success(['id'=>$data['id']]);
... ... @@ -112,7 +112,7 @@ class ProductLogic extends BaseLogic
*/
public function saveDetail($product_id,$detail){
if(!empty($detail)){
// try {
try {
$this->delProductDetail($product_id);
foreach ($detail as $val){
//查看当前栏目是否存在
... ... @@ -120,14 +120,16 @@ class ProductLogic extends BaseLogic
continue;
}
$columnId = $this->getColumnId($product_id,$val['column_name']);
foreach ($val['data'] as $item){
$save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item);
$this->model->add($save_data);
if(!empty($val['data']) && is_array($val['data'])){
foreach ($val['data'] as $item){
$save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item);
$this->model->add($save_data);
}
}
}
// }catch (\Exception $e){
// $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage());
// }
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员.错误:'.$e->getMessage());
}
}
return $this->success(['product_id'=>$product_id]);
}
... ... @@ -535,6 +537,10 @@ class ProductLogic extends BaseLogic
return $this->success(['id'=>$save_id]);
}
public function copyDetail(){
}
/**
* @remark :复制项目扩展字段
* @name :copyExtendInfo
... ...