|
@@ -10,6 +10,7 @@ namespace App\Console\Commands\Test; |
|
@@ -10,6 +10,7 @@ namespace App\Console\Commands\Test; |
|
10
|
|
10
|
|
|
11
|
use App\Models\Com\KeywordVideoTask;
|
11
|
use App\Models\Com\KeywordVideoTask;
|
|
12
|
use App\Models\Com\KeywordVideoTaskLog;
|
12
|
use App\Models\Com\KeywordVideoTaskLog;
|
|
|
|
13
|
+use App\Models\Devops\ServerConfig;
|
|
13
|
use App\Models\Devops\Servers;
|
14
|
use App\Models\Devops\Servers;
|
|
14
|
use App\Models\Devops\ServersIp;
|
15
|
use App\Models\Devops\ServersIp;
|
|
15
|
use App\Models\File\File;
|
16
|
use App\Models\File\File;
|
|
@@ -45,17 +46,51 @@ class Demo extends Command |
|
@@ -45,17 +46,51 @@ class Demo extends Command |
|
45
|
protected $description = 'demo';
|
46
|
protected $description = 'demo';
|
|
46
|
|
47
|
|
|
47
|
public function handle(){
|
48
|
public function handle(){
|
|
48
|
- $keywordVideoModel = new KeywordVideoTask();
|
|
|
|
49
|
- $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
|
|
|
|
50
|
- //查看是否有子记录
|
|
|
|
51
|
- foreach ($project_id_arr as $values){
|
|
|
|
52
|
- $logModel = new KeywordVideoTaskLog();
|
|
|
|
53
|
- $logInfo = $logModel->read(['project_id'=>$values]);
|
|
|
|
54
|
- if($logInfo === false){
|
|
|
|
55
|
- echo date('Y-m-d H:i:s') . '开启的项目project_id:'.$values . PHP_EOL;
|
|
|
|
56
|
- $keywordVideoModel->edit(['status'=>0],['project_id'=>$values]);
|
|
|
|
57
|
- }
|
49
|
+ $serverConfigModel = new ServerConfig();
|
|
|
|
50
|
+ $lists = $serverConfigModel->list(['type'=>1]);
|
|
|
|
51
|
+ foreach ($lists as $v){
|
|
|
|
52
|
+ echo date('Y-m-d H:i:s') . 'title数据:'.$v['title'] . PHP_EOL;
|
|
|
|
53
|
+ $param = [
|
|
|
|
54
|
+ 'server_name'=>$v['title'],
|
|
|
|
55
|
+ 'being_number'=>$v['count'],
|
|
|
|
56
|
+ 'ip_total'=>1,
|
|
|
|
57
|
+ 'account'=>$v['user'],
|
|
|
|
58
|
+ 'password'=>$v['password'],
|
|
|
|
59
|
+ 'port'=>$v['port'],
|
|
|
|
60
|
+ 'bt_account'=>$v['bt_account'],
|
|
|
|
61
|
+ 'bt_password'=>$v['bt_password'],
|
|
|
|
62
|
+ 'service_type'=>$v['service_type'],
|
|
|
|
63
|
+ 'domain'=>'globalso.com',
|
|
|
|
64
|
+ ];
|
|
|
|
65
|
+ $serverModel = new Servers();
|
|
|
|
66
|
+ $server_id = $serverModel->addReturnId($param);
|
|
|
|
67
|
+ echo date('Y-m-d H:i:s') . 'server_id:'.$server_id . PHP_EOL;
|
|
|
|
68
|
+ $paramsIp = [
|
|
|
|
69
|
+ 'id'=>$v['id'],
|
|
|
|
70
|
+ 'ip'=>$v['host'],
|
|
|
|
71
|
+ 'servers_id'=>$server_id,
|
|
|
|
72
|
+ 'domain'=>$v['init_domain'],
|
|
|
|
73
|
+ 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
74
|
+ 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
|
75
|
+ ];
|
|
|
|
76
|
+ $serverIpModel = new ServersIp();
|
|
|
|
77
|
+ $serverIpModel->insert($paramsIp);
|
|
58
|
}
|
78
|
}
|
|
|
|
79
|
+ return true;
|
|
|
|
80
|
+ }
|
|
|
|
81
|
+
|
|
|
|
82
|
+// public function handle(){
|
|
|
|
83
|
+// $keywordVideoModel = new KeywordVideoTask();
|
|
|
|
84
|
+// $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
|
|
|
|
85
|
+// //查看是否有子记录
|
|
|
|
86
|
+// foreach ($project_id_arr as $values){
|
|
|
|
87
|
+// $logModel = new KeywordVideoTaskLog();
|
|
|
|
88
|
+// $logInfo = $logModel->read(['project_id'=>$values]);
|
|
|
|
89
|
+// if($logInfo === false){
|
|
|
|
90
|
+// echo date('Y-m-d H:i:s') . '开启的项目project_id:'.$values . PHP_EOL;
|
|
|
|
91
|
+// $keywordVideoModel->edit(['status'=>0],['project_id'=>$values]);
|
|
|
|
92
|
+// }
|
|
|
|
93
|
+// }
|
|
59
|
// $projectModel = new Project();
|
94
|
// $projectModel = new Project();
|
|
60
|
// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
|
95
|
// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
|
|
61
|
// $data = [];
|
96
|
// $data = [];
|
|
@@ -65,30 +100,30 @@ class Demo extends Command |
|
@@ -65,30 +100,30 @@ class Demo extends Command |
|
65
|
// $this->getProductList();
|
100
|
// $this->getProductList();
|
|
66
|
// DB::disconnect('custom_mysql');
|
101
|
// DB::disconnect('custom_mysql');
|
|
67
|
// }
|
102
|
// }
|
|
68
|
- echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
69
|
- }
|
103
|
+// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
104
|
+// }
|
|
70
|
|
105
|
|
|
71
|
- public function getProductList(){
|
|
|
|
72
|
- $productModel = new Product();
|
|
|
|
73
|
- $product_all_id = $productModel::whereRaw('LENGTH(keyword_id) > 50')->pluck('id')->toArray();
|
|
|
|
74
|
- if(empty($product_all_id)){
|
|
|
|
75
|
- return true;
|
|
|
|
76
|
- }
|
|
|
|
77
|
- $lists = $productModel->whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get()->toArray();
|
|
|
|
78
|
- foreach ($lists as $k => $v){
|
|
|
|
79
|
- echo date('Y-m-d H:i:s') . '项目id:'.$v['project_id'].'+产品product_id:'.$v['id'] . PHP_EOL;
|
|
|
|
80
|
- $str = ',';
|
|
|
|
81
|
- shuffle($v['keyword_id']);
|
|
|
|
82
|
- foreach ($v['keyword_id'] as $key => $value){
|
|
|
|
83
|
- if($key == 6){
|
|
|
|
84
|
- break;
|
|
|
|
85
|
- }
|
|
|
|
86
|
- $str .= $value.',';
|
|
|
|
87
|
- }
|
|
|
|
88
|
- $productModel->edit(['keyword_id'=>$str],['id'=>$v['id']]);
|
|
|
|
89
|
- }
|
|
|
|
90
|
- return true;
|
|
|
|
91
|
- }
|
106
|
+// public function getProductList(){
|
|
|
|
107
|
+// $productModel = new Product();
|
|
|
|
108
|
+// $product_all_id = $productModel::whereRaw('LENGTH(keyword_id) > 50')->pluck('id')->toArray();
|
|
|
|
109
|
+// if(empty($product_all_id)){
|
|
|
|
110
|
+// return true;
|
|
|
|
111
|
+// }
|
|
|
|
112
|
+// $lists = $productModel->whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get()->toArray();
|
|
|
|
113
|
+// foreach ($lists as $k => $v){
|
|
|
|
114
|
+// echo date('Y-m-d H:i:s') . '项目id:'.$v['project_id'].'+产品product_id:'.$v['id'] . PHP_EOL;
|
|
|
|
115
|
+// $str = ',';
|
|
|
|
116
|
+// shuffle($v['keyword_id']);
|
|
|
|
117
|
+// foreach ($v['keyword_id'] as $key => $value){
|
|
|
|
118
|
+// if($key == 6){
|
|
|
|
119
|
+// break;
|
|
|
|
120
|
+// }
|
|
|
|
121
|
+// $str .= $value.',';
|
|
|
|
122
|
+// }
|
|
|
|
123
|
+// $productModel->edit(['keyword_id'=>$str],['id'=>$v['id']]);
|
|
|
|
124
|
+// }
|
|
|
|
125
|
+// return true;
|
|
|
|
126
|
+// }
|
|
92
|
//
|
127
|
//
|
|
93
|
// /**
|
128
|
// /**
|
|
94
|
// * @remark :关键字有视频的改为1
|
129
|
// * @remark :关键字有视频的改为1
|