作者 赵彬吉
正在显示 31 个修改的文件 包含 441 行增加387 行删除
@@ -80,6 +80,7 @@ class VideoTask extends Command @@ -80,6 +80,7 @@ class VideoTask extends Command
80 if (empty($task_project)){ 80 if (empty($task_project)){
81 break; 81 break;
82 } 82 }
  83 + echo '开始,项目id:'.$task_project->project_id.PHP_EOL;
83 $domainModel = new DomainInfo(); 84 $domainModel = new DomainInfo();
84 $domainInfo = $domainModel->read(['project_id'=>$task_project->project_id]); 85 $domainInfo = $domainModel->read(['project_id'=>$task_project->project_id]);
85 if($domainInfo === false){ 86 if($domainInfo === false){
@@ -89,9 +90,9 @@ class VideoTask extends Command @@ -89,9 +90,9 @@ class VideoTask extends Command
89 } 90 }
90 ProjectServer::useProject($task_project->project_id); 91 ProjectServer::useProject($task_project->project_id);
91 if(!empty($task_project->keywords)){ 92 if(!empty($task_project->keywords)){
92 - $task_project->keywords = explode(',',trim(',',$task_project->keywords)); 93 + $keywords = explode(',',trim(',',$task_project->keywords));
93 } 94 }
94 - $keyword = $this->getProjectKeyword($task_project->number,$task_project->keywords); 95 + $keyword = $this->getProjectKeyword($task_project->number,$keywords ?? []);
95 // 已经没有需要生成视频的关键词 96 // 已经没有需要生成视频的关键词
96 if (!$keyword) { 97 if (!$keyword) {
97 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 98 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
@@ -176,24 +177,15 @@ class VideoTask extends Command @@ -176,24 +177,15 @@ class VideoTask extends Command
176 */ 177 */
177 public function getProjectKeyword($number,$keywords = []) 178 public function getProjectKeyword($number,$keywords = [])
178 { 179 {
179 - if(!empty($keywords)){  
180 - $keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)  
181 - ->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray();  
182 - if(count($keyword_id) == 0){  
183 - $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')  
184 - ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();  
185 - }else{  
186 - $keyword_arr_id = Keyword::where('video', null)->whereNotIn("title", $keywords)->where('route', 'not like', '%-tag')  
187 - ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number - count($keyword_id))->pluck('id')->toArray();  
188 - $keyword_arr_id = array_merge($keyword_id,$keyword_arr_id);  
189 - }  
190 - }else{ 180 +
  181 + $keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)
  182 + ->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->limit($number)->pluck('id')->toArray();
  183 + $need = $number - count($keyword_id);
  184 + if ($need > 0) {
191 $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag') 185 $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
192 - ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();  
193 - }  
194 - if(count($keyword_arr_id) == 0){  
195 - return []; 186 + ->whereNotNull('keyword_content')->whereNotIn('id', $keyword_id)->orderBy('id','asc')->limit($need)->pluck('id')->toArray();
196 } 187 }
  188 + $keyword_arr_id = array_merge($keyword_id, $keyword_arr_id);
197 $keyword = Keyword::whereIn("id", $keyword_arr_id)->get(); 189 $keyword = Keyword::whereIn("id", $keyword_arr_id)->get();
198 return $keyword; 190 return $keyword;
199 } 191 }
@@ -235,7 +227,7 @@ class VideoTask extends Command @@ -235,7 +227,7 @@ class VideoTask extends Command
235 } 227 }
236 } 228 }
237 //TODO::所有产品 229 //TODO::所有产品
238 - $thumb = $this->getRecommendAndHotProducts($keywordInfo['route'],$project_id); 230 + $thumb = $this->getRecommendAndHotProducts($keyword_id);
239 $keyword_arr = Keyword::where("project_id",$project_id)->where("status",1)->inRandomOrder()->take(10)->pluck('title')->toArray(); 231 $keyword_arr = Keyword::where("project_id",$project_id)->where("status",1)->inRandomOrder()->take(10)->pluck('title')->toArray();
240 $data = [ 232 $data = [
241 'url'=> 'https://' . $domain.'/'.$keywordInfo['route'], 233 'url'=> 'https://' . $domain.'/'.$keywordInfo['route'],
@@ -251,38 +243,24 @@ class VideoTask extends Command @@ -251,38 +243,24 @@ class VideoTask extends Command
251 /** 243 /**
252 * 关键词聚合页-推荐&热门产品 244 * 关键词聚合页-推荐&热门产品
253 */ 245 */
254 - public function getRecommendAndHotProducts($route,$project_id): ?array 246 + public function getRecommendAndHotProducts($keyword_id): ?array
255 { 247 {
256 $productIds = []; 248 $productIds = [];
257 - $productKeyword = Keyword::where("project_id",$project_id)->where("route",$route)->first();  
258 - if (!empty($productKeyword)){  
259 - $productsQuery = Product::where("project_id", $project_id)->where("status",1)->where("keyword_id","like","%,".$productKeyword->id.",%")->limit(7)->get();  
260 - if (!empty($productsQuery)){  
261 - foreach ($productsQuery as $item){  
262 - $productIds[] = $item->id;  
263 - }  
264 - if (count($productIds)<7){  
265 - $product_all_id = Product::where("project_id", $project_id)->where('thumb','!=',null)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();  
266 - $number = 40;  
267 - $array_count = count($product_all_id);  
268 - if ($array_count > 0) {  
269 - $product_id = array_rand($product_all_id, min($array_count, $number - count($productIds)));  
270 - $randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();  
271 - $products = $productsQuery->merge($randomData);  
272 - }  
273 - }else{  
274 - $products = $productsQuery;  
275 - } 249 + $productsQuery = Product::where("status",1)->where("keyword_id","like","%,".$keyword_id.",%")->limit(13)->get();
  250 + if (count($productsQuery) > 0){
  251 + foreach ($productsQuery as $item){
  252 + $productIds[] = $item->id;
  253 + }
  254 + if (count($productIds) < 13){
  255 + $product_all_id = Product::where('thumb','!=',null)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20 - count($productIds))->pluck('id')->toArray();
  256 + $randomData = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get();
  257 + $products = $productsQuery->merge($randomData);
276 }else{ 258 }else{
277 - $product_all_id = Product::where("project_id", $project_id)->where('thumb','!=',null)->where("status",Product::STATUS_ON)->pluck('id')->toArray();  
278 - $number = 40;  
279 - $array_count = count($product_all_id);  
280 - if ($array_count > 0)  
281 - {  
282 - $product_id = array_rand($product_all_id, min($array_count, $number-count($productIds)));  
283 - $products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();  
284 - } 259 + $products = $productsQuery;
285 } 260 }
  261 + }else{
  262 + $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray();
  263 + $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get();
286 } 264 }
287 $data = []; 265 $data = [];
288 if (!empty($products)){ 266 if (!empty($products)){
@@ -293,12 +271,13 @@ class VideoTask extends Command @@ -293,12 +271,13 @@ class VideoTask extends Command
293 if(count($data) > 13){ 271 if(count($data) > 13){
294 break; 272 break;
295 } 273 }
296 - $keyword_id = implode(',',$item->keyword_id);  
297 - if (strpos(','.$keyword_id.',', ','.$productKeyword->id.',') === false) { 274 + $keyword_ids = implode(',',$item->keyword_id);
  275 + if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) {
298 //不包含 276 //不包含
299 $productModel = new Product(); 277 $productModel = new Product();
300 - $keyword_id = ','.$keyword_id.',' . $productKeyword->id.',';  
301 - $productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]); 278 + $keyword_ids = !empty($keyword_ids) ? ','.$keyword_ids.',' : ',' ;
  279 + $keyword_id_str = $keyword_ids . $keyword_id.',';
  280 + $productModel->edit(['keyword_id'=>$keyword_id_str],['id'=>$item->id]);
302 } 281 }
303 $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; 282 $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
304 } 283 }
@@ -119,18 +119,21 @@ class RecommendedSuppliers extends Command @@ -119,18 +119,21 @@ class RecommendedSuppliers extends Command
119 * @time :2024/5/29 16:38 119 * @time :2024/5/29 16:38
120 */ 120 */
121 public function savePurchaserInfo($project_id,$keyword,$data){ 121 public function savePurchaserInfo($project_id,$keyword,$data){
122 - $param = []; 122 + $purchaserInfoModel = new PurchaserInfo();
123 foreach ($data as $k =>$v){ 123 foreach ($data as $k =>$v){
124 $v['project_id'] = $project_id; 124 $v['project_id'] = $project_id;
125 $v['keyword'] = $keyword; 125 $v['keyword'] = $keyword;
126 $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 126 $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
127 $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 127 $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
128 $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 128 $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
129 - $v['created_at'] = date('Y-m-d H:i:s');  
130 - $v['updated_at'] = $v['created_at'];  
131 - $param[] = $v; 129 +// $v['created_at'] = date('Y-m-d H:i:s');
  130 +// $v['updated_at'] = $v['created_at'];
  131 + $param = $v;
  132 + $info = $purchaserInfoModel->read(['keyword'=>$keyword,'buyer'=>$v['buyer'],'project_id'=>$project_id],['id']);
  133 + if($info === false){
  134 + $purchaserInfoModel->add($param);
  135 + }
132 } 136 }
133 - $purchaserInfoModel = new PurchaserInfo();  
134 - return $purchaserInfoModel->insert($param); 137 + return true;
135 } 138 }
136 } 139 }
@@ -9,16 +9,23 @@ namespace App\Console\Commands\Test; @@ -9,16 +9,23 @@ namespace App\Console\Commands\Test;
9 9
10 10
11 use App\Models\Com\KeywordVideoTask; 11 use App\Models\Com\KeywordVideoTask;
  12 +use App\Models\Com\KeywordVideoTaskLog;
  13 +use App\Models\Devops\ServerConfig;
  14 +use App\Models\Devops\Servers;
  15 +use App\Models\Devops\ServersIp;
12 use App\Models\File\File; 16 use App\Models\File\File;
13 use App\Models\File\File as FileModel; 17 use App\Models\File\File as FileModel;
14 use App\Models\File\Image; 18 use App\Models\File\Image;
15 use App\Models\File\Image as ImageModel; 19 use App\Models\File\Image as ImageModel;
16 use App\Models\Product\Keyword; 20 use App\Models\Product\Keyword;
  21 +use App\Models\Product\Product;
17 use App\Models\Project\DeployOptimize; 22 use App\Models\Project\DeployOptimize;
18 use App\Models\Project\MinorLanguages; 23 use App\Models\Project\MinorLanguages;
19 use App\Models\Project\Project; 24 use App\Models\Project\Project;
  25 +use App\Models\Purchaser\PurchaserInfo;
20 use App\Services\AmazonS3Service; 26 use App\Services\AmazonS3Service;
21 use App\Services\ProjectServer; 27 use App\Services\ProjectServer;
  28 +use App\Utils\EncryptUtils;
22 use Illuminate\Console\Command; 29 use Illuminate\Console\Command;
23 use Illuminate\Support\Facades\DB; 30 use Illuminate\Support\Facades\DB;
24 use Illuminate\Support\Facades\Schema; 31 use Illuminate\Support\Facades\Schema;
@@ -40,54 +47,64 @@ class Demo extends Command @@ -40,54 +47,64 @@ class Demo extends Command
40 */ 47 */
41 protected $description = 'demo'; 48 protected $description = 'demo';
42 49
43 -  
44 -// /**  
45 -// * Execute the job.  
46 -// *  
47 -// * @return void  
48 -// */  
49 -// public function handle()  
50 -// {  
51 -// $this->param['project_id'] = 181;  
52 -// $imageModel = new ImageModel();  
53 -// //获取当前项目的所有图片  
54 -// $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);  
55 -// if(!empty($imageList)){  
56 -// $amazonS3Service = new AmazonS3Service();  
57 -// foreach ($imageList as $k => $v){  
58 -// $amazonS3Service->syncImageFiles(getImageUrl($v['path']));  
59 -// $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
60 -// }  
61 -// }  
62 -//  
63 -// $fileModel = new FileModel();  
64 -// $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);  
65 -// if(!empty($fileList)){  
66 -// $amazonS3Service = new AmazonS3Service();  
67 -// foreach ($fileList as $k => $v){  
68 -// echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;  
69 -// $amazonS3Service->syncImageFiles(getFileUrl($v['path']));  
70 -// $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
71 -// gc_collect_cycles();  
72 -// }  
73 -// }  
74 -// return true;  
75 -// } 50 + public function handle(){
  51 + $p = new PurchaserInfo();
  52 + $lists = $p->list();
  53 + foreach ($lists as $k => $v){
  54 + $info = $p->read(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer']]);
  55 + if($info === false){
  56 + continue;
  57 + }
  58 + $p->del(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer'],'id'=>['!=',$v['id']]]);
  59 + }
  60 + return true;
  61 + }
76 62
77 // public function handle(){ 63 // public function handle(){
78 // $keywordVideoModel = new KeywordVideoTask(); 64 // $keywordVideoModel = new KeywordVideoTask();
79 // $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray(); 65 // $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
  66 +// //查看是否有子记录
  67 +// foreach ($project_id_arr as $values){
  68 +// $logModel = new KeywordVideoTaskLog();
  69 +// $logInfo = $logModel->read(['project_id'=>$values]);
  70 +// if($logInfo === false){
  71 +// echo date('Y-m-d H:i:s') . '开启的项目project_id:'.$values . PHP_EOL;
  72 +// $keywordVideoModel->edit(['status'=>0],['project_id'=>$values]);
  73 +// }
  74 +// }
80 // $projectModel = new Project(); 75 // $projectModel = new Project();
81 // $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]); 76 // $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
82 // $data = []; 77 // $data = [];
83 // foreach ($list as $v){ 78 // foreach ($list as $v){
84 // echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 79 // echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
85 // ProjectServer::useProject($v['id']); 80 // ProjectServer::useProject($v['id']);
86 -// $this->saveKeyword(); 81 +// $this->getProductList();
87 // DB::disconnect('custom_mysql'); 82 // DB::disconnect('custom_mysql');
88 // } 83 // }
89 // echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 84 // echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
90 // } 85 // }
  86 +
  87 +// public function getProductList(){
  88 +// $productModel = new Product();
  89 +// $product_all_id = $productModel::whereRaw('LENGTH(keyword_id) > 50')->pluck('id')->toArray();
  90 +// if(empty($product_all_id)){
  91 +// return true;
  92 +// }
  93 +// $lists = $productModel->whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get()->toArray();
  94 +// foreach ($lists as $k => $v){
  95 +// echo date('Y-m-d H:i:s') . '项目id:'.$v['project_id'].'+产品product_id:'.$v['id'] . PHP_EOL;
  96 +// $str = ',';
  97 +// shuffle($v['keyword_id']);
  98 +// foreach ($v['keyword_id'] as $key => $value){
  99 +// if($key == 6){
  100 +// break;
  101 +// }
  102 +// $str .= $value.',';
  103 +// }
  104 +// $productModel->edit(['keyword_id'=>$str],['id'=>$v['id']]);
  105 +// }
  106 +// return true;
  107 +// }
91 // 108 //
92 // /** 109 // /**
93 // * @remark :关键字有视频的改为1 110 // * @remark :关键字有视频的改为1
@@ -53,109 +53,6 @@ class Temp extends Command @@ -53,109 +53,6 @@ class Temp extends Command
53 $this->output('end'); 53 $this->output('end');
54 } 54 }
55 55
56 -// public function handle()  
57 -// {  
58 -// $domain_model = new DomainInfo();  
59 -// $notify_model = new Notify();  
60 -// $project_model = new Project();  
61 -//  
62 -// $domain_list = $domain_model->list(['amp_status' => 1]);  
63 -// foreach ($domain_list as $info) {  
64 -// if ($info['project_id'] > 0) {  
65 -// $notify_info = $notify_model->read(['project_id' => $info['project_id'], 'type' => 3]);  
66 -// if (!$notify_info) {  
67 -//  
68 -// $domain_array = parse_url($info['domain']);  
69 -// $host = $domain_array['host'] ?? $domain_array['path'];  
70 -// $host_array = explode('.', $host);  
71 -// if (count($host_array) <= 2) {  
72 -// array_unshift($host_array, 'm');  
73 -// } else {  
74 -// $host_array[0] = 'm';  
75 -// }  
76 -// $amp_domain = implode('.', $host_array);  
77 -//  
78 -// $project_info = $project_model->read(['id' => $info['project_id']]);  
79 -//  
80 -// $notify_model->add([  
81 -// 'project_id' => $info['project_id'],  
82 -// 'type' => 3,  
83 -// 'data' => json_encode(['domain' => $amp_domain, 'url' => [], 'language' => []]),  
84 -// 'server_id' => $project_info['serve_id'],  
85 -// ]);  
86 -// }  
87 -// }  
88 -// }  
89 -// }  
90 -  
91 -// public function handle()  
92 -// {  
93 -// $domain_model = new DomainInfo();  
94 -// $server_model = new ServerConfig();  
95 -// $project_model = new Project();  
96 -//  
97 -// $domain_list = $domain_model->list(['domain' => ['like', 'www.%']], 'id', ['id', 'domain', 'project_id'], 'asc');  
98 -// foreach ($domain_list as $info) {  
99 -// $this->output('domain:' . $info['domain'] . ',开始');  
100 -//  
101 -// $project_info = $project_model->read(['id' => $info['project_id']], 'serve_id');  
102 -// if ($project_info === false) {  
103 -// $this->output('获取项目数据失败');  
104 -// continue;  
105 -// }  
106 -//  
107 -// $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
108 -// if ($server_info === false) {  
109 -// $this->output('获取服务器数据失败');  
110 -// continue;  
111 -// }  
112 -//  
113 -// $domain_array = parse_url($info['domain']);  
114 -// $host = $domain_array['host'] ?? $domain_array['path'];  
115 -// $host_array = explode('.', $host);  
116 -// if (count($host_array) <= 2) {  
117 -// array_unshift($host_array, 'm');  
118 -// } else {  
119 -// $host_array[0] = 'm';  
120 -// }  
121 -// $amp_domain = implode('.', $host_array);  
122 -// if (!$this->check_cname($amp_domain, $server_info)) {  
123 -// $this->output('AMP站点域名' . $amp_domain . '未解析至目标服务器');  
124 -// continue;  
125 -// }  
126 -//  
127 -// $api_url = 'http://' . $server_info['init_domain'] . '/api/createSiteAmp';  
128 -// $api_param = [  
129 -// 'domain' => $info['domain'],  
130 -// 'private_key' => '',  
131 -// 'cert' => ''  
132 -// ];  
133 -//  
134 -// try {  
135 -// $rs = HttpUtils::get($api_url, $api_param);  
136 -// $rs = json_decode($rs, true);  
137 -// if (isset($rs['status']) && $rs['status'] == 200) {  
138 -// $this->output('创建AMP站点成功');  
139 -// } else {  
140 -// $this->output($rs['message'] ?? '');  
141 -// continue;  
142 -// }  
143 -// } catch (\Exception | GuzzleException $e) {  
144 -// errorLog('创建AMP站点', $api_param, $e);  
145 -// $this->output('创建AMP站点失败');  
146 -// continue;  
147 -// }  
148 -//  
149 -// $data = [  
150 -// 'amp_status' => 1,  
151 -// 'amp_type' => 1,  
152 -// ];  
153 -// $domain_model->edit($data, ['id' => $info['id']]);  
154 -// }  
155 -//  
156 -// echo '成功' . PHP_EOL;  
157 -// }  
158 -  
159 public function check_cname($domain, $server_info) 56 public function check_cname($domain, $server_info)
160 { 57 {
161 $checkA = false; 58 $checkA = false;
@@ -166,7 +63,7 @@ class Temp extends Command @@ -166,7 +63,7 @@ class Temp extends Command
166 $output = explode(PHP_EOL, $process->getOutput()); 63 $output = explode(PHP_EOL, $process->getOutput());
167 foreach ($output as $line) { 64 foreach ($output as $line) {
168 if ($line) { 65 if ($line) {
169 - $checkA = strpos($line, $server_info['host']) !== false; 66 + $checkA = strpos($line, $server_info['ip']) !== false;
170 if ($checkA) { 67 if ($checkA) {
171 return $domain; 68 return $domain;
172 } 69 }
@@ -179,7 +76,7 @@ class Temp extends Command @@ -179,7 +76,7 @@ class Temp extends Command
179 $output = explode(PHP_EOL, $process->getOutput()); 76 $output = explode(PHP_EOL, $process->getOutput());
180 foreach ($output as $line) { 77 foreach ($output as $line) {
181 if ($line) { 78 if ($line) {
182 - $checkCname = (strpos($line, $server_info['init_domain']) !== false); 79 + $checkCname = (strpos($line, $server_info['domain']) !== false);
183 if ($checkCname) { 80 if ($checkCname) {
184 return $domain; 81 return $domain;
185 } 82 }
@@ -874,3 +874,37 @@ function textareaToArr($content, $separator = ','){ @@ -874,3 +874,37 @@ function textareaToArr($content, $separator = ','){
874 return trim($v); 874 return trim($v);
875 },explode($separator, $content))))); 875 },explode($separator, $content)))));
876 } 876 }
  877 +
  878 +/**
  879 + * @remark :字符串
  880 + * @name :base62_encode
  881 + * @author :lyh
  882 + * @method :post
  883 + * @time :2024/6/26 10:46
  884 + */
  885 +function ip_to_unique_string($ip) {
  886 + // 将IP地址转换为数值表示
  887 + $ip_number = ip2long($ip);
  888 + // 使用哈希函数生成唯一数值
  889 + $hash = hash('sha256', $ip_number, false);
  890 + $hash_number = hexdec(substr($hash, 0, 15)); // 取前15位作为大整数
  891 + // 将哈希值转换为Base62编码
  892 + $unique_string = base62_encode($hash_number);
  893 + // 确保唯一字符串为6位,如果不足则补齐,超出则截取前6位
  894 + $unique_string = str_pad($unique_string, 6, '0', STR_PAD_LEFT);
  895 + $unique_string = substr($unique_string, 0, 6);
  896 + return strtolower($unique_string);
  897 +}
  898 +
  899 +function base62_encode($num) {
  900 + $characters = '23456789abcdefghijkmnpqrstuvwxyz';
  901 + $base = strlen($characters);
  902 + $result = '';
  903 + while ($num > 0) {
  904 + $result = $characters[$num % $base] . $result;
  905 + $num = intval($num / $base);
  906 + }
  907 + return $result;
  908 +}
  909 +
  910 +
@@ -79,17 +79,19 @@ class ServersController extends BaseController @@ -79,17 +79,19 @@ class ServersController extends BaseController
79 $this->request->validate([ 79 $this->request->validate([
80 'server_name'=>'required', 80 'server_name'=>'required',
81 'service_type'=>'required', 81 'service_type'=>'required',
82 - 'total'=>'required',  
83 'account'=>'required', 82 'account'=>'required',
84 'password'=>'required', 83 'password'=>'required',
85 - 'port'=>'required' 84 + 'port'=>'required',
  85 + 'ip_total'=>'required',
  86 + 'domain'=>'required'
86 ],[ 87 ],[
87 'server_name.required' => '服务器名称server_name不能为空', 88 'server_name.required' => '服务器名称server_name不能为空',
88 'service_type.required' => '服务器类型不能为空', 89 'service_type.required' => '服务器类型不能为空',
89 - 'total.required' => '总数不能为空',  
90 'account.required' => '账号不能为空', 90 'account.required' => '账号不能为空',
91 'password.required' => '密码不能为空', 91 'password.required' => '密码不能为空',
92 - 'port.required' => '端口不能为空' 92 + 'port.required' => '端口不能为空',
  93 + 'ip_total.required' => 'ip使用數量不能为空',
  94 + 'domain.required' => '初始域名不能为空',
93 ]); 95 ]);
94 $data = $serversLogic->saveServers(); 96 $data = $serversLogic->saveServers();
95 $this->response('success',Code::SUCCESS,$data); 97 $this->response('success',Code::SUCCESS,$data);
@@ -12,7 +12,9 @@ namespace App\Http\Controllers\Aside\Devops; @@ -12,7 +12,9 @@ namespace App\Http\Controllers\Aside\Devops;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
14 use App\Http\Logic\Aside\Devops\ServersIpLogic; 14 use App\Http\Logic\Aside\Devops\ServersIpLogic;
  15 +use App\Models\Devops\Servers;
15 use App\Models\Devops\ServersIp as ServersIpModel; 16 use App\Models\Devops\ServersIp as ServersIpModel;
  17 +use App\Models\Project\Project;
16 18
17 class ServersIpController extends BaseController 19 class ServersIpController extends BaseController
18 { 20 {
@@ -30,8 +32,21 @@ class ServersIpController extends BaseController @@ -30,8 +32,21 @@ class ServersIpController extends BaseController
30 ],[ 32 ],[
31 'servers_id.required' => '服务器servers_id不能为空' 33 'servers_id.required' => '服务器servers_id不能为空'
32 ]); 34 ]);
  35 + $serverModel = new Servers();
  36 + $info = $serverModel->read(['id'=>$this->param['servers_id']]);
  37 + if($info === false){
  38 + $this->response('當前服務器不存在',Code::SERVER_ERROR);
  39 + }
33 $serversIpModel = new ServersIpModel(); 40 $serversIpModel = new ServersIpModel();
  41 + $this->map['status'] = 0;
34 $data = $serversIpModel->list($this->map); 42 $data = $serversIpModel->list($this->map);
  43 + foreach ($data as $k => $v){
  44 + $v['is_optional'] = 0;//是否可选择
  45 + if($v['total'] >= $info['ip_total']){
  46 + $v['is_optional'] = 1;//不可选择
  47 + }
  48 + $data[$k] = $v;
  49 + }
35 $this->response('success',Code::SUCCESS,$data); 50 $this->response('success',Code::SUCCESS,$data);
36 } 51 }
37 52
@@ -49,7 +64,15 @@ class ServersIpController extends BaseController @@ -49,7 +64,15 @@ class ServersIpController extends BaseController
49 'servers_id.required' => '服务器servers_id不能为空' 64 'servers_id.required' => '服务器servers_id不能为空'
50 ]); 65 ]);
51 $serversIpModel = new ServersIpModel(); 66 $serversIpModel = new ServersIpModel();
  67 + $this->map['status'] = 0;
52 $data = $serversIpModel->lists($this->map,$this->page,$this->row,$this->order); 68 $data = $serversIpModel->lists($this->map,$this->page,$this->row,$this->order);
  69 + if(!empty($data) && !empty($data['list'])){
  70 + $projectModel = new Project();
  71 + foreach ($data['list'] as $k => $v){
  72 + $v['project_title'] = $projectModel->formatQuery(['serve_id'=>$v['id']])->pluck('title')->toArray();
  73 + $data['list'][$k] = $v;
  74 + }
  75 + }
53 $this->response('success',Code::SUCCESS,$data); 76 $this->response('success',Code::SUCCESS,$data);
54 } 77 }
55 78
@@ -60,14 +83,13 @@ class ServersIpController extends BaseController @@ -60,14 +83,13 @@ class ServersIpController extends BaseController
60 * @method :post 83 * @method :post
61 * @time :2024/6/25 14:52 84 * @time :2024/6/25 14:52
62 */ 85 */
63 - public function info(){ 86 + public function info(ServersIpLogic $serversIpLogic){
64 $this->request->validate([ 87 $this->request->validate([
65 'id'=>'required' 88 'id'=>'required'
66 ],[ 89 ],[
67 'id.required' => 'id不能为空' 90 'id.required' => 'id不能为空'
68 ]); 91 ]);
69 - $serversIpModel = new ServersIpModel();  
70 - $data = $serversIpModel->read(['id'=>$this->param['id']]); 92 + $data = $serversIpLogic->infoServersIp();
71 $this->response('success',Code::SUCCESS,$data); 93 $this->response('success',Code::SUCCESS,$data);
72 } 94 }
73 95
@@ -101,13 +123,56 @@ class ServersIpController extends BaseController @@ -101,13 +123,56 @@ class ServersIpController extends BaseController
101 */ 123 */
102 public function batchSave(ServersIpLogic $serversIpLogic){ 124 public function batchSave(ServersIpLogic $serversIpLogic){
103 $this->request->validate([ 125 $this->request->validate([
104 - 'data'=>'required', 126 + 'ip'=>'required|array',
105 'servers_id'=>'required', 127 'servers_id'=>'required',
106 ],[ 128 ],[
107 - 'data.required' => 'data集合不能为空', 129 + 'ip.required' => 'ip集合不能为空',
108 'servers_id.required' => '服务器servers_id不能为空', 130 'servers_id.required' => '服务器servers_id不能为空',
109 ]); 131 ]);
110 $data = $serversIpLogic->batchSaveServersIp(); 132 $data = $serversIpLogic->batchSaveServersIp();
111 $this->response('success',Code::SUCCESS,$data); 133 $this->response('success',Code::SUCCESS,$data);
112 } 134 }
  135 +
  136 + /**
  137 + * @remark :批量删除数据
  138 + * @name :batchDel
  139 + * @author :lyh
  140 + * @method :post
  141 + * @time :2024/6/27 13:52
  142 + */
  143 + public function batchDel(ServersIpLogic $serversIpLogic){
  144 + $this->request->validate([
  145 + 'ids'=>'required|array',
  146 + ],[
  147 + 'ids.required' => 'ip集合不能为空',
  148 + ]);
  149 + $serversIpLogic->batchDelServersIp();
  150 + $this->response('success');
  151 + }
  152 +
  153 + /**
  154 + * @remark :导出文件获取数据
  155 + * @name :downloadFile
  156 + * @author :lyh
  157 + * @method :post
  158 + * @time :2024/6/28 10:26
  159 + */
  160 + public function downloadFile(){
  161 + $this->request->validate([
  162 + 'servers_id'=>'required',
  163 + ],[
  164 + 'servers_id.required' => '服务器servers_id不能为空',
  165 + ]);
  166 + $serverModel = new Servers();
  167 + $info = $serverModel->read(['id'=>$this->map['servers_id']]);
  168 + $data = [];
  169 + $serversIpModel = new ServersIpModel();
  170 + $list = $serversIpModel->list($this->map);
  171 + foreach ($list as $v){
  172 + $position = strpos($v['domain'], '.');
  173 + $result = substr($v['domain'], 0, $position);
  174 + $data[] = ['记录类型'=>'A','主机记录'=>$result,'解析线路'=>'默认','记录值'=>$v['ip'],'MAX优先级'=>'','TTL值'=>600,'状态(暂停/启用)'=>'启用','备注'=>$info['server_name']];
  175 + }
  176 + $this->response('success',Code::SUCCESS,$data);
  177 + }
113 } 178 }
@@ -422,7 +422,6 @@ class OptimizeController extends BaseController @@ -422,7 +422,6 @@ class OptimizeController extends BaseController
422 if($info === false){ 422 if($info === false){
423 $this->response('请先创建视频任务,才能开启',Code::SYSTEM_ERROR); 423 $this->response('请先创建视频任务,才能开启',Code::SYSTEM_ERROR);
424 } 424 }
425 - $keywordVideoModel->edit(['status'=>$this->param['status']],['project_id'=>$this->param['project_id']]);  
426 $optimizeModel = new DeployOptimize(); 425 $optimizeModel = new DeployOptimize();
427 $optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]); 426 $optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]);
428 $this->response('success'); 427 $this->response('success');
@@ -46,12 +46,12 @@ class ReplaceHtmlController extends BaseController @@ -46,12 +46,12 @@ class ReplaceHtmlController extends BaseController
46 public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){ 46 public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){
47 $this->request->validate([ 47 $this->request->validate([
48 'name'=>'required', 48 'name'=>'required',
49 - 'html'=>'required', 49 +// 'html'=>'required',
50 'old_html'=>'required', 50 'old_html'=>'required',
51 'project_id'=>'required', 51 'project_id'=>'required',
52 ],[ 52 ],[
53 'name.required' => '需替换页面标识不能为空', 53 'name.required' => '需替换页面标识不能为空',
54 - 'html.required' => 'html不能为空', 54 +// 'html.required' => 'html不能为空',
55 'old_html.required' => '替换前的html不能为空', 55 'old_html.required' => '替换前的html不能为空',
56 'project_id.required' => 'project_id不能为空', 56 'project_id.required' => 'project_id不能为空',
57 ]); 57 ]);
@@ -88,10 +88,7 @@ class AyrReleaseController extends BaseController @@ -88,10 +88,7 @@ class AyrReleaseController extends BaseController
88 } 88 }
89 //发送请求发布社交文章 89 //发送请求发布社交文章
90 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); 90 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
91 - //保存数据库  
92 - if($res){  
93 - $ayrReleaseLogic->release_add($res);  
94 - } 91 + $ayrReleaseLogic->release_add($res);
95 //保存返回的内容 92 //保存返回的内容
96 $this->response('success',Code::SUCCESS,json_decode($res)); 93 $this->response('success',Code::SUCCESS,json_decode($res));
97 } 94 }
@@ -225,9 +225,12 @@ class CNoticeController extends BaseController @@ -225,9 +225,12 @@ class CNoticeController extends BaseController
225 $ids = explode(',',$info['country_lists']); 225 $ids = explode(',',$info['country_lists']);
226 } 226 }
227 $languageModel = new WebLanguage(); 227 $languageModel = new WebLanguage();
  228 + if(empty($ids)){
  229 + array_push($ids,1);
  230 + }
228 //根据排序查询选中的小语种 231 //根据排序查询选中的小语种
229 $lists = $languageModel->whereIn('id', $ids)->orderByRaw(DB::raw("FIND_IN_SET(id,'" . implode(',', $ids) . "'" . ')'))->get()->toArray(); 232 $lists = $languageModel->whereIn('id', $ids)->orderByRaw(DB::raw("FIND_IN_SET(id,'" . implode(',', $ids) . "'" . ')'))->get()->toArray();
230 -// $lists = $languageModel->list(['id'=>['in',$ids]]); 233 +
231 $this->response('success',Code::SUCCESS,$lists); 234 $this->response('success',Code::SUCCESS,$lists);
232 } 235 }
233 236
@@ -31,7 +31,6 @@ class ProjectKeywordController extends BaseController @@ -31,7 +31,6 @@ class ProjectKeywordController extends BaseController
31 $data['search_keywords'] = $info['search_keywords']; 31 $data['search_keywords'] = $info['search_keywords'];
32 $data['customer_keywords'] = $info['customer_keywords']; 32 $data['customer_keywords'] = $info['customer_keywords'];
33 $data['brand_keyword'] = $info['brand_keyword']; 33 $data['brand_keyword'] = $info['brand_keyword'];
34 - $data['minor_keywords'] = $info['minor_keywords'];  
35 $this->response('success',Code::SUCCESS,$data); 34 $this->response('success',Code::SUCCESS,$data);
36 } 35 }
37 36
@@ -59,9 +59,9 @@ class ProductController extends BaseController @@ -59,9 +59,9 @@ class ProductController extends BaseController
59 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 59 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
60 $userModel = new User(); 60 $userModel = new User();
61 foreach ($lists['list'] as $k=>$v){ 61 foreach ($lists['list'] as $k=>$v){
62 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);; 62 + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
63 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 63 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
64 - $v['keyword_id_text'] = mb_substr($this->keywordName($v['keyword_id'],$key_data), 0, 20, 'UTF-8').'...'; 64 + $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
65 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 65 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); 66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
67 $v = $this->getHandleFileImage($v); 67 $v = $this->getHandleFileImage($v);
@@ -213,29 +213,6 @@ class ProductController extends BaseController @@ -213,29 +213,6 @@ class ProductController extends BaseController
213 } 213 }
214 214
215 /** 215 /**
216 - * @remark :获取所有关键词  
217 - * @name :getCategoryList  
218 - * @author :lyh  
219 - * @method :post  
220 - * @time :2023/9/14 13:56  
221 - */  
222 - public function getKeywordsList(){  
223 - $data = Common::get_user_cache('product_keyword',$this->user['project_id']);  
224 - if(empty($data)) {  
225 - $keywordModel = new Keyword();  
226 - $data = [];  
227 - $cateList = $keywordModel->list(['project_id' => $this->user['project_id']], ['id', 'title']);  
228 - if (!empty($cateList)) {  
229 - foreach ($cateList as $value) {  
230 - $data[$value['id']] = $value['title'];  
231 - }  
232 - }  
233 - Common::set_user_cache($data,'product_keyword',$this->user['project_id']);  
234 - }  
235 - return $data;  
236 - }  
237 -  
238 - /**  
239 * @remark :获取分类名称 216 * @remark :获取分类名称
240 * @name :categoryName 217 * @name :categoryName
241 * @author :lyh 218 * @author :lyh
@@ -43,7 +43,8 @@ class WebSettingFromController extends BaseController @@ -43,7 +43,8 @@ class WebSettingFromController extends BaseController
43 { 43 {
44 $message = $request->input('message', 'success'); 44 $message = $request->input('message', 'success');
45 $url = $request->input('url'); 45 $url = $request->input('url');
46 - $webSettingFromLogic->fromBackMsgSet($message, $url); 46 + $other = $request->input('other') ?? false;
  47 + $webSettingFromLogic->fromBackMsgSet($message, $url, $other);
47 $this->response('success'); 48 $this->response('success');
48 } 49 }
49 50
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Suppliers; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Suppliers;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\Purchaser\Purchaser; 14 use App\Models\Purchaser\Purchaser;
  15 +use App\Models\Purchaser\PurchaserInfo;
15 16
16 /** 17 /**
17 * @remark :推荐采购商 18 * @remark :推荐采购商
@@ -22,7 +23,7 @@ use App\Models\Purchaser\Purchaser; @@ -22,7 +23,7 @@ use App\Models\Purchaser\Purchaser;
22 */ 23 */
23 class SuppliersController extends BaseController 24 class SuppliersController extends BaseController
24 { 25 {
25 - public $domain = 'https://admin.hagro.cn/'; 26 + public $domain = 'https://fob.ai.cc/';
26 27
27 /** 28 /**
28 * @remark :推荐采购商 29 * @remark :推荐采购商
@@ -32,21 +33,14 @@ class SuppliersController extends BaseController @@ -32,21 +33,14 @@ class SuppliersController extends BaseController
32 * @time :2024/3/4 10:10 33 * @time :2024/3/4 10:10
33 */ 34 */
34 public function recommendedPurchaser(){ 35 public function recommendedPurchaser(){
35 - $purchaserModel = new Purchaser();  
36 - $data = []; 36 + $purchaserModel = new PurchaserInfo();
37 $this->map['project_id'] = $this->user['project_id']; 37 $this->map['project_id'] = $this->user['project_id'];
38 - $lists = $purchaserModel->list($this->map);  
39 - if(!empty($lists)){  
40 - foreach ($lists as $v){  
41 - if(!empty($v['data'])){  
42 - $resultData = json_decode($v['data'],true);  
43 - foreach ($resultData as $value){  
44 - $value = (array)$value;  
45 - $value['keyword'] = $v['keyword'];  
46 - $data[] = $value;  
47 - }  
48 - }  
49 - } 38 + $data = $purchaserModel->list($this->map);
  39 + foreach ($data as $k => $v){
  40 + $v['email'] = json_decode($v['email'],true);
  41 + $v['mobile'] = json_decode($v['mobile'],true);
  42 + $v['social_media'] = json_decode($v['social_media'],true);
  43 + $data[$k] = $v;
50 } 44 }
51 $this->response('success',Code::SUCCESS,$data); 45 $this->response('success',Code::SUCCESS,$data);
52 } 46 }
@@ -10,7 +10,9 @@ @@ -10,7 +10,9 @@
10 namespace App\Http\Logic\Aside\Devops; 10 namespace App\Http\Logic\Aside\Devops;
11 11
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Devops\Servers;
13 use App\Models\Devops\ServersIp; 14 use App\Models\Devops\ServersIp;
  15 +use App\Models\Project\Project;
14 16
15 class ServersIpLogic extends BaseLogic 17 class ServersIpLogic extends BaseLogic
16 { 18 {
@@ -25,6 +27,20 @@ class ServersIpLogic extends BaseLogic @@ -25,6 +27,20 @@ class ServersIpLogic extends BaseLogic
25 } 27 }
26 28
27 /** 29 /**
  30 + * @remark :获取数据详情
  31 + * @name :infoServersIp
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2024/6/27 15:52
  35 + */
  36 + public function infoServersIp(){
  37 + $info = $this->model->read(['id'=>$this->param['id']]);
  38 + $projectModel = new Project();
  39 + $info['project_title'] = $projectModel->formatQuery(['serve_id'=>$info['id']])->pluck('title')->toArray();
  40 + return $this->success($info);
  41 + }
  42 +
  43 + /**
28 * @remark :保存数据 44 * @remark :保存数据
29 * @name :saveServersIp 45 * @name :saveServersIp
30 * @author :lyh 46 * @author :lyh
@@ -32,6 +48,11 @@ class ServersIpLogic extends BaseLogic @@ -32,6 +48,11 @@ class ServersIpLogic extends BaseLogic
32 * @time :2024/6/24 17:28 48 * @time :2024/6/24 17:28
33 */ 49 */
34 public function saveServersIp(){ 50 public function saveServersIp(){
  51 + //验证域名是否唯一
  52 + $info = $this->model->read(['domain'=>$this->param['domain']]);
  53 + if($info !== false){
  54 + $this->fail('当前初始域名已存在');
  55 + }
35 if(isset($this->param['id']) && !empty($this->param['id'])){ 56 if(isset($this->param['id']) && !empty($this->param['id'])){
36 $id = $this->param['id']; 57 $id = $this->param['id'];
37 $this->model->edit($this->param,['id'=>$this->param['id']]); 58 $this->model->edit($this->param,['id'=>$this->param['id']]);
@@ -49,17 +70,41 @@ class ServersIpLogic extends BaseLogic @@ -49,17 +70,41 @@ class ServersIpLogic extends BaseLogic
49 * @time :2024/6/24 17:25 70 * @time :2024/6/24 17:25
50 */ 71 */
51 public function batchSaveServersIp(){ 72 public function batchSaveServersIp(){
52 - $data = [];  
53 - foreach ($this->param['data'] as $v){  
54 - if(empty($v['ip']) || empty($v['domain'])){ 73 + //獲取初始域名
  74 + $serverModel = new Servers();
  75 + $info = $serverModel->read(['id'=>$this->param['servers_id']]);
  76 + if($info === false){
  77 + $this->fail('當前服務器數據不存在');
  78 + }
  79 + foreach ($this->param['ip'] as $v){
  80 + if(empty($v)){
55 continue; 81 continue;
56 } 82 }
57 - $data[] = [  
58 - 'ip'=>$v['ip'],  
59 - 'domain'=>$v['domain'], 83 + $param = [
  84 + 'ip'=>$v,
  85 + 'domain'=>ip_to_unique_string($v).'.'.$info['domain'],
60 'servers_id'=>$this->param['servers_id'] 86 'servers_id'=>$this->param['servers_id']
61 ]; 87 ];
  88 + $this->model->addReturnId($param);
  89 + }
  90 + return $this->success();
  91 + }
  92 +
  93 + /**
  94 + * @remark :批量删除数据
  95 + * @name :batchDelServersIp
  96 + * @author :lyh
  97 + * @method :post
  98 + * @time :2024/6/27 13:55
  99 + */
  100 + public function batchDelServersIp(){
  101 + foreach ($this->param['ids'] as $id){
  102 + $info = $this->model->read(['id'=>$id],['total']);
  103 + if($info['total'] != 0){
  104 + continue;
  105 + }
  106 + $this->model->edit(['status'=>1],['id'=>$id]);
62 } 107 }
63 - return $this->addReturnId($data); 108 + return $this->success();
64 } 109 }
65 } 110 }
@@ -8,6 +8,8 @@ use App\Jobs\EditAmpDomainBt; @@ -8,6 +8,8 @@ use App\Jobs\EditAmpDomainBt;
8 use App\Jobs\EditCustomDomainBt; 8 use App\Jobs\EditCustomDomainBt;
9 use App\Jobs\EditDomainBt; 9 use App\Jobs\EditDomainBt;
10 use App\Models\Devops\ServerConfig; 10 use App\Models\Devops\ServerConfig;
  11 +use App\Models\Devops\Servers;
  12 +use App\Models\Devops\ServersIp;
11 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
12 use App\Models\Project\CountryCustom; 14 use App\Models\Project\CountryCustom;
13 use App\Models\Project\DeployOptimize; 15 use App\Models\Project\DeployOptimize;
@@ -258,11 +260,14 @@ class DomainInfoLogic extends BaseLogic @@ -258,11 +260,14 @@ class DomainInfoLogic extends BaseLogic
258 if($project_info === false){ 260 if($project_info === false){
259 $this->fail('获取项目数据失败'); 261 $this->fail('获取项目数据失败');
260 } 262 }
261 - $server_model = new ServerConfig();  
262 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);  
263 - if($server_info === false){ 263 + $serverIpModel = new ServersIp();
  264 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  265 + if($serversIpInfo === false){
264 $this->fail('获取服务器数据失败'); 266 $this->fail('获取服务器数据失败');
265 } 267 }
  268 + $serverModel = new Servers();
  269 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  270 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
266 if($project_info['serve_id'] == 9){ 271 if($project_info['serve_id'] == 9){
267 $this->fail('请切换服务器,生成站点不能使用测试服务器'); 272 $this->fail('请切换服务器,生成站点不能使用测试服务器');
268 } 273 }
@@ -312,11 +317,9 @@ class DomainInfoLogic extends BaseLogic @@ -312,11 +317,9 @@ class DomainInfoLogic extends BaseLogic
312 $this->model->edit($data,['id'=>$this->param['id']]); 317 $this->model->edit($data,['id'=>$this->param['id']]);
313 //主站生成证书 318 //主站生成证书
314 EditDomainBt::dispatch($this->param['id']); 319 EditDomainBt::dispatch($this->param['id']);
315 -// $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? [],$this->param['is_https'] ?? 0);  
316 //amp站生成证书 320 //amp站生成证书
317 if($data['amp_status']){ 321 if($data['amp_status']){
318 EditAmpDomainBt::dispatch($this->param['id']); 322 EditAmpDomainBt::dispatch($this->param['id']);
319 -// $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);  
320 } 323 }
321 return $this->success(); 324 return $this->success();
322 } 325 }
@@ -339,7 +342,7 @@ class DomainInfoLogic extends BaseLogic @@ -339,7 +342,7 @@ class DomainInfoLogic extends BaseLogic
339 $output = explode(PHP_EOL, $process->getOutput()); 342 $output = explode(PHP_EOL, $process->getOutput());
340 foreach ($output as $line){ 343 foreach ($output as $line){
341 if($line){ 344 if($line){
342 - $checkA = strpos($line, $server_info['host']) !== false; 345 + $checkA = strpos($line, $server_info['ip']) !== false;
343 if($checkA){ 346 if($checkA){
344 return $domain; 347 return $domain;
345 } 348 }
@@ -352,7 +355,7 @@ class DomainInfoLogic extends BaseLogic @@ -352,7 +355,7 @@ class DomainInfoLogic extends BaseLogic
352 $output = explode(PHP_EOL, $process->getOutput()); 355 $output = explode(PHP_EOL, $process->getOutput());
353 foreach ($output as $line){ 356 foreach ($output as $line){
354 if($line){ 357 if($line){
355 - $checkCname = (strpos($line, $server_info['init_domain']) !== false); 358 + $checkCname = (strpos($line, $server_info['domain']) !== false);
356 if($checkCname){ 359 if($checkCname){
357 return $domain; 360 return $domain;
358 } 361 }
@@ -378,12 +381,14 @@ class DomainInfoLogic extends BaseLogic @@ -378,12 +381,14 @@ class DomainInfoLogic extends BaseLogic
378 $custom_model = new CountryCustom(); 381 $custom_model = new CountryCustom();
379 if($this->param['is_create']){ 382 if($this->param['is_create']){
380 //需要创建站点 383 //需要创建站点
381 - $server_model = new ServerConfig();  
382 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);  
383 - if($server_info === false){ 384 + $serverIpModel = new ServersIp();
  385 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  386 + if($serversIpInfo === false){
384 $this->fail('获取服务器数据失败'); 387 $this->fail('获取服务器数据失败');
385 } 388 }
386 - 389 + $serverModel = new Servers();
  390 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  391 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
387 //域名是否都已经解析 392 //域名是否都已经解析
388 if(strpos($this->param['custom_domain'],'//') === false){ 393 if(strpos($this->param['custom_domain'],'//') === false){
389 $this->param['custom_domain'] = '//'.$this->param['custom_domain']; 394 $this->param['custom_domain'] = '//'.$this->param['custom_domain'];
@@ -419,9 +424,6 @@ class DomainInfoLogic extends BaseLogic @@ -419,9 +424,6 @@ class DomainInfoLogic extends BaseLogic
419 if($this->param['is_create']){ 424 if($this->param['is_create']){
420 //创建站点,设置证书 425 //创建站点,设置证书
421 EditCustomDomainBt::dispatch($id); 426 EditCustomDomainBt::dispatch($id);
422 -// $this->param['key'] = $this->param['private_key'] ?? '';  
423 -// $this->param['cert'] = $this->param['private_cert'] ?? '';  
424 -// $this->setDomainSsl($server_info['init_domain'],$this->param['custom_domain'],[],[],1);  
425 } 427 }
426 428
427 return $this->success(); 429 return $this->success();
@@ -165,8 +165,10 @@ class HrLogic extends BaseLogic @@ -165,8 +165,10 @@ class HrLogic extends BaseLogic
165 if(($this->manager['gid'] != ManageHr::GID_ZERO) && isset($this->param['id'])){ 165 if(($this->manager['gid'] != ManageHr::GID_ZERO) && isset($this->param['id'])){
166 $groupModel = new Group(); 166 $groupModel = new Group();
167 $groupInfo = $groupModel->read(['id'=>$this->manager['gid']]); 167 $groupInfo = $groupModel->read(['id'=>$this->manager['gid']]);
168 - if (!in_array(20,$groupInfo['rights']) && ($data['manage_id'] != $this->manager['id'])) {  
169 - $this->fail('无权限查看其他用户信息'); 168 + if ((!in_array(20,$groupInfo['rights'])) && ($data['manage_id'] != $this->manager['id'])) {
  169 + if(strpos($this->manager['rules'],'20') == false){
  170 + $this->fail('无权限查看其他用户信息');
  171 + }
170 } 172 }
171 } 173 }
172 foreach ($this->model::specieField() as $v){ 174 foreach ($this->model::specieField() as $v){
@@ -10,7 +10,6 @@ use App\Helper\Arr; @@ -10,7 +10,6 @@ use App\Helper\Arr;
10 use App\Helper\Common; 10 use App\Helper\Common;
11 use App\Helper\FormGlobalsoApi; 11 use App\Helper\FormGlobalsoApi;
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
13 -use App\Http\Logic\Aside\Domain\DomainInfoLogic;  
14 use App\Jobs\CopyImageFileJob; 13 use App\Jobs\CopyImageFileJob;
15 use App\Jobs\CopyProjectJob; 14 use App\Jobs\CopyProjectJob;
16 use App\Models\Channel\Channel; 15 use App\Models\Channel\Channel;
@@ -18,7 +17,8 @@ use App\Models\Channel\User; @@ -18,7 +17,8 @@ use App\Models\Channel\User;
18 use App\Models\Channel\Zone; 17 use App\Models\Channel\Zone;
19 use App\Models\Com\NoticeLog; 18 use App\Models\Com\NoticeLog;
20 use App\Models\Com\UpdateLog; 19 use App\Models\Com\UpdateLog;
21 -use App\Models\Devops\ServerConfig; 20 +use App\Models\Devops\Servers;
  21 +use App\Models\Devops\ServersIp;
22 use App\Models\Domain\DomainInfo; 22 use App\Models\Domain\DomainInfo;
23 use App\Models\Inquiry\InquiryIP; 23 use App\Models\Inquiry\InquiryIP;
24 use App\Models\Inquiry\InquirySet; 24 use App\Models\Inquiry\InquirySet;
@@ -38,18 +38,14 @@ use App\Models\RankData\RankData; @@ -38,18 +38,14 @@ use App\Models\RankData\RankData;
38 use App\Models\RankData\RankWeek; 38 use App\Models\RankData\RankWeek;
39 use App\Models\RankData\RecommDomain; 39 use App\Models\RankData\RecommDomain;
40 use App\Models\RankData\Speed; 40 use App\Models\RankData\Speed;
41 -use App\Models\RouteMap\RouteMap;  
42 use App\Models\User\ProjectMenu; 41 use App\Models\User\ProjectMenu;
43 use App\Models\User\ProjectRole; 42 use App\Models\User\ProjectRole;
44 use App\Models\User\User as UserModel; 43 use App\Models\User\User as UserModel;
45 use App\Models\WebSetting\WebLanguage; 44 use App\Models\WebSetting\WebLanguage;
46 use App\Services\ProjectServer; 45 use App\Services\ProjectServer;
47 use App\Services\SyncService; 46 use App\Services\SyncService;
48 -use App\Utils\HttpUtils;  
49 use App\Utils\LogUtils; 47 use App\Utils\LogUtils;
50 -use GuzzleHttp\Exception\GuzzleException;  
51 use Illuminate\Support\Facades\Cache; 48 use Illuminate\Support\Facades\Cache;
52 -use Illuminate\Support\Facades\DB;  
53 use Illuminate\Support\Facades\Http; 49 use Illuminate\Support\Facades\Http;
54 50
55 /** 51 /**
@@ -128,10 +124,10 @@ class ProjectLogic extends BaseLogic @@ -128,10 +124,10 @@ class ProjectLogic extends BaseLogic
128 public function getInitDomain($serve_id = ''){ 124 public function getInitDomain($serve_id = ''){
129 $domain = ''; 125 $domain = '';
130 if(!empty($serve_id)){ 126 if(!empty($serve_id)){
131 - $serveModel = new ServerConfig();  
132 - $info = $serveModel->read(['id'=>$serve_id]); 127 + $serverIpModel = new ServersIp();
  128 + $info = $serverIpModel->read(['id'=>$serve_id]);
133 if($info !== false){ 129 if($info !== false){
134 - $domain = $info['init_domain']; 130 + $domain = $info['domain'];
135 } 131 }
136 } 132 }
137 return $this->success(['domain'=>$domain]); 133 return $this->success(['domain'=>$domain]);
@@ -145,36 +141,64 @@ class ProjectLogic extends BaseLogic @@ -145,36 +141,64 @@ class ProjectLogic extends BaseLogic
145 * @time :2023/8/30 11:57 141 * @time :2023/8/30 11:57
146 */ 142 */
147 public function projectSave(){ 143 public function projectSave(){
148 - DB::beginTransaction();  
149 - try {  
150 - if($this->param['type'] == Project::TYPE_SEVEN){  
151 - //错误单直接返回,单独处理  
152 - $this->setTypeSevenEdit($this->param);  
153 - }else{  
154 - //初始化项目  
155 - $this->createProjectData($this->param);  
156 - //保存项目信息  
157 - $this->saveProject($this->param);  
158 - //保存建站部署信息  
159 - $this->saveProjectDeployBuild($this->param['deploy_build']);  
160 - //保存付费信息  
161 - $this->saveProjectPayment($this->param['payment']);  
162 - //保存优化信息  
163 - $this->saveProjectDeployOptimize($this->param['deploy_optimize']);  
164 - //保存售后信息  
165 - $this->saveProjectAfter($this->param['project_after']);  
166 - //单独保存小语种配置  
167 - $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']);  
168 - //同步图片文件  
169 - $this->syncImageFile($this->param['project_location'],$this->param['id']);  
170 - //同步信息表  
171 - (new SyncService())->projectAcceptAddress($this->param['id']); 144 + if($this->param['type'] == Project::TYPE_SEVEN){
  145 + //错误单直接返回,单独处理
  146 + $this->setTypeSevenEdit($this->param);
  147 + }else{
  148 + //初始化项目
  149 + $this->createProjectData($this->param);
  150 + //双向绑定服务器,需放到保存项目的上方
  151 + $this->setServers($this->param['serve_id'],$this->param['id']);
  152 + //保存项目信息
  153 + $this->saveProject($this->param);
  154 + //保存建站部署信息
  155 + $this->saveProjectDeployBuild($this->param['deploy_build']);
  156 + //保存付费信息
  157 + $this->saveProjectPayment($this->param['payment']);
  158 + //保存优化信息
  159 + $this->saveProjectDeployOptimize($this->param['deploy_optimize']);
  160 + //保存售后信息
  161 + $this->saveProjectAfter($this->param['project_after']);
  162 + //单独保存小语种配置
  163 + $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']);
  164 + //同步图片文件
  165 + $this->syncImageFile($this->param['project_location'],$this->param['id']);
  166 + //同步信息表
  167 + (new SyncService())->projectAcceptAddress($this->param['id']);
  168 + }
  169 + return $this->success();
  170 + }
  171 +
  172 + /**
  173 + * @remark :选择服务器后双向绑定
  174 + * @name :setServers
  175 + * @author :lyh
  176 + * @method :post
  177 + * @time :2024/6/25 15:34
  178 + */
  179 + public function setServers($servers_id,$project_id){
  180 + //查看當前項目服務器是否有更改
  181 + $projectModel = new Project();
  182 + $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']);
  183 + $serversIpModel = new ServersIp();
  184 + $serversModel = new Servers();
  185 + if(!empty($projectInfo['serve_id'])){
  186 + if($projectInfo['serve_id'] == $servers_id){
  187 + return $this->success();
172 } 188 }
173 - DB::commit();  
174 - }catch (\Exception $e){  
175 - DB::rollBack();  
176 - $this->fail('保存失败,请联系管理员'); 189 + $oldServerIpInfo = $serversIpModel->read(['id'=>$projectInfo['serve_id']]);
  190 + if($oldServerIpInfo !== false){
  191 + $serversIpModel->where(['id'=>$projectInfo['serve_id']])->decrement('total',1);
  192 + $serversModel->where(['id'=>$oldServerIpInfo['servers_id']])->decrement('being_number',1);
  193 + }
  194 + }
  195 + $serversIpInfo = $serversIpModel->read(['id'=>$servers_id]);
  196 + $serversInfo = $serversModel->read(['id'=>$serversIpInfo['servers_id']]);
  197 + if($serversIpInfo['total'] >= $serversInfo['ip_total']){
  198 + $this->fail('请选择其他服务器,当前ip已满');
177 } 199 }
  200 + $serversIpModel->where(['id'=>$servers_id])->increment('total',1);
  201 + $serversModel->where(['id'=>$serversInfo['id']])->increment('being_number',1);
178 return $this->success(); 202 return $this->success();
179 } 203 }
180 204
@@ -613,12 +637,21 @@ class ProjectLogic extends BaseLogic @@ -613,12 +637,21 @@ class ProjectLogic extends BaseLogic
613 public function channelSource($param){ 637 public function channelSource($param){
614 switch ($param['type']){ 638 switch ($param['type']){
615 case Project::TYPE_ONE: 639 case Project::TYPE_ONE:
616 - return Zone::pluck('title', 'id')->toArray(); 640 + $data = [0=>'所有'];
  641 + $list = (new Zone())->list([],'id',['id','title'],'asc');
  642 + foreach ($list as $v){
  643 + $data[$v['id']] = $v['title'];
  644 + }
  645 + return $data;
617 case Project::TYPE_TWO: 646 case Project::TYPE_TWO:
618 if(isset($param['alias'])){ 647 if(isset($param['alias'])){
619 return Channel::where('alias', 'like' ,'%'.$param['alias'].'%')->pluck('alias', 'id')->toArray(); 648 return Channel::where('alias', 'like' ,'%'.$param['alias'].'%')->pluck('alias', 'id')->toArray();
620 } 649 }
621 - return Channel::where('zone_id', $param['zone_id']??0)->pluck('alias', 'id')->toArray(); 650 + $map = [];
  651 + if($param['zone_id'] != 0){
  652 + $map['zone_id'] = $param['zone_id'];
  653 + }
  654 + return Channel::where($map)->pluck('alias', 'id')->toArray();
622 case Project::TYPE_THREE: 655 case Project::TYPE_THREE:
623 return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray(); 656 return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray();
624 } 657 }
@@ -634,7 +667,18 @@ class ProjectLogic extends BaseLogic @@ -634,7 +667,18 @@ class ProjectLogic extends BaseLogic
634 * @time :2023/9/4 14:29 667 * @time :2023/9/4 14:29
635 */ 668 */
636 public function editDomainStatus($domain,$project_id){ 669 public function editDomainStatus($domain,$project_id){
  670 +
  671 + $projectOptimize = new DeployOptimize();
  672 + $optimizeInfo = $projectOptimize->read(['project_id'=>$project_id],['domain']);
  673 + if($optimizeInfo['domain'] == $domain){
  674 + return $this->success();
  675 + }
637 $domainModel = new DomainInfo(); 676 $domainModel = new DomainInfo();
  677 + //查看当前域名是否已使用
  678 + $domainInfo = $domainModel->read(['id'=>$domain,'project_id'=>['!=',0]]);
  679 + if($domainInfo !== false){
  680 + $this->fail('当前域名已被其他服务器使用');
  681 + }
638 //先清空上一次所绑定的域名 682 //先清空上一次所绑定的域名
639 $info = $domainModel->read(['project_id'=>$project_id]); 683 $info = $domainModel->read(['project_id'=>$project_id]);
640 if($info !== false){ 684 if($info !== false){
@@ -664,37 +708,6 @@ class ProjectLogic extends BaseLogic @@ -664,37 +708,6 @@ class ProjectLogic extends BaseLogic
664 } 708 }
665 709
666 /** 710 /**
667 - * 创建站点  
668 - * @param $param  
669 - * @throws AsideGlobalException  
670 - * @author Akun  
671 - * @date 2023/10/17 10:04  
672 - */  
673 - public function createSite($param){  
674 - if(isset($param['serve_id']) && $param['serve_id'] && isset($param['deploy_optimize']['domain']) && $param['deploy_optimize']['domain']){  
675 - $server_model = new ServerConfig();  
676 - $server_info = $server_model->read(['id'=>$param['serve_id']],['init_domain','host']);  
677 -  
678 - $domain_model = new DomainInfo();  
679 - $domain_info = $domain_model->read(['id'=>$param['deploy_optimize']['domain']],'domain');  
680 -  
681 - if($server_info && $domain_info){  
682 - //验证解析  
683 - if (!empty($domain_info['domain']) && !DomainInfoLogic::instance()->check_cname($domain_info['domain'], $server_info)) {  
684 - throw new AsideGlobalException(Code::SYSTEM_ERROR,'域名' . $domain_info['domain'] . '未解析至目标服务器');  
685 - }  
686 - $api_url = 'http://'.$server_info['init_domain'].'/api/createSite';  
687 - $api_param = ['domain'=>$domain_info['domain']];  
688 - try {  
689 - HttpUtils::get($api_url, $api_param);  
690 - } catch (\Exception | GuzzleException $e) {  
691 - errorLog('创建站点', $api_param, $e);  
692 - }  
693 - }  
694 - }  
695 - }  
696 -  
697 - /**  
698 * @remark :复制项目 711 * @remark :复制项目
699 * @name :copyProject 712 * @name :copyProject
700 * @author :lyh 713 * @author :lyh
@@ -156,7 +156,7 @@ class ReplaceHtmlLogic extends BaseLogic @@ -156,7 +156,7 @@ class ReplaceHtmlLogic extends BaseLogic
156 'template_id'=>$template_id, 156 'template_id'=>$template_id,
157 'status'=>$this->model::STATUS, 157 'status'=>$this->model::STATUS,
158 'old_html'=>$param['old_html'], 158 'old_html'=>$param['old_html'],
159 - 'html'=>$param['html'], 159 + 'html'=>$param['html'] ?? '',
160 'project_id'=>$param['project_id'], 160 'project_id'=>$param['project_id'],
161 'total_num'=>0, 161 'total_num'=>0,
162 'operator_id'=>$this->manager['id'] 162 'operator_id'=>$this->manager['id']
@@ -47,10 +47,7 @@ class AyrReleaseLogic extends BaseLogic @@ -47,10 +47,7 @@ class AyrReleaseLogic extends BaseLogic
47 $this->param['platforms'] = json_encode($this->param['platforms']); 47 $this->param['platforms'] = json_encode($this->param['platforms']);
48 $info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]); 48 $info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]);
49 if($info === false){ 49 if($info === false){
50 - $rs = $this->model->add($this->param);  
51 - if($rs === false){  
52 - $this->fail('error');  
53 - } 50 + $this->model->add($this->param);
54 } 51 }
55 return $this->success(); 52 return $this->success();
56 } 53 }
@@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic @@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic
28 $map['status'] = 0; 28 $map['status'] = 0;
29 $list = $this->model->list($map,$order,$filed); 29 $list = $this->model->list($map,$order,$filed);
30 $templateLabel = new TemplateLabel(); 30 $templateLabel = new TemplateLabel();
31 - foreach ($list as $k => $v){  
32 - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');  
33 - $list[$k] = $v; 31 + $label = [];
  32 + foreach ($list as $v){
  33 + $label[] = $v['id'];
  34 + }
  35 + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc');
  36 + foreach ($list as $k1 => $v1){
  37 + foreach ($label_arr as $v2){
  38 + if($v2['template_id'] == $v1['id']){
  39 + $v1['label'][] = $v2;
  40 + }
  41 + }
  42 + $list[$k1] = $v1;
34 } 43 }
35 return $this->success($list); 44 return $this->success($list);
36 } 45 }
@@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic @@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic
33 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){ 33 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){
34 $map['deleted_status'] = 0; 34 $map['deleted_status'] = 0;
35 $map['project_id'] = $this->user['project_id']; 35 $map['project_id'] = $this->user['project_id'];
36 - $lists = $this->model->list($map,$order,$filed); 36 + $list = $this->model->list($map,$order,$filed);
37 $templateLabel = new TemplateLabel(); 37 $templateLabel = new TemplateLabel();
38 - foreach ($lists as $k => $v){  
39 - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');  
40 - $lists[$k] = $v; 38 + $label = [];
  39 + foreach ($list as $v){
  40 + $label[] = $v['id'];
41 } 41 }
42 - return $this->success($lists); 42 + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc');
  43 + foreach ($list as $k1 => $v1){
  44 + foreach ($label_arr as $v2){
  45 + if($v2['template_id'] == $v1['id']){
  46 + $v1['label'][] = $v2;
  47 + }
  48 + }
  49 + $list[$k1] = $v1;
  50 + }
  51 + return $this->success($list);
43 } 52 }
44 53
45 /** 54 /**
@@ -326,13 +326,10 @@ class ProductLogic extends BaseLogic @@ -326,13 +326,10 @@ class ProductLogic extends BaseLogic
326 * @time :2023/10/20 9:02 326 * @time :2023/10/20 9:02
327 */ 327 */
328 public function handleListCategory($category){ 328 public function handleListCategory($category){
329 - $str = '';  
330 if(isset($category) && !empty($category)){ 329 if(isset($category) && !empty($category)){
331 - foreach ($category as $v){  
332 - $str .= $v.',';  
333 - } 330 + return ','.implode(',',$category).',';
334 } 331 }
335 - return !empty(trim($str,',')) ? ','.$str.',' : ''; 332 + return '';
336 } 333 }
337 334
338 335
@@ -61,10 +61,10 @@ class WebSettingFromLogic extends BaseLogic @@ -61,10 +61,10 @@ class WebSettingFromLogic extends BaseLogic
61 * @param $url 61 * @param $url
62 * @return WebSettingFormBack|mixed 62 * @return WebSettingFormBack|mixed
63 */ 63 */
64 - public function fromBackMsgSet($message, $url) 64 + public function fromBackMsgSet($message, $url, $other = false)
65 { 65 {
66 $project_id = $this->user['project_id']; 66 $project_id = $this->user['project_id'];
67 - $info = WebSettingFormBack::saveBack($project_id, $message, $url); 67 + $info = WebSettingFormBack::saveBack($project_id, $message, $url,$other);
68 return $info; 68 return $info;
69 } 69 }
70 70
@@ -25,7 +25,7 @@ class BlogRequest extends FormRequest @@ -25,7 +25,7 @@ class BlogRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 - 'seo_keywords'=>'max:1000', 28 + 'seo_keywords'=>'max:500',
29 'url'=>'required', 29 'url'=>'required',
30 ]; 30 ];
31 } 31 }
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 8 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -51,16 +53,17 @@ class EditAmpDomainBt implements ShouldQueue @@ -51,16 +53,17 @@ class EditAmpDomainBt implements ShouldQueue
51 if ($project_info === false) { 53 if ($project_info === false) {
52 return $this->output($domain_info['domain'] . ':获取项目数据失败'); 54 return $this->output($domain_info['domain'] . ':获取项目数据失败');
53 } 55 }
54 -  
55 //获取服务器数据 56 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
58 - if ($server_info === false) { 57 + $serverIpModel = new ServersIp();
  58 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  59 + if ($serversIpInfo === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 60 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 61 }
61 - 62 + $serverModel = new Servers();
  63 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  64 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
62 //编辑amp站 65 //编辑amp站
63 - $api_url_amp = 'http://' . $server_info['init_domain'] . '/api/createSiteAmp'; 66 + $api_url_amp = 'http://' . $server_info['domain'] . '/api/createSiteAmp';
64 $api_param_amp = [ 67 $api_param_amp = [
65 'domain' => $domain_info['domain'], 68 'domain' => $domain_info['domain'],
66 ]; 69 ];
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Project\CountryCustom; 8 use App\Models\Project\CountryCustom;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -51,14 +53,17 @@ class EditCustomDomainBt implements ShouldQueue @@ -51,14 +53,17 @@ class EditCustomDomainBt implements ShouldQueue
51 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); 53 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败');
52 } 54 }
53 //获取服务器数据 55 //获取服务器数据
54 - $server_model = new ServerConfig();  
55 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
56 - if ($server_info === false) { 56 + $serverIpModel = new ServersIp();
  57 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  58 + if ($serversIpInfo === false) {
57 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); 59 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败');
58 } 60 }
  61 + $serverModel = new Servers();
  62 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  63 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
59 //编辑站点 64 //编辑站点
60 if ($domain_info['type'] == 2) { 65 if ($domain_info['type'] == 2) {
61 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 66 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
62 $api_param = [ 67 $api_param = [
63 'domain' => $domain_info['custom_domain'], 68 'domain' => $domain_info['custom_domain'],
64 'private_key' => $domain_info['private_key'], 69 'private_key' => $domain_info['private_key'],
@@ -68,7 +73,7 @@ class EditCustomDomainBt implements ShouldQueue @@ -68,7 +73,7 @@ class EditCustomDomainBt implements ShouldQueue
68 'is_https' => 1 73 'is_https' => 1
69 ]; 74 ];
70 } else { 75 } else {
71 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 76 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
72 $api_param = [ 77 $api_param = [
73 'domain' => $domain_info['custom_domain'], 78 'domain' => $domain_info['custom_domain'],
74 'rewrite' => [], 79 'rewrite' => [],
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 8 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -53,15 +55,17 @@ class EditDomainBt implements ShouldQueue @@ -53,15 +55,17 @@ class EditDomainBt implements ShouldQueue
53 } 55 }
54 56
55 //获取服务器数据 57 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
58 - if ($server_info === false) { 58 + $serverIpModel = new ServersIp();
  59 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  60 + if ($serversIpInfo === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 61 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 62 }
61 - 63 + $serverModel = new Servers();
  64 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  65 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
62 //编辑主站 66 //编辑主站
63 if ($domain_info['type'] == 2) { 67 if ($domain_info['type'] == 2) {
64 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 68 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
65 $api_param = [ 69 $api_param = [
66 'domain' => $domain_info['domain'], 70 'domain' => $domain_info['domain'],
67 'private_key' => $domain_info['private_key'], 71 'private_key' => $domain_info['private_key'],
@@ -71,7 +75,7 @@ class EditDomainBt implements ShouldQueue @@ -71,7 +75,7 @@ class EditDomainBt implements ShouldQueue
71 'is_https' => $domain_info['is_https'] 75 'is_https' => $domain_info['is_https']
72 ]; 76 ];
73 } else { 77 } else {
74 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 78 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
75 $api_param = [ 79 $api_param = [
76 'domain' => $domain_info['domain'], 80 'domain' => $domain_info['domain'],
77 'rewrite' => $domain_info['extend_config'], 81 'rewrite' => $domain_info['extend_config'],
@@ -17,7 +17,6 @@ class Project extends Base @@ -17,7 +17,6 @@ class Project extends Base
17 protected $table = 'gl_project'; 17 protected $table = 'gl_project';
18 18
19 const DATABASE_NAME_FIX = 'gl_data_'; 19 const DATABASE_NAME_FIX = 'gl_data_';
20 -  
21 const CUSTOMIZED_ONE = 1;//定制项目 20 const CUSTOMIZED_ONE = 1;//定制项目
22 const DEMO_PROJECT_ID = 1; 21 const DEMO_PROJECT_ID = 1;
23 22
@@ -447,7 +447,9 @@ Route::middleware(['aloginauth'])->group(function () { @@ -447,7 +447,9 @@ Route::middleware(['aloginauth'])->group(function () {
447 Route::any('/list', [Aside\Devops\ServersIpController::class, 'list'])->name('admin.servers_list'); 447 Route::any('/list', [Aside\Devops\ServersIpController::class, 'list'])->name('admin.servers_list');
448 Route::any('/save', [Aside\Devops\ServersIpController::class, 'save'])->name('admin.servers_save'); 448 Route::any('/save', [Aside\Devops\ServersIpController::class, 'save'])->name('admin.servers_save');
449 Route::any('/batchSave', [Aside\Devops\ServersIpController::class, 'batchSave'])->name('admin.servers_batchSave'); 449 Route::any('/batchSave', [Aside\Devops\ServersIpController::class, 'batchSave'])->name('admin.servers_batchSave');
  450 + Route::any('/batchDel', [Aside\Devops\ServersIpController::class, 'batchDel'])->name('admin.servers_batchDel');
450 Route::any('/info', [Aside\Devops\ServersIpController::class, 'info'])->name('admin.servers_info'); 451 Route::any('/info', [Aside\Devops\ServersIpController::class, 'info'])->name('admin.servers_info');
  452 + Route::any('/downloadFile', [Aside\Devops\ServersIpController::class, 'downloadFile'])->name('admin.servers_downloadFile');
451 }); 453 });
452 }); 454 });
453 455