作者 lyh

gx

... ... @@ -70,8 +70,8 @@ class ProductLogic extends BaseLogic
public function save($param){
//封面取第一个图片
$param['thumb'] = $param['gallery'][0] ?? '';
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$data = $param;
$data['created_uid'] = $this->user['id'];
$res = parent::save($data);
... ... @@ -81,12 +81,12 @@ class ProductLogic extends BaseLogic
KeywordRelated::saveRelated($res['id'], $data['keyword_id']);
//路由映射
$route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $res['id'], $this->user['project_id']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// errorLog('产品保存失败', $param, $e);
// $this->fail('保存失败');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
errorLog('产品保存失败', $param, $e);
$this->fail('保存失败');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]);
return $this->success();
... ...
... ... @@ -25,7 +25,7 @@ class Product extends Base
const STATUS_ON = 1;
const STATUS_RECYCLE = 2;
protected $appends = ['route'];
// protected $appends = ['route'];
public static function statusMap(){
return [
... ...