作者 lyh

gx

... ... @@ -38,8 +38,8 @@ class ProductLogic extends BaseLogic
// $category_ids = $this->param['category_id'] ?? [];
//参数处理
$this->param = $this->handleSaveParam($this->param);
// DB::connection('custom_mysql')->beginTransaction();
// try {
DB::connection('custom_mysql')->beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//查看路由是否更新
$id = $this->editProductRoute($this->param['id'],$this->param['route']);
... ... @@ -55,11 +55,11 @@ class ProductLogic extends BaseLogic
$this->model->edit(['route'=>$route],['id'=>$id]);
//产品分类关联
// CategoryRelated::saveRelated($id, $category_ids);
// DB::connection('custom_mysql')->commit();
// }catch (\Exception $e){
// DB::connection('custom_mysql')->rollBack();
// $this->fail('系统错误请联系管理员');
// }
DB::connection('custom_mysql')->commit();
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误请联系管理员');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]);
return $this->success();
... ... @@ -85,7 +85,6 @@ 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'])){
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['category_id'], true) . PHP_EOL, FILE_APPEND);
$param['category_id'] = $this->getLastCategory($param['category_id']);
}
if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
... ...