作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2223
@@ -41,23 +41,27 @@ class lyhDemo extends Command @@ -41,23 +41,27 @@ class lyhDemo extends Command
41 protected $description = '更新路由'; 41 protected $description = '更新路由';
42 42
43 public function handle(){ 43 public function handle(){
44 - return $this->aggregate_keyword_affix();  
45 - //获取  
46 -// $keywordPrefixModel = new KeywordPrefix();  
47 -// $lists = $keywordPrefixModel->list(['project_id'=>0,'id'=>['<',29]]);  
48 -// $whiteModel = new ProjectWhiteHatAffix();  
49 -// foreach ($lists as $val) {  
50 -// echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL;  
51 -// $data = [  
52 -// 'project_id'=>0,  
53 -// 'name'=>$val['keyword'],  
54 -// 'type'=>$val['type'],  
55 -// ];  
56 -// $whiteModel->add($data);  
57 -// } 44 + self::initAggregateKeywordAffix();
58 return true; 45 return true;
59 } 46 }
60 47
  48 + public static function initAggregateKeywordAffix($project_id = 4298){
  49 + $time = date('Y-m-d H:i:s');
  50 + $prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose";
  51 + $suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory";
  52 + $info = DB::table('gl_aggregate_keyword_affix')->where('project_id',$project_id)->first();
  53 + if(empty($info)){
  54 + $data = [
  55 + 'project_id'=>$project_id,
  56 + 'prefix'=>$prefix,
  57 + 'suffix'=>$suffix,
  58 + 'created_at' => $time,
  59 + 'updated_at' => $time
  60 + ];
  61 + DB::table('gl_aggregate_keyword_affix')->insert($data);
  62 + }
  63 + return true;
  64 + }
61 /** 65 /**
62 * @remark :获取数据 66 * @remark :获取数据
63 * @name :aggregate_keyword_affix 67 * @name :aggregate_keyword_affix
@@ -295,8 +295,7 @@ class ProjectServer @@ -295,8 +295,7 @@ class ProjectServer
295 $time = date('Y-m-d H:i:s'); 295 $time = date('Y-m-d H:i:s');
296 $prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose"; 296 $prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose";
297 $suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory"; 297 $suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory";
298 - $aggregateKeywordAffixModel = new AggregateKeywordAffix();  
299 - $info = DB::connection('custom_mysql')->table('gl_aggregate_keyword_affix')->first(); 298 + $info = DB::table('gl_aggregate_keyword_affix')->where('project_id',$project_id)->first();
300 if(empty($info)){ 299 if(empty($info)){
301 $data = [ 300 $data = [
302 'project_id'=>$project_id, 301 'project_id'=>$project_id,
@@ -305,7 +304,7 @@ class ProjectServer @@ -305,7 +304,7 @@ class ProjectServer
305 'created_at' => $time, 304 'created_at' => $time,
306 'updated_at' => $time 305 'updated_at' => $time
307 ]; 306 ];
308 - DB::connection('custom_mysql')->table('gl_aggregate_keyword_affix')->insert($data); 307 + DB::table('gl_aggregate_keyword_affix')->insert($data);
309 } 308 }
310 return true; 309 return true;
311 } 310 }