作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -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'=>249]);
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;
@@ -430,7 +430,7 @@ class WebTrafficRussia extends Command @@ -430,7 +430,7 @@ class WebTrafficRussia extends Command
430 $data = []; 430 $data = [];
431 for ($i=0;$i<$num;$i++){ 431 for ($i=0;$i<$num;$i++){
432 //ip国家占比 432 //ip国家占比
433 - $ip_area = $this->get_rand($this->country_ratio); 433 + $ip_area = $this->get_rand($country_ratio);
434 $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first(); 434 $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first();
435 $res = (array)$res; 435 $res = (array)$res;
436 $res['diff'] = $time_zones[$res['ip_area']]; 436 $res['diff'] = $time_zones[$res['ip_area']];
@@ -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 }