作者 lyh

gx

@@ -85,8 +85,8 @@ class TranslateController extends BaseController @@ -85,8 +85,8 @@ class TranslateController extends BaseController
85 'url.required' => 'url不能为空', 85 'url.required' => 'url不能为空',
86 'alias.required' => 'url不能为空', 86 'alias.required' => 'url不能为空',
87 ]); 87 ]);
88 - $logic->translateSave();  
89 - $this->response('success'); 88 + $rs = $logic->translateSave();
  89 + $this->response('success',Code::SUCCESS,$rs);
90 } 90 }
91 91
92 /** 92 /**
@@ -251,7 +251,7 @@ class TranslateLogic extends BaseLogic @@ -251,7 +251,7 @@ class TranslateLogic extends BaseLogic
251 } 251 }
252 $this->param['data'] = $data; 252 $this->param['data'] = $data;
253 } 253 }
254 - try { 254 +// try {
255 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 255 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
256 if($info === false){ 256 if($info === false){
257 $param = [ 257 $param = [
@@ -262,21 +262,21 @@ class TranslateLogic extends BaseLogic @@ -262,21 +262,21 @@ class TranslateLogic extends BaseLogic
262 'alias'=>$this->param['alias'], 262 'alias'=>$this->param['alias'],
263 ]; 263 ];
264 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 264 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
265 - $this->model->add($param); 265 + $rs = $this->model->add($param);
266 }else{ 266 }else{
267 if(!empty($data)){ 267 if(!empty($data)){
268 $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 268 $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
269 - $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 269 + $rs = $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]);
270 } 270 }
271 } 271 }
272 //写日志 272 //写日志
273 $userLogModel = new UserLog(); 273 $userLogModel = new UserLog();
274 $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); 274 $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]);
275 - }catch (\Exception $e){  
276 - $this->fail('系统错误请联系管理员');  
277 - } 275 +// }catch (\Exception $e){
  276 +// $this->fail('系统错误请联系管理员');
  277 +// }
278 $this->handleRoute($this->param['url']); 278 $this->handleRoute($this->param['url']);
279 - return $this->success(); 279 + return $this->success($rs);
280 } 280 }
281 281
282 /** 282 /**