作者 赵彬吉
@@ -55,7 +55,7 @@ class UpdateRoute extends Command @@ -55,7 +55,7 @@ class UpdateRoute extends Command
55 */ 55 */
56 public function handle(){ 56 public function handle(){
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $list = $projectModel->list(['id'=>23]); 58 + $list = $projectModel->list(['id'=>764]);
59 $data = []; 59 $data = [];
60 foreach ($list as $v){ 60 foreach ($list as $v){
61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -217,10 +217,14 @@ class NewsLogic extends BaseLogic @@ -217,10 +217,14 @@ class NewsLogic extends BaseLogic
217 */ 217 */
218 public function getCategory($category){ 218 public function getCategory($category){
219 $str = ''; 219 $str = '';
220 - foreach ($category as $v){  
221 - $str .= $v.','; 220 + if(is_array($category) && $category){
  221 + $str = ','.implode(',',$category).',';
222 } 222 }
223 - return !empty(trim($str,',')) ? ','.$str.',' : ''; 223 + return $str;
  224 +// foreach ($category as $v){
  225 +// $str .= $v.',';
  226 +// }
  227 +// return !empty(trim($str,',')) ? ','.$str.',' : '';
224 } 228 }
225 229
226 /** 230 /**
@@ -247,12 +247,16 @@ class CategoryLogic extends BaseLogic @@ -247,12 +247,16 @@ class CategoryLogic extends BaseLogic
247 */ 247 */
248 public function getLastCategory($category){ 248 public function getLastCategory($category){
249 $str = ''; 249 $str = '';
250 - if(isset($category) && !empty($category)){  
251 - foreach ($category as $v){  
252 - $str .= $v.',';  
253 - } 250 + if(is_array($category) && $category){
  251 + $str = ','.implode(',',$category).',';
254 } 252 }
255 - return !empty(trim($str,',')) ? ','.$str.',' : ''; 253 + return $str;
  254 +// if(isset($category) && !empty($category)){
  255 +// foreach ($category as $v){
  256 +// $str .= $v.',';
  257 +// }
  258 +// }
  259 +// return !empty(trim($str,',')) ? ','.$str.',' : '';
256 } 260 }
257 261
258 /** 262 /**
@@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
10 namespace App\Http\Logic\Bside\Setting; 10 namespace App\Http\Logic\Bside\Setting;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Com\UpdateLog;
  14 +use App\Models\User\UserLog;
13 use App\Models\WebSetting\Translate as TranslateModel; 15 use App\Models\WebSetting\Translate as TranslateModel;
14 use App\Models\WebSetting\WebLanguage; 16 use App\Models\WebSetting\WebLanguage;
15 use App\Helper\Translate; 17 use App\Helper\Translate;
@@ -271,9 +273,10 @@ class TranslateLogic extends BaseLogic @@ -271,9 +273,10 @@ class TranslateLogic extends BaseLogic
271 } 273 }
272 } 274 }
273 } 275 }
  276 + $this->param['data'] = $data;
274 } 277 }
275 try { 278 try {
276 - $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 279 + $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
277 if($info === false){ 280 if($info === false){
278 $param = [ 281 $param = [
279 'type'=>$this->param['type'], 282 'type'=>$this->param['type'],
@@ -285,9 +288,14 @@ class TranslateLogic extends BaseLogic @@ -285,9 +288,14 @@ class TranslateLogic extends BaseLogic
285 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE); 288 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE);
286 $this->model->add($param); 289 $this->model->add($param);
287 }else{ 290 }else{
288 - $data = json_encode($data,JSON_UNESCAPED_UNICODE);  
289 - $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 291 + if(!empty($data)){
  292 + $data = json_encode($data,JSON_UNESCAPED_UNICODE);
  293 + $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']]);
  294 + }
290 } 295 }
  296 + //写日志
  297 + $userLogModel = new UserLog();
  298 + $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]);
291 }catch (\Exception $e){ 299 }catch (\Exception $e){
292 $this->fail('系统错误请联系管理员'); 300 $this->fail('系统错误请联系管理员');
293 } 301 }