作者 刘锟

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

@@ -11,6 +11,7 @@ namespace App\Console\Commands\DeleteTemplate; @@ -11,6 +11,7 @@ namespace App\Console\Commands\DeleteTemplate;
11 11
12 use App\Models\Project\Project; 12 use App\Models\Project\Project;
13 use App\Models\Template\BTemplateLog; 13 use App\Models\Template\BTemplateLog;
  14 +use App\Models\User\UserLog;
14 use App\Services\ProjectServer; 15 use App\Services\ProjectServer;
15 use Illuminate\Console\Command; 16 use Illuminate\Console\Command;
16 use Illuminate\Support\Facades\DB; 17 use Illuminate\Support\Facades\DB;
@@ -48,6 +49,7 @@ class TemplateLog extends Command @@ -48,6 +49,7 @@ class TemplateLog extends Command
48 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 49 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
49 ProjectServer::useProject($v['id']); 50 ProjectServer::useProject($v['id']);
50 $this->deleteTemplate(); 51 $this->deleteTemplate();
  52 + $this->deleteUserLog();
51 DB::disconnect('custom_mysql'); 53 DB::disconnect('custom_mysql');
52 } 54 }
53 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 55 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -65,4 +67,17 @@ class TemplateLog extends Command @@ -65,4 +67,17 @@ class TemplateLog extends Command
65 $templateLogModel = new BTemplateLog(); 67 $templateLogModel = new BTemplateLog();
66 return $templateLogModel->del(['created_at'=>['<=',$date]]); 68 return $templateLogModel->del(['created_at'=>['<=',$date]]);
67 } 69 }
  70 +
  71 + /**
  72 + * @remark :清除用户日志
  73 + * @name :deleteUserLog
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2024/11/13 16:19
  77 + */
  78 + public function deleteUserLog(){
  79 + $date = date('Y-m-d H:i:s', strtotime('-60 days'));
  80 + $userLogModel = new UserLog();
  81 + return $userLogModel->del(['created_at'=>['<=',$date]]);
  82 + }
68 } 83 }
@@ -36,6 +36,7 @@ class RemainDay extends Command @@ -36,6 +36,7 @@ class RemainDay extends Command
36 */ 36 */
37 protected $ceaseProjectId = [ 37 protected $ceaseProjectId = [
38 354, 38 354,
  39 + 649,
39 1283 40 1283
40 ];//需要单独处理的项目 41 ];//需要单独处理的项目
41 /** 42 /**
@@ -70,7 +71,7 @@ class RemainDay extends Command @@ -70,7 +71,7 @@ class RemainDay extends Command
70 if($item['type'] != Project::TYPE_THREE){ 71 if($item['type'] != Project::TYPE_THREE){
71 $item->pause_days = $item->pause_days + 1; 72 $item->pause_days = $item->pause_days + 1;
72 } 73 }
73 - } 74 + }else{
74 if(in_array($item->id,$this->projectId)){//已开始优化的时间结算 75 if(in_array($item->id,$this->projectId)){//已开始优化的时间结算
75 $optimizeModel = new DeployOptimize(); 76 $optimizeModel = new DeployOptimize();
76 $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']); 77 $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']);
@@ -94,6 +95,8 @@ class RemainDay extends Command @@ -94,6 +95,8 @@ class RemainDay extends Command
94 } 95 }
95 } 96 }
96 $item->remain_day = ($remain_day > 0 ? $remain_day : 0); 97 $item->remain_day = ($remain_day > 0 ? $remain_day : 0);
  98 + }
  99 + $item->save();
97 // if($item->remain_day == 0){ 100 // if($item->remain_day == 0){
98 // $item->extend_type = Project::TYPE_FIVE; 101 // $item->extend_type = Project::TYPE_FIVE;
99 // $item->site_status = Project::TYPE_ONE;//关闭站点 102 // $item->site_status = Project::TYPE_ONE;//关闭站点
@@ -104,7 +107,6 @@ class RemainDay extends Command @@ -104,7 +107,6 @@ class RemainDay extends Command
104 // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/'); 107 // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/');
105 // } 108 // }
106 // } 109 // }
107 - $item->save();  
108 } 110 }
109 } 111 }
110 } 112 }
@@ -165,6 +165,12 @@ class RelayInquiry extends Command @@ -165,6 +165,12 @@ class RelayInquiry extends Command
165 protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀 165 protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀
166 166
167 /** 167 /**
  168 + * 手机号过滤 0去掉+ 1不转发手机 2不处理
  169 + * @var int[]
  170 + */
  171 + protected $filter_phone = [30,12,58];
  172 +
  173 + /**
168 * @return bool 174 * @return bool
169 */ 175 */
170 public function handle() 176 public function handle()
@@ -307,6 +313,15 @@ class RelayInquiry extends Command @@ -307,6 +313,15 @@ class RelayInquiry extends Command
307 } 313 }
308 314
309 foreach ($random_data as $item) { 315 foreach ($random_data as $item) {
  316 + //手机号过滤
  317 + $phone = $form->phone;
  318 + $filter_phone = $this->get_rand($this->filter_phone);
  319 + if($filter_phone == 0){
  320 + $phone = trim(str_replace("+", '', $phone));
  321 + }elseif($filter_phone == 1){
  322 + $phone = '';
  323 + }
  324 +
310 // 推送站点 325 // 推送站点
311 $domain = $item['url']; 326 $domain = $item['url'];
312 $is_v6 = $item['is_v6']; 327 $is_v6 = $item['is_v6'];
@@ -370,11 +385,7 @@ class RelayInquiry extends Command @@ -370,11 +385,7 @@ class RelayInquiry extends Command
370 385
371 $this->output('获取转发ip'); 386 $this->output('获取转发ip');
372 // TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP 387 // TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP
373 - if (strlen($form->country) == 2) {  
374 - $country = $this->getCountry($form->country);  
375 - } else {  
376 - $country = Translate::tran($form->country, 'zh');  
377 - } 388 + $country = $form->country_name;
378 // 有国家 通过国家查询, 如果没有获取到就随机获取 389 // 有国家 通过国家查询, 如果没有获取到就随机获取
379 $where = []; 390 $where = [];
380 $country && $where['ip_area'] = $country; 391 $country && $where['ip_area'] = $country;
@@ -446,7 +457,7 @@ class RelayInquiry extends Command @@ -446,7 +457,7 @@ class RelayInquiry extends Command
446 continue; 457 continue;
447 } 458 }
448 // 写入推送详情 459 // 写入推送详情
449 - $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $form->phone, $message, $message_id, $device_port, 460 + $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
450 $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds)); 461 $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
451 foreach ($urls as $k=>$v){ 462 foreach ($urls as $k=>$v){
452 $pre++; 463 $pre++;
@@ -499,22 +510,6 @@ class RelayInquiry extends Command @@ -499,22 +510,6 @@ class RelayInquiry extends Command
499 } 510 }
500 511
501 /** 512 /**
502 - * 通过国家简码获取国家名称  
503 - * @param $code  
504 - * @return string  
505 - */  
506 - public function getCountry($code)  
507 - {  
508 - $cache_key = 'inquiry_world_country';  
509 - $country_code = Cache::get($cache_key, function () use ($cache_key) {  
510 - $country_code = DB::table('gl_world_country_city')->where(['pid' => 0])->pluck('chinese_name', 'iso2')->toArray();  
511 - Cache::put($cache_key, $country_code, 86400);  
512 - return $country_code;  
513 - });  
514 - return empty($country_code[$code]) ? '' : $country_code[$code];  
515 - }  
516 -  
517 - /**  
518 * 获取头信息 513 * 获取头信息
519 * @param $ip_area 514 * @param $ip_area
520 * @param $lang 515 * @param $lang
@@ -598,7 +593,7 @@ class RelayInquiry extends Command @@ -598,7 +593,7 @@ class RelayInquiry extends Command
598 } 593 }
599 $translateSl = Translate::translateSl($incontent); 594 $translateSl = Translate::translateSl($incontent);
600 $lang = $translateSl['texts']['sl'] ?? 'en'; 595 $lang = $translateSl['texts']['sl'] ?? 'en';
601 - if ($lang == 'en' || Str::contains($lang, 'zh')) { 596 + if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) {
602 $language = '英文'; 597 $language = '英文';
603 $lang = 'en'; 598 $lang = 'en';
604 }else{ 599 }else{
@@ -6,6 +6,7 @@ use App\Models\Inquiry\ReInquiryDetail; @@ -6,6 +6,7 @@ use App\Models\Inquiry\ReInquiryDetail;
6 use App\Models\Inquiry\ReInquiryDetailLog; 6 use App\Models\Inquiry\ReInquiryDetailLog;
7 use App\Models\Inquiry\ReInquiryForm; 7 use App\Models\Inquiry\ReInquiryForm;
8 use Illuminate\Console\Command; 8 use Illuminate\Console\Command;
  9 +use Illuminate\Support\Facades\Cache;
9 use Illuminate\Support\Facades\Http; 10 use Illuminate\Support\Facades\Http;
10 use Illuminate\Support\Facades\Log; 11 use Illuminate\Support\Facades\Log;
11 use Illuminate\Support\Facades\Redis; 12 use Illuminate\Support\Facades\Redis;
@@ -115,11 +116,16 @@ class postInquiry extends Command @@ -115,11 +116,16 @@ class postInquiry extends Command
115 } 116 }
116 }else{ 117 }else{
117 //v4 v5分离项目 往测试链接推 118 //v4 v5分离项目 往测试链接推
  119 + $split_api_cache_key = 'quanqiusou_split_site_array';
  120 + $site_array = Cache::get($split_api_cache_key);
  121 + if(!$site_array){
118 $client = new \GuzzleHttp\Client(); 122 $client = new \GuzzleHttp\Client();
119 $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [ 123 $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [
120 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 124 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
121 ])->getBody()->getContents(); 125 ])->getBody()->getContents();
122 $site_array = json_decode($site_array, true); 126 $site_array = json_decode($site_array, true);
  127 + Cache::put($split_api_cache_key, $site_array, 7200);
  128 + }
123 $mail_urls = array_column($site_array, 'main_url'); 129 $mail_urls = array_column($site_array, 'main_url');
124 $key = array_search($website, $mail_urls); 130 $key = array_search($website, $mail_urls);
125 if ($key !== false) { 131 if ($key !== false) {
@@ -195,6 +201,7 @@ class postInquiry extends Command @@ -195,6 +201,7 @@ class postInquiry extends Command
195 //兼容接口返回格式 201 //兼容接口返回格式
196 if(!empty($res['data'][0]['status'])){ 202 if(!empty($res['data'][0]['status'])){
197 $res['data'][0]['code'] = $res['data'][0]['status'] == 'success' ? 200 : 400; 203 $res['data'][0]['code'] = $res['data'][0]['status'] == 'success' ? 200 : 400;
  204 + !empty($res['data'][0]['msg']) && $res['message'] = $res['data'][0]['msg'];
198 } 205 }
199 if(empty($res['data'][0]['code']) || !in_array($res['data'][0]['code'], [200,300])){ 206 if(empty($res['data'][0]['code']) || !in_array($res['data'][0]['code'], [200,300])){
200 $log->status = ReInquiryDetailLog::STATUS_FAIL; 207 $log->status = ReInquiryDetailLog::STATUS_FAIL;
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CountAllProject.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/9 10:03
  8 + */
  9 +
  10 +namespace App\Console\Commands\Project;
  11 +
  12 +use App\Models\Channel\Channel;
  13 +use App\Models\Domain\DomainInfo;
  14 +use App\Models\Manage\ManageHr;
  15 +use App\Models\Project\Project;
  16 +use Illuminate\Console\Command;
  17 +use App\Models\Project\CountAllProject as AllProject;
  18 +
  19 +class CountAllProject extends Command
  20 +{
  21 + /**
  22 + * The name and signature of the console command.
  23 + *
  24 + * @var string
  25 + */
  26 + protected $signature = 'count_all_project';
  27 +
  28 + /**
  29 + * The console command description.
  30 + *
  31 + * @var string
  32 + */
  33 + protected $description = '统计所有项目设置';
  34 +
  35 +
  36 + public function handle(){
  37 + AllProject::truncate();
  38 + $noSixCount = $this->NoSixProject();
  39 + echo 'success:' .$noSixCount . PHP_EOL . date('Y-m-d H:i:s');
  40 + $sixCount = $this->sixProject();
  41 + echo 'success:' .$sixCount . PHP_EOL . date('Y-m-d H:i:s');
  42 + $data = $noSixCount + $sixCount;
  43 + echo 'success:' .$data . PHP_EOL . date('Y-m-d H:i:s');
  44 + return true;
  45 + }
  46 +
  47 + /**
  48 + * @remark :5.0数据
  49 + * @name :NoSixProject
  50 + * @author :lyh
  51 + * @method :post
  52 + * @time :2024/11/11 15:21
  53 + */
  54 + public function NoSixProject(){
  55 + $count = 0;
  56 + $i = 1;
  57 + while (true) {
  58 + $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=' . $i . '&pagesize=500';
  59 + $result = $this->httpGetProxy($url);
  60 + // 检查结果是否成功,并且结构符合预期
  61 + if (isset($result['data']['data']) && is_array($result['data']['data'])) {
  62 + $data = $result['data']['data'];
  63 + // 如果当前页没有数据,跳出循环
  64 + if (empty($data)) {
  65 + break;
  66 + }
  67 + foreach ($data as $k => $v){
  68 + if(empty($v['online_date'])){
  69 + $v['online_date'] = null;
  70 + }
  71 + if($v['is_admin5'] == 5){
  72 + $v['version'] = 2;
  73 + }else{
  74 + $v['version'] = 3;
  75 + }
  76 + $v['is_upgrade'] = 0;
  77 + $v['status'] = 0;
  78 + $v['created_at'] = $v['updated_at'] = date('Y-m-d H:i:s');
  79 + $data[$k] = $v;
  80 + }
  81 + echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL;
  82 + $count = $count + count($data);
  83 + $countAllModel = new AllProject;
  84 + $countAllModel->insert($data);
  85 + $i++;
  86 + // 每次请求后增加 1 秒延迟,防止请求过于频繁
  87 + sleep(1);
  88 + } else {
  89 + // 如果数据结构不符合预期,输出错误信息并跳出循环
  90 + echo '数据结构不符合预期或请求失败,停止执行。' . PHP_EOL . json_encode($result);
  91 + break;
  92 + }
  93 + }
  94 + return $count;
  95 + }
  96 +
  97 + public function httpGetProxy($url){
  98 + $ch1 = curl_init();
  99 + $timeout = 0;
  100 + curl_setopt($ch1, CURLOPT_URL, $url);
  101 + curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  102 + curl_setopt($ch1, CURLOPT_PROXY, 'http://69.90.188.183:51395');
  103 + curl_setopt($ch1, CURLOPT_ENCODING, '');
  104 + curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
  105 + curl_setopt($ch1, CURLOPT_HTTPHEADER, array());
  106 + curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
  107 + curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
  108 + curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
  109 + curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
  110 + curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
  111 + curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  112 + $content = curl_exec($ch1);
  113 + curl_close($ch1);
  114 + return json_decode($content, true);
  115 + }
  116 +
  117 + public function sixProject(){
  118 + $count = 0;
  119 + $projectModel = new Project();
  120 + $manageModel = new ManageHr();
  121 + $i = 1;
  122 + while (true){
  123 + $query = $projectModel->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id')
  124 + ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
  125 + ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  126 + ->where('gl_project.delete_status',Project::TYPE_ZERO);
  127 + $lists = $query->paginate(500, $this->selectParam(), 'page', $i)->toArray();
  128 + if(empty($lists) || empty($lists['list'])){
  129 + break;
  130 + }
  131 + $data = [];
  132 + echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL;
  133 + foreach ($lists['list'] as $k => $v){
  134 + $data[] = [
  135 + 'project_id'=>$v['id'],
  136 + 'version'=>1,//代表6.0
  137 + 'is_upgrade'=>$v['is_upgrade'],
  138 + 'title'=>$v['title'],
  139 + 'company'=>$v['company'],
  140 + 'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0),
  141 + 'join_date'=>$v['cooperate_date'],
  142 + 'online_date'=>$v['uptime'],
  143 + 'keywords_num'=>$v['key'],
  144 + 'service_num'=>$v['day'],
  145 + 'production_num'=>intval(abs((empty($v['uptime']) ? time() : strtotime($v['uptime'])) - strtotime($v['created_at'])) / 86400),
  146 + 'plan'=>Project::planMap()[$v['plan']],
  147 + 'status'=>0,
  148 + 'test_domain'=>$v['test_domain'],
  149 + 'product_domain'=>!empty($v['domain']) ? (new DomainInfo())->getDomain($v['domain']) : '',
  150 + 'project_manager'=>$manageModel->getName($v['manager_mid'] ?? ''),
  151 + 'project_group'=>$manageModel->getName($v['leader_mid'] ?? ''),
  152 + 'project_design'=>$manageModel->getName($v['designer_mid'] ?? ''),
  153 + 'project_assistant'=>$manageModel->getName($v['tech_mid'] ?? ''),
  154 + 'service_manager'=>$manageModel->getName($v['optimize_manager_mid'] ??''),
  155 + 'service_optimize'=>$manageModel->getName($v['optimize_optimist_mid'] ??''),
  156 + 'service_assistant'=>$manageModel->getName($v['optimize_assist_mid'] ??''),
  157 + 'qa'=>$manageModel->getName($v['quality_mid'] ??''),
  158 + 'created_at'=>date('Y-m-d H:i:s'),
  159 + 'updated_at'=>date('Y-m-d H:i:s'),
  160 + ];
  161 + }
  162 + $count = $count + count($data);
  163 + $countAllModel = new AllProject;
  164 + $countAllModel->insert($data);
  165 + sleep(1);
  166 + $i++;
  167 + }
  168 + return $count;
  169 + }
  170 +
  171 + /**
  172 + * 需要查询的字段
  173 + * @return array
  174 + */
  175 + public function selectParam(){
  176 + $select = [
  177 + 'gl_project.id AS id',
  178 + 'gl_project.title AS title',
  179 + 'gl_project.channel AS channel',
  180 + 'gl_project.company AS company',
  181 + 'gl_project.type AS type',
  182 + 'gl_project.status AS status',
  183 + 'gl_project.extend_type AS extend_type',
  184 + 'gl_project.uptime AS uptime',
  185 + 'gl_project.is_upgrade AS is_upgrade',
  186 + 'gl_project.created_at AS created_at',
  187 + 'gl_project.cooperate_date AS cooperate_date',
  188 + 'gl_project.site_status AS site_status',
  189 + 'gl_project_deploy_build.keyword_num AS key',
  190 + 'gl_project_deploy_build.service_duration AS day',
  191 + 'gl_project_deploy_build.is_comment AS is_comment',
  192 + 'gl_project_deploy_build.leader_mid AS leader_mid',
  193 + 'gl_project_deploy_build.manager_mid AS manager_mid',
  194 + 'gl_project_deploy_build.designer_mid AS designer_mid',
  195 + 'gl_project_deploy_build.tech_mid AS tech_mid',
  196 + 'gl_project_deploy_build.test_domain AS test_domain',
  197 + 'gl_project_deploy_build.plan AS plan',
  198 + 'gl_project_deploy_optimize.dept_id AS optimize_dept_id',
  199 + 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid',
  200 + 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid',
  201 + 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid',
  202 + 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid',
  203 + 'gl_project_deploy_optimize.tech_leader AS tech_leader',
  204 + 'gl_project_deploy_optimize.domain AS domain',
  205 + 'gl_project_deploy_optimize.api_no AS api_no',
  206 + ];
  207 + return $select;
  208 + }
  209 +
  210 + public function end_channel($channel){
  211 + $parts = explode("-", $channel);
  212 + return end($parts);
  213 + }
  214 +}
@@ -56,30 +56,44 @@ class UpdateRoute extends Command @@ -56,30 +56,44 @@ class UpdateRoute extends Command
56 * @time :2023/11/20 15:13 56 * @time :2023/11/20 15:13
57 */ 57 */
58 public function handle(){ 58 public function handle(){
59 - $recordModel = new ProcessRecords();  
60 - $lists = $recordModel->list();  
61 - foreach ($lists as $k => $v){  
62 - $date = $v['record'][0]['date'];  
63 - $recordModel->edit(['date'=>$date],['id'=>$v['id']]);  
64 - }  
65 -// $projectModel = new Project();  
66 -// $list = $projectModel->list(['delete_status'=>['=',0]]);  
67 -// $data = [];  
68 -// foreach ($list as $v){  
69 -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
70 -// ProjectServer::useProject($v['id']);  
71 -//// $this->getProduct();  
72 -//// $this->setProductKeyword();  
73 -//// $this->getBlog();  
74 -//// $this->setCustomRoute($v['id']);  
75 -// $this->editProductAlt();  
76 -//// $this->custom_to_blogs();  
77 -// DB::disconnect('custom_mysql');  
78 -// } 59 + $projectModel = new Project();
  60 + $list = $projectModel->list(['id'=>['=',2503]]);
  61 + $data = [];
  62 + foreach ($list as $v){
  63 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  64 + ProjectServer::useProject($v['id']);
  65 + $this->getProduct();
  66 +// $this->updateProduct();
  67 + DB::disconnect('custom_mysql');
  68 + }
79 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 69 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
80 } 70 }
81 71
82 /** 72 /**
  73 + * @remark :更新产品
  74 + * @name :updateProduct
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2024/11/11 13:59
  78 + */
  79 + public function updateProduct(){
  80 + $productModel = new Product();
  81 + $list = $productModel->list(['created_at'=>['like','2024-11-11%']],'id',['id']);
  82 + $productModel->edit(['category_id'=>',14,'],['created_at'=>['like','2024-11-11%']]);
  83 + $data = [];
  84 + foreach ($list as $k => $v){
  85 + $data[] = [
  86 + 'product_id'=>$v['id'],
  87 + 'cate_id'=>14,
  88 + 'created_at'=>date('Y-m-d H:i:s'),
  89 + 'updated_at'=>date('Y-m-d H:i:s')
  90 + ];
  91 + }
  92 + $relaModel = new CategoryRelated();
  93 + $relaModel->insert($data);
  94 + }
  95 +
  96 + /**
83 * @remark :同步擴展模塊數據到blogs 97 * @remark :同步擴展模塊數據到blogs
84 * @name :custom_to_blogs 98 * @name :custom_to_blogs
85 * @author :lyh 99 * @author :lyh
@@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; @@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api;
9 9
10 use App\Enums\Common\Code; 10 use App\Enums\Common\Code;
11 use App\Http\Logic\Bside\User\UserLoginLogic; 11 use App\Http\Logic\Bside\User\UserLoginLogic;
  12 +use App\Models\Blog\Blog;
12 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
  14 +use App\Models\News\News;
13 use App\Models\Product\Category; 15 use App\Models\Product\Category;
14 use App\Models\Product\CategoryRelated; 16 use App\Models\Product\CategoryRelated;
15 use App\Models\Product\Keyword; 17 use App\Models\Product\Keyword;
@@ -283,4 +285,54 @@ class PrivateController extends BaseController @@ -283,4 +285,54 @@ class PrivateController extends BaseController
283 } 285 }
284 return $this->success($projects); 286 return $this->success($projects);
285 } 287 }
  288 +
  289 + /**
  290 + * 获取有效时间内 新增有效URL
  291 + * 用于自动提交Google收录
  292 + * @param Request $request
  293 + * @return false|string
  294 + */
  295 + public function projectNewUrl(Request $request)
  296 + {
  297 + $domain = trim($request->input('domain'));
  298 + $domain_parse = parse_url($domain);
  299 + $domain = $domain_parse['host'] ?? $domain;
  300 + $date = trim($request->input('date'));
  301 +
  302 + if (empty($domain) || empty($date)) {
  303 + return $this->error('非法参数!');
  304 + }
  305 +
  306 + $project = Project::getProjectByDomain($domain);
  307 + if (empty($project)) {
  308 + return $this->error('未找到当前域名对应的项目!');
  309 + }
  310 +
  311 + ProjectServer::useProject($project->id);
  312 + $result = [];
  313 + // 查询有效时间后 有效的产品、新闻、博客、聚合页 链接
  314 + $product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route');
  315 + $news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
  316 + $blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
  317 + $keyword = Keyword::where('created_at', '>', $date)->pluck('route');
  318 +
  319 + // 组装链接
  320 + foreach ($product as $item) {
  321 + $url = 'https://' . $domain . '/' . $item;
  322 + array_push($result, $url);
  323 + }
  324 + foreach ($keyword as $item) {
  325 + $url = 'https://' . $domain . '/' . $item;
  326 + array_push($result, $url);
  327 + }
  328 + foreach ($news as $item) {
  329 + $url = 'https://' . $domain . '/news/' . $item;
  330 + array_push($result, $url);
  331 + }
  332 + foreach ($blog as $item) {
  333 + $url = 'https://' . $domain . '/blogs/' . $item;
  334 + array_push($result, $url);
  335 + }
  336 + return $this->success($result);
  337 + }
286 } 338 }
@@ -223,6 +223,9 @@ class OptimizeController extends BaseController @@ -223,6 +223,9 @@ class OptimizeController extends BaseController
223 if(isset($this->map['site_status'])){ 223 if(isset($this->map['site_status'])){
224 $query = $query->where('gl_project.site_status',$this->map['site_status']); 224 $query = $query->where('gl_project.site_status',$this->map['site_status']);
225 } 225 }
  226 + if(isset($this->map['main_lang_id'])){
  227 + $query = $query->where('gl_project.main_lang_id',$this->map['main_lang_id']);
  228 + }
226 if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ 229 if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){
227 $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); 230 $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']);
228 } 231 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AllProjectController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/12 9:34
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Project;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\Project\CountAllProject;
  15 +
  16 +/**
  17 + * @remark :统计所有项目(4.0,5.0,6.0)
  18 + * @name :AllProjectController
  19 + * @author :lyh
  20 + * @method :post
  21 + * @time :2024/11/12 9:34
  22 + */
  23 +class AllProjectController extends BaseController
  24 +{
  25 + /**
  26 + * @remark :统计所有项目列表
  27 + * @name :lists
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2024/11/12 9:35
  31 + */
  32 + public function lists(CountAllProject $allProject){
  33 + $data = $allProject->lists($this->map,$this->page,$this->row);
  34 + $this->response('success',Code::SUCCESS,$data);
  35 + }
  36 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :DetailController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/12 14:55
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Product;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\Product\DetailLogic;
  15 +use App\Models\Product\Column;
  16 +use App\Models\Product\Detail;
  17 +use Illuminate\Support\Facades\DB;
  18 +
  19 +class DetailController extends BaseController
  20 +{
  21 + /**
  22 + * @remark :获取当前产品的描述详情
  23 + * @name :getDetail
  24 + * @author :lyh
  25 + * @method :post
  26 + * @time :2024/11/13 9:53
  27 + */
  28 + public function getDetail(Detail $detail){
  29 + $this->request->validate([
  30 + 'product_id'=>'required',
  31 + 'column_id'=>'required'
  32 + ],[
  33 + 'product_id.required' => '产品id不能为空',
  34 + 'column_id.required' => '栏目id不能为空',
  35 + ]);
  36 + $data = $detail->list($this->map,'sort',['*'],'asc');
  37 + $this->response('success',Code::SUCCESS,$data);
  38 + }
  39 +
  40 + /**
  41 + * @remark :获取产品描述页所有详情
  42 + * @name :getType
  43 + * @author :lyh
  44 + * @method :post
  45 + * @time :2024/11/12 14:57
  46 + */
  47 + public function getType(Detail $detail){
  48 + $data = [
  49 + 'text_type' => $detail->text_type(),
  50 + 'line_two_type' => $detail->line_two_type(),
  51 + 'image_two_type' => $detail->image_two_type(),
  52 + 'three_type' => $detail->three_type(),
  53 + 'image_three_type' => $detail->image_three_type(),
  54 + ];
  55 + $this->response('success',Code::SUCCESS,$data);
  56 + }
  57 +
  58 + /**
  59 + * @remark :获取产品描述栏目
  60 + * @name :getColumn
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2024/11/12 15:07
  64 + */
  65 + public function getColumn(Column $column){
  66 + $data = $column->list($this->map,'id',['*'],'asc');
  67 + $this->response('success',Code::SUCCESS,$data);
  68 + }
  69 +
  70 + /**
  71 + * @remark :保存切换栏
  72 + * @name :saveColumn
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2024/11/12 15:13
  76 + */
  77 + public function saveColumn(DetailLogic $logic){
  78 + $this->request->validate([
  79 + 'column_name'=>'required'
  80 + ],[
  81 + 'column_name.required' => '栏目名称不能为空'
  82 + ]);
  83 + $data = $logic->saveColumn();
  84 + $this->response('success',Code::SUCCESS,$data);
  85 + }
  86 +
  87 + /**
  88 + * @remark :保存数据
  89 + * @name :saveDetail
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2024/11/12 16:24
  93 + */
  94 + public function saveDetail(DetailLogic $logic){
  95 + $this->request->validate([
  96 + 'product_id'=>'required',
  97 + 'data'=>'required',
  98 + ],[
  99 + 'product_id.required' => '产品id不能为空',
  100 + 'data.required' => 'data不能为空',
  101 + ]);
  102 + $data = $logic->saveDetail();
  103 + $this->response('success',Code::SUCCESS,$data);
  104 + }
  105 +
  106 + /**
  107 + * @remark :删除切换栏
  108 + * @name :delColumn
  109 + * @author :lyh
  110 + * @method :post
  111 + * @time :2024/11/13 10:40
  112 + */
  113 + public function delColumn(Column $column,Detail $detail){
  114 + $this->request->validate([
  115 + 'id'=>'required',
  116 + ],[
  117 + 'id.required' => 'id不能为空',
  118 + ]);
  119 + $info = $column->read($this->map);
  120 + if($info === false){
  121 + $this->fail('当前数据不存在或已被删除');
  122 + }
  123 + if($info['id'] == 1){
  124 + $this->fail('当前默认模块不允许删除');
  125 + }
  126 + DB::beginTransaction();
  127 + try {
  128 + $column->del(['id'=>$this->param['id']]);
  129 + $detail->del(['column_id'=>$info['id']]);
  130 + DB::commit();
  131 + }catch (\Exception $e){
  132 + DB::rollBack();
  133 + $this->fail('删除失败,请联系管理员');
  134 + }
  135 + $this->response('success');
  136 + }
  137 +
  138 + /***
  139 + * @remark :删除模块
  140 + * @name :delDetail
  141 + * @author :lyh
  142 + * @method :post
  143 + * @time :2024/11/13 10:24
  144 + */
  145 + public function delDetail(Detail $detail){
  146 + $this->request->validate([
  147 + 'id'=>'required',
  148 + ],[
  149 + 'id.required' => 'id不能为空',
  150 + ]);
  151 + $detail->del($this->map);
  152 + $this->response('success');
  153 + }
  154 +}
@@ -11,50 +11,159 @@ namespace App\Http\Controllers\Bside; @@ -11,50 +11,159 @@ namespace App\Http\Controllers\Bside;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Logic\Bside\News\NewsLogic; 13 use App\Http\Logic\Bside\News\NewsLogic;
  14 +use App\Models\Channel\Channel;
14 use App\Models\CustomModule\CustomModuleContent; 15 use App\Models\CustomModule\CustomModuleContent;
  16 +use App\Models\Domain\DomainInfo;
  17 +use App\Models\Manage\ManageHr;
  18 +use App\Models\Project\CountAllProject as AllProject;
  19 +use App\Models\Project\Project;
15 use App\Models\RouteMap\RouteMap; 20 use App\Models\RouteMap\RouteMap;
16 use App\Services\ProjectServer; 21 use App\Services\ProjectServer;
17 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
18 23
19 class TestController extends BaseController 24 class TestController extends BaseController
20 { 25 {
  26 + /**
  27 + * @remark :非6.0拉取数据
  28 + * @name :NoSixProject
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2024/11/11 14:51
  32 + */
21 public function ceshi(){ 33 public function ceshi(){
22 - $test = '';  
23 - $pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';  
24 - $matches = [];  
25 - preg_match_all($pattern, $test, $matches);  
26 - $updatedSources = $this->saveBase64Images($matches[1]);  
27 - foreach($updatedSources as $k => $v){  
28 - $test = str_replace($v, $k, $test); 34 + $data = $this->NoSixProject();
  35 + $this->response('success',Code::SUCCESS,$data);
  36 + }
  37 +
  38 + public function NoSixProject(){
  39 + $res_data = [];
  40 +// $i = 1;
  41 +// while (true){
  42 + $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=1&pagesize=1';
  43 + $result = http_get($url);
  44 + $data = $result['data'];
  45 +// if(empty($data)){
  46 +// break;
  47 +// }
  48 +// $res_data = array_merge($res_data,$data['data']);
  49 +// $i++;
  50 +// }
  51 + return $data;
  52 + }
  53 +
  54 + public function SixProject(){
  55 + $projectModel = new Project();
  56 + $query = $projectModel->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id')
  57 + ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
  58 + ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  59 + ->where('gl_project.delete_status',Project::TYPE_ZERO);
  60 + $lists = $query->paginate(100000, $this->selectParam(), 'page', 1)->toArray();
  61 + $manageModel = new ManageHr();
  62 + foreach ($lists as $k => $v){
  63 + $allProjectModel = new AllProject();
  64 + $info = $allProjectModel->read(['version'=>1,'project_id'=>$v['id']],['id']);
  65 + if($info === false){
  66 + $channel = Channel::getChannelText($v['channel']['user_id'] ?? 0);
  67 + $data[] = [
  68 + 'project_id'=>$v['id'],
  69 + 'version'=>1,//代表6.0
  70 + 'is_upgrade'=>$v['is_upgrade'],
  71 + 'title'=>$v['title'],
  72 + 'company'=>$v['company'],
  73 + 'channel'=>$channel,
  74 + 'sale'=>$this->end_channel($channel),
  75 + 'join_date'=>$v['cooperate_date'],
  76 + 'online_date'=>$v['uptime'],
  77 + 'keywords_num'=>$v['key'],
  78 + 'service_num'=>$v['day'],
  79 + 'production_num'=>intval(abs(strtotime((empty($v['uptime']) ? date('Y-m-d H:i:s') : $v['uptime'])) - $v['created_at']) / 86400),
  80 + 'plan'=>Project::planMap()[$v['plan']],
  81 + 'status'=>$v['status'],
  82 + 'test_domain'=>$v['test_domain'],
  83 + 'product_domain'=>!empty($v['domain']) ? (new DomainInfo())->getDomain($v['domain']) : '',
  84 + 'project_manager'=>$manageModel->getName($v['manager_mid'] ?? ''),
  85 + 'project_group'=>$manageModel->getName($v['leader_mid'] ?? ''),
  86 + 'project_design'=>$manageModel->getName($v['designer_mid'] ?? ''),
  87 + 'project_assistant'=>$manageModel->getName($v['tech_mid'] ?? ''),
  88 + 'service_manager'=>$manageModel->getName($v['optimize_manager_mid'] ??''),
  89 + 'service_optimize'=>$manageModel->getName($v['optimize_optimist_mid'] ??''),
  90 + 'service_assistant'=>$manageModel->getName($v['optimize_assist_mid'] ??''),
  91 + 'qa'=>$manageModel->getName($v['quality_mid'] ??''),
  92 + ];
  93 + $allProjectModel->add($data);
  94 + }else{
  95 + $data_edit = [
  96 + 'title'=>$v['title'],
  97 + 'company'=>$v['company'],
  98 + 'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0),
  99 + 'sale'=>$this->end_channel($channel),
  100 + 'join_date'=>$v['cooperate_date'],
  101 + 'online_date'=>$v['uptime'],
  102 + 'keywords_num'=>$v['key'],
  103 + 'service_num'=>$v['day'],
  104 + 'production_num'=>intval(abs(strtotime((empty($v['uptime']) ? date('Y-m-d H:i:s') : $v['uptime'])) - $v['created_at']) / 86400),
  105 + 'plan'=>Project::planMap()[$v['plan']],
  106 + 'status'=>$v['status'],
  107 + 'test_domain'=>$v['test_domain'],
  108 + 'product_domain'=>!empty($v['domain']) ? (new DomainInfo())->getDomain($v['domain']) : '',
  109 + 'project_manager'=>$manageModel->getName($v['manager_mid'] ?? ''),
  110 + 'project_group'=>$manageModel->getName($v['leader_mid'] ?? ''),
  111 + 'project_design'=>$manageModel->getName($v['designer_mid'] ?? ''),
  112 + 'project_assistant'=>$manageModel->getName($v['tech_mid'] ?? ''),
  113 + 'service_manager'=>$manageModel->getName($v['optimize_manager_mid'] ??''),
  114 + 'service_optimize'=>$manageModel->getName($v['optimize_optimist_mid'] ??''),
  115 + 'service_assistant'=>$manageModel->getName($v['optimize_assist_mid'] ??''),
  116 + 'qa'=>$manageModel->getName($v['quality_mid'] ??''),
  117 + ];
  118 + $allProjectModel->edit($data_edit,['id'=>$info['id']]);
  119 + }
  120 +
29 } 121 }
30 - $this->response('success',Code::SUCCESS,$test);  
31 } 122 }
32 123
33 /** 124 /**
34 - * @remark :解码图片  
35 - * @name :saveBase64Images  
36 - * @author :lyh  
37 - * @method :post  
38 - * @time :2024/11/7 16:52 125 + * 需要查询的字段
  126 + * @return array
39 */ 127 */
40 - public function saveBase64Images($imageSources) {  
41 - $updatedSources = [];  
42 - foreach ($imageSources as $src) {  
43 - // Check if src is a base64 image  
44 - if (preg_match('/^data:image\/(png|jpg|jpeg|gif);base64,/', $src, $match)) {  
45 - $imageType = $match[1]; // Image type (png, jpg, etc.)  
46 - $base64Data = preg_replace('/^data:image\/(png|jpg|jpeg|gif);base64,/', '', $src);  
47 - $decodedData = base64_decode($base64Data);  
48 - if ($decodedData === false) {  
49 - $updatedSources[] = $src; // If decoding fails, keep original src  
50 - continue;  
51 - }  
52 - $outputFile = 'images' . uniqid() . '.' . $imageType;  
53 - $imageUrl = 'http://your-domain.com/' . $outputFile;  
54 - $updatedSources[$imageUrl] = $src;  
55 - }  
56 - }  
57 - return $updatedSources;  
58 -} 128 + public function selectParam(){
  129 + $select = [
  130 + 'gl_project.id AS id',
  131 + 'gl_project.title AS title',
  132 + 'gl_project.channel AS channel',
  133 + 'gl_project.company AS company',
  134 + 'gl_project.type AS type',
  135 + 'gl_project.extend_type AS extend_type',
  136 + 'gl_project.uptime AS uptime',
  137 + 'gl_project.is_upgrade AS is_upgrade',
  138 + 'gl_project.created_at AS created_at',
  139 + 'gl_project.cooperate_date AS cooperate_date',
  140 + 'gl_project.site_status AS site_status',
  141 + 'gl_project_deploy_build.keyword_num AS key',
  142 + 'gl_project_deploy_build.service_duration AS day',
  143 + 'gl_project_deploy_build.is_comment AS is_comment',
  144 + 'gl_project_deploy_build.leader_mid AS leader_mid',
  145 + 'gl_project_deploy_build.manager_mid AS manager_mid',
  146 + 'gl_project_deploy_build.designer_mid AS designer_mid',
  147 + 'gl_project_deploy_build.tech_mid AS tech_mid',
  148 + 'gl_project_deploy_build.test_domain AS test_domain',
  149 + 'gl_project_deploy_build.plan AS plan',
  150 + 'gl_project_deploy_optimize.dept_id AS optimize_dept_id',
  151 + 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid',
  152 + 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid',
  153 + 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid',
  154 + 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid',
  155 + 'gl_project_deploy_optimize.tech_leader AS tech_leader',
  156 + 'gl_project_deploy_optimize.domain AS domain',
  157 + 'gl_project_deploy_optimize.api_no AS api_no',
  158 + ];
  159 + return $select;
  160 + }
59 161
  162 + public function end_channel($channel){
  163 + if(!empty($channel)){
  164 + $parts = explode("-", $channel);
  165 + return end($parts);
  166 + }
  167 + return $channel;
  168 + }
60 } 169 }
@@ -160,6 +160,9 @@ class FileController @@ -160,6 +160,9 @@ class FileController
160 $suffix = array_pop($nameArr) ?? 'jpg'; 160 $suffix = array_pop($nameArr) ?? 'jpg';
161 $nameStr = implode('-', $nameArr); 161 $nameStr = implode('-', $nameArr);
162 $enName = generateRoute(Translate::tran($nameStr, 'en')); 162 $enName = generateRoute(Translate::tran($nameStr, 'en'));
  163 + if(substr($enName, 0, 1) === '-'){
  164 + $enName = md5(uniqid().$project_id.rand(1,1000));
  165 + }
163 $fileName = $enName; 166 $fileName = $enName;
164 $i=1; 167 $i=1;
165 while($this->onlyName($enName.'.'.$suffix,$project_id)){ 168 while($this->onlyName($enName.'.'.$suffix,$project_id)){
@@ -229,9 +229,13 @@ class ImageController extends Controller @@ -229,9 +229,13 @@ class ImageController extends Controller
229 $nameArr = explode('.',$name); 229 $nameArr = explode('.',$name);
230 $suffix = array_pop($nameArr) ?? 'jpg'; 230 $suffix = array_pop($nameArr) ?? 'jpg';
231 $nameStr = implode('-', $nameArr); 231 $nameStr = implode('-', $nameArr);
232 - $enName = generateRoute(Translate::tran($nameStr, 'en')); 232 + $tran_name = Translate::tran($nameStr, 'en');
  233 + if(is_array($tran_name)){
  234 + $tran_name = $tran_name[0];
  235 + }
  236 + $enName = generateRoute($tran_name);
233 if(substr($enName, 0, 1) === '-'){ 237 if(substr($enName, 0, 1) === '-'){
234 - $enName = $nameStr; 238 + $enName = md5(uniqid().$project_id.rand(1,1000));;
235 } 239 }
236 $fileName = $enName; 240 $fileName = $enName;
237 $i=1; 241 $i=1;
@@ -209,6 +209,9 @@ class NewsLogic extends BaseLogic @@ -209,6 +209,9 @@ class NewsLogic extends BaseLogic
209 if(isset($param['related_news_id'])){ 209 if(isset($param['related_news_id'])){
210 $param['related_news_id'] = implode(',',$param['related_news_id']); 210 $param['related_news_id'] = implode(',',$param['related_news_id']);
211 } 211 }
  212 + if(isset($param['related_product_id'])){
  213 + $param['related_product_id'] = implode(',',$param['related_product_id']);
  214 + }
212 return $this->success($param); 215 return $this->success($param);
213 } 216 }
214 217
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :DetailLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/12 15:14
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\Product;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Product\Column;
  14 +use App\Models\Product\Detail;
  15 +
  16 +class DetailLogic extends BaseLogic
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 + $this->param = $this->requestAll;
  22 + $this->model = new Detail();
  23 + }
  24 +
  25 + /**
  26 + * @remark :保存栏目
  27 + * @name :saveColumn
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2024/11/12 15:15
  31 + */
  32 + public function saveColumn(){
  33 + $columnModel = new Column();
  34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $id = $this->param['id'];
  36 + $rs = $columnModel->edit(['column_name'=>$this->param['column_name']],['id'=>$this->param['id']]);
  37 + if($rs === false){
  38 + $this->fail('保存失败,请联系管理员');
  39 + }
  40 + }else{
  41 + $id = $columnModel->addReturnId($this->param);
  42 + }
  43 + return $this->success(['id'=>$id]);
  44 + }
  45 +
  46 + /**
  47 + * @remark :保存数据
  48 + * @name :saveDetail
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/11/13 9:30
  52 + */
  53 + public function saveDetail(){
  54 + try {
  55 + foreach ($this->param['data'] as $data){
  56 + foreach ($data as $v){
  57 + $save_data = [
  58 + 'sort'=>$v['sort'],
  59 + 'column_id'=>$v['column_id'],
  60 + 'product_id'=>$this->param['product_id'],
  61 + 'text_type'=>$v['text_type'],
  62 + 'title'=>$v['title'] ?? '',
  63 + 'content'=>json_encode($v['content'] ?? []),
  64 + 'css'=>json_encode($v['css'] ?? []),
  65 + ];
  66 + if(isset($v['id']) && !empty($v['id'])){
  67 + $this->edit($save_data,['id'=>$v['id']]);
  68 + }else{
  69 + $this->model->add($save_data);
  70 + }
  71 + }
  72 + }
  73 + }catch (\Exception $e){
  74 + $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage());
  75 + }
  76 + return $this->success(['product_id'=>$this->param['product_id']]);
  77 + }
  78 +}
@@ -560,7 +560,7 @@ class ProductLogic extends BaseLogic @@ -560,7 +560,7 @@ class ProductLogic extends BaseLogic
560 'related_product_id'=>Arr::arrToSet($info['related_product_id']), 560 'related_product_id'=>Arr::arrToSet($info['related_product_id']),
561 'sort'=>$info['sort'], 561 'sort'=>$info['sort'],
562 'status'=>0, 562 'status'=>0,
563 - 'route'=>$info['route'], 563 + 'route'=>$info['title'],
564 'product_type'=>$info['product_type'], 564 'product_type'=>$info['product_type'],
565 'created_uid'=>$this->user['id'], 565 'created_uid'=>$this->user['id'],
566 'created_at'=>date('Y-m-d H:i:s'), 566 'created_at'=>date('Y-m-d H:i:s'),
@@ -277,6 +277,7 @@ class UserLoginLogic @@ -277,6 +277,7 @@ class UserLoginLogic
277 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0; 277 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
278 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0; 278 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;
279 $info['remain_day'] = $project['remain_day'] ?? 0; 279 $info['remain_day'] = $project['remain_day'] ?? 0;
  280 + $info['type'] = $project['type'] ?? 1;
280 if($info['is_customized'] == 1){ 281 if($info['is_customized'] == 1){
281 $info['is_visualization'] = json_decode($project['is_visualization']); 282 $info['is_visualization'] = json_decode($project['is_visualization']);
282 } 283 }
@@ -20,7 +20,6 @@ class Blog extends Base @@ -20,7 +20,6 @@ class Blog extends Base
20 if(!$value){ 20 if(!$value){
21 return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); 21 return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
22 } 22 }
23 -  
24 return $value; 23 return $value;
25 } 24 }
26 } 25 }
@@ -7,7 +7,10 @@ @@ -7,7 +7,10 @@
7 */ 7 */
8 namespace App\Models\Inquiry; 8 namespace App\Models\Inquiry;
9 9
  10 +use App\Helper\Translate;
10 use Illuminate\Database\Eloquent\Model; 11 use Illuminate\Database\Eloquent\Model;
  12 +use Illuminate\Support\Facades\Cache;
  13 +use Illuminate\Support\Facades\DB;
11 14
12 /** 15 /**
13 * 广告询盘表单内容 16 * 广告询盘表单内容
@@ -62,6 +65,10 @@ class ReInquiryForm extends Model @@ -62,6 +65,10 @@ class ReInquiryForm extends Model
62 */ 65 */
63 public static function createInquiry($id, $origin_id, $ad_set_id, $ad_set_name, $ad_id, $ad_name, $full_name, $email, $phone, $whatsapp, $message, $country, $inquiry_date) 66 public static function createInquiry($id, $origin_id, $ad_set_id, $ad_set_name, $ad_id, $ad_name, $full_name, $email, $phone, $whatsapp, $message, $country, $inquiry_date)
64 { 67 {
  68 + if($country){
  69 + $country_name = self::getCountryName($country);
  70 + }
  71 +
65 $self = self::where(['id' => $id])->first(); 72 $self = self::where(['id' => $id])->first();
66 if (empty($self)) { 73 if (empty($self)) {
67 $self = new self(); 74 $self = new self();
@@ -80,8 +87,29 @@ class ReInquiryForm extends Model @@ -80,8 +87,29 @@ class ReInquiryForm extends Model
80 $self->message = $message; 87 $self->message = $message;
81 $self->inquiry_date = $inquiry_date; 88 $self->inquiry_date = $inquiry_date;
82 $self->country = $country; 89 $self->country = $country;
  90 + $self->country_name = $country_name??'';
83 $self->save(); 91 $self->save();
84 return $self; 92 return $self;
85 } 93 }
86 94
  95 +
  96 + public static function getCountryName($country){
  97 + if (strlen($country) == 2) {
  98 + $country = self::getCountry($country);
  99 + } else {
  100 + $country = Translate::tran($country, 'zh');
  101 + }
  102 + return $country;
  103 + }
  104 +
  105 + public static function getCountry($code)
  106 + {
  107 + $cache_key = 'inquiry_world_country';
  108 + $country_code = Cache::get($cache_key, function () use ($cache_key) {
  109 + $country_code = DB::table('gl_world_country_city')->where(['pid' => 0])->pluck('chinese_name', 'iso2')->toArray();
  110 + Cache::put($cache_key, $country_code, 86400);
  111 + return $country_code;
  112 + });
  113 + return empty($country_code[$code]) ? '' : $country_code[$code];
  114 + }
87 } 115 }
@@ -28,4 +28,8 @@ class News extends Base @@ -28,4 +28,8 @@ class News extends Base
28 public function getRelatedNewsIdAttribute($value){ 28 public function getRelatedNewsIdAttribute($value){
29 return Arr::setToArr($value); 29 return Arr::setToArr($value);
30 } 30 }
  31 +
  32 + public function getRelatedProductIdAttribute($value){
  33 + return Arr::setToArr($value);
  34 + }
31 } 35 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Column.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/12 14:14
  8 + */
  9 +
  10 +namespace App\Models\Product;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class Column extends Base
  15 +{
  16 + //设置关联表名
  17 + protected $table = 'gl_product_column';
  18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
  20 +
  21 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Detail.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/12 14:13
  8 + */
  9 +
  10 +namespace App\Models\Product;
  11 +
  12 +use App\Helper\Arr;
  13 +use App\Models\Base;
  14 +
  15 +class Detail extends Base
  16 +{
  17 + //设置关联表名
  18 + protected $table = 'gl_product_detail';
  19 + //连接数据库
  20 + protected $connection = 'custom_mysql';
  21 +
  22 + public function getCssAttribute($value){
  23 + return Arr::s2a($value);
  24 + }
  25 +
  26 + public function getContentAttribute($value){
  27 + return Arr::s2a($value);
  28 + }
  29 + /**
  30 + * @remark :文本框类型
  31 + * @name :text_box
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2024/11/12 14:15
  35 + */
  36 + public function text_type(){
  37 + return [
  38 + 1=>'富文本框',
  39 + 2=>'多图模块',
  40 + 3=>'单图文案',
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * @remark :多图框类型
  46 + * @name :line_number
  47 + * @author :lyh
  48 + * @method :post
  49 + * @time :2024/11/12 14:15
  50 + */
  51 + public function line_two_type(){
  52 + return [
  53 + 1=>'1行',
  54 + 2=>'2行',
  55 + 3=>'3行',
  56 + 4=>'4行',
  57 + 5=>'5行',
  58 + ];
  59 + }
  60 +
  61 + /**
  62 + * @remark :图片框类型
  63 + * @name :line_number
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2024/11/12 14:15
  67 + */
  68 + public function image_two_type(){
  69 + return [
  70 + 1=>'1张图',
  71 + 2=>'2张图',
  72 + 3=>'3张图',
  73 + 4=>'4张图',
  74 + 5=>'5张图',
  75 + ];
  76 + }
  77 +
  78 + /**
  79 + * @remark :图片文本框类型
  80 + * @name :line_number
  81 + * @author :lyh
  82 + * @method :post
  83 + * @time :2024/11/12 14:15
  84 + */
  85 + public function three_type(){
  86 + return [
  87 + 1=>'左图右文',
  88 + 2=>'右图左文',
  89 + ];
  90 + }
  91 +
  92 + /**
  93 + * @remark :图片文本框类型
  94 + * @name :line_number
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2024/11/12 14:15
  98 + */
  99 + public function image_three_type(){
  100 + return [
  101 + 1=>'图片悬浮',
  102 + 2=>'图片固定',
  103 + ];
  104 + }
  105 +
  106 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CountAllProject.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/11 10:36
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class CountAllProject extends Base
  15 +{
  16 + protected $table = 'gl_all_project';
  17 +}
@@ -56,10 +56,12 @@ class MessagePush extends Base @@ -56,10 +56,12 @@ class MessagePush extends Base
56 return false; 56 return false;
57 } 57 }
58 58
  59 + //特殊处理, 要求任何时候收到询盘都要及时推送到群里面
  60 + $special_project_ids = [650];
59 //9-21 点,每条消息及时通知 61 //9-21 点,每条消息及时通知
60 //21-第二天 9 点,整合一起通知 62 //21-第二天 9 点,整合一起通知
61 $hour = date('H', strtotime($submit_at)); 63 $hour = date('H', strtotime($submit_at));
62 - if($hour >= 9 && $hour < 21) { 64 + if(($hour >= 9 && $hour < 21) || in_array($project_id, $special_project_ids)) {
63 $model = new self(); 65 $model = new self();
64 $model->project_id = $project_id; 66 $model->project_id = $project_id;
65 $model->friend_id = $friend_id; 67 $model->friend_id = $friend_id;
@@ -136,6 +136,8 @@ class ProjectServer @@ -136,6 +136,8 @@ class ProjectServer
136 self::init404Page($project_id); 136 self::init404Page($project_id);
137 //初始化模块数据 137 //初始化模块数据
138 self::initModule($project_id); 138 self::initModule($project_id);
  139 + //初始化切换栏
  140 + self::initColumn();
139 //初始化search页面 141 //初始化search页面
140 // self::initSearchPage($project_id); 142 // self::initSearchPage($project_id);
141 DB::disconnect('custom_mysql'); 143 DB::disconnect('custom_mysql');
@@ -163,6 +165,27 @@ class ProjectServer @@ -163,6 +165,27 @@ class ProjectServer
163 } 165 }
164 return true; 166 return true;
165 } 167 }
  168 +
  169 + /**
  170 + * @remark :初始化产品切换栏
  171 + * @name :initColumn
  172 + * @author :lyh
  173 + * @method :post
  174 + * @time :2024/11/12 11:39
  175 + */
  176 + public static function initColumn(){
  177 + $info = DB::connection('custom_mysql')->table('gl_product_column')->first();
  178 + if(empty($info)){
  179 + $data = [
  180 + 'column_name'=>'Product Details',
  181 + 'created_at' => date('Y-m-d H:i:s'),
  182 + 'updated_at' => date('Y-m-d H:i:s')
  183 + ];
  184 + DB::connection('custom_mysql')->table('gl_product_column')->insert($data);
  185 + }
  186 + return true;
  187 + }
  188 +
166 /** 189 /**
167 * @remark :菜单 190 * @remark :菜单
168 * @name :initGroup 191 * @name :initGroup
@@ -39,6 +39,9 @@ Route::any('valid_user', [\App\Http\Controllers\Api\PrivateController::class, 'v @@ -39,6 +39,9 @@ Route::any('valid_user', [\App\Http\Controllers\Api\PrivateController::class, 'v
39 Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, 'getAutoToken'])->name('api.getAutoToken'); 39 Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, 'getAutoToken'])->name('api.getAutoToken');
40 // 特殊项目 有效产品路由 40 // 特殊项目 有效产品路由
41 Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route'); 41 Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route');
  42 +// 6.0项目新增有效链接 - 提交Google
  43 +Route::any('project_new_url', [\App\Http\Controllers\Api\PrivateController::class, 'projectNewUrl'])->name('api.project_new_url');
  44 +
42 45
43 // --------------------- 站群服务 ------------------------------------------ 46 // --------------------- 站群服务 ------------------------------------------
44 // 获取项目信息 47 // 获取项目信息
@@ -493,6 +493,12 @@ Route::middleware(['aloginauth'])->group(function () { @@ -493,6 +493,12 @@ Route::middleware(['aloginauth'])->group(function () {
493 Route::any('/fb_relay_detail_list', [Aside\Task\AdsController::class, 'fbRelayDetail'])->name('admin.fb_ads_relay_detail_list'); 493 Route::any('/fb_relay_detail_list', [Aside\Task\AdsController::class, 'fbRelayDetail'])->name('admin.fb_ads_relay_detail_list');
494 Route::any('/fb_relay_count', [Aside\Task\AdsController::class, 'fbRelayCount'])->name('admin.fb_relay_count'); 494 Route::any('/fb_relay_count', [Aside\Task\AdsController::class, 'fbRelayCount'])->name('admin.fb_relay_count');
495 }); 495 });
  496 +
  497 + //统计所有项目相关
  498 + Route::prefix('all_project')->group(function () {
  499 + Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists');
  500 + });
  501 +
496 }); 502 });
497 503
498 //无需登录验证的路由组 504 //无需登录验证的路由组
@@ -300,6 +300,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -300,6 +300,14 @@ Route::middleware(['bloginauth'])->group(function () {
300 Route::any('extend/save', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'save'])->name('product_extend_save'); 300 Route::any('extend/save', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'save'])->name('product_extend_save');
301 Route::any('extend/del', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'del'])->name('product_extend_del'); 301 Route::any('extend/del', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'del'])->name('product_extend_del');
302 Route::any('extend/search_filed', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'search_filed'])->name('product_extend_search_filed'); 302 Route::any('extend/search_filed', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'search_filed'])->name('product_extend_search_filed');
  303 + //产品描述
  304 + Route::any('detail/getColumn', [\App\Http\Controllers\Bside\Product\DetailController::class, 'getColumn'])->name('product_detail_getColumn');
  305 + Route::any('detail/getDetail', [\App\Http\Controllers\Bside\Product\DetailController::class, 'getDetail'])->name('product_detail_getDetail');
  306 + Route::any('detail/getType', [\App\Http\Controllers\Bside\Product\DetailController::class, 'getType'])->name('product_detail_getType');
  307 + Route::any('detail/saveColumn', [\App\Http\Controllers\Bside\Product\DetailController::class, 'saveColumn'])->name('product_detail_saveColumn');
  308 + Route::any('detail/saveDetail', [\App\Http\Controllers\Bside\Product\DetailController::class, 'saveDetail'])->name('product_detail_saveDetail');
  309 + Route::any('detail/delDetail', [\App\Http\Controllers\Bside\Product\DetailController::class, 'delDetail'])->name('product_detail_delDetail');
  310 + Route::any('detail/delColumn', [\App\Http\Controllers\Bside\Product\DetailController::class, 'delColumn'])->name('product_detail_delColumn');
303 }); 311 });
304 312
305 313