作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server

@@ -81,69 +81,86 @@ class DomainInfo extends Command @@ -81,69 +81,86 @@ class DomainInfo extends Command
81 continue; 81 continue;
82 } 82 }
83 83
84 - //除自建站项目外,记录已解析到别的ip的域名  
85 - if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {  
86 - //过滤已解析到别的ip的域名 84 + if ($servers_ip_info['servers_id'] == ServerConfig::SELF_SITE_ID) {
  85 + //自建站项目,直接获取主站证书有效期并更新
  86 + $ssl_time = $this->getDomainSslTime($v['domain']);
  87 + if ($ssl_time['from'] && $ssl_time['to']) {
  88 + $v->certificate_start_time = $ssl_time['from'];
  89 + $v->certificate_end_time = $ssl_time['to'];
  90 + $v->save();
  91 + }
  92 +
  93 + if (empty($v['domain_end_time']) || $v['domain_end_time'] < date('Y-m-d H:i:s')) {
  94 + //获取主站域名有效期并更新
  95 + $valid_time = $this->getDomainValidTime($v['domain']);
  96 + if ($valid_time['start'] && $valid_time['end']) {
  97 + $v->domain_start_time = $valid_time['start'];
  98 + $v->domain_end_time = $valid_time['end'];
  99 + $v->save();
  100 + }
  101 + }
  102 + } else {
  103 + //除自建站项目外,记录已解析到别的ip的域名
87 if (!check_domain_record($v['domain'], $servers_ip_info)) { 104 if (!check_domain_record($v['domain'], $servers_ip_info)) {
88 Log::channel('analyze_other')->error('域名 [' . $v['domain'] . '] 已解析到别的IP'); 105 Log::channel('analyze_other')->error('域名 [' . $v['domain'] . '] 已解析到别的IP');
89 continue; 106 continue;
90 } 107 }
91 - }  
92 108
93 - //判断是否已经建站  
94 - if ($project_info['project_type'] == Project::PROJECT_TYPE_SEO) {  
95 - $type = DomainCreateTask::TYPE_BLOG;  
96 - } else {  
97 - $type = DomainCreateTask::TYPE_MAIN;  
98 - }  
99 - $task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $v['id'], 'status' => DomainCreateTask::STATUS_SUC], ['id']);  
100 - if (!$task_info) {  
101 - continue;  
102 - }  
103 -  
104 - //获取主站证书有效期并更新  
105 - $ssl_time = $this->getDomainSslTime($v['domain']);  
106 - if ($ssl_time['from'] && $ssl_time['to']) {  
107 - $v->certificate_start_time = $ssl_time['from'];  
108 - $v->certificate_end_time = $ssl_time['to'];  
109 - $v->save();  
110 - } 109 + //判断是否已经建站
  110 + if ($project_info['project_type'] == Project::PROJECT_TYPE_SEO) {
  111 + $type = DomainCreateTask::TYPE_BLOG;
  112 + } else {
  113 + $type = DomainCreateTask::TYPE_MAIN;
  114 + }
  115 + $task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $v['id'], 'status' => DomainCreateTask::STATUS_SUC], ['id']);
  116 + if (!$task_info) {
  117 + continue;
  118 + }
111 119
112 - if (empty($v['domain_end_time']) || $v['domain_end_time'] < date('Y-m-d H:i:s')) {  
113 - //获取主站域名有效期并更新  
114 - $valid_time = $this->getDomainValidTime($v['domain']);  
115 - if ($valid_time['start'] && $valid_time['end']) {  
116 - $v->domain_start_time = $valid_time['start'];  
117 - $v->domain_end_time = $valid_time['end']; 120 + //获取主站证书有效期并更新
  121 + $ssl_time = $this->getDomainSslTime($v['domain']);
  122 + if ($ssl_time['from'] && $ssl_time['to']) {
  123 + $v->certificate_start_time = $ssl_time['from'];
  124 + $v->certificate_end_time = $ssl_time['to'];
118 $v->save(); 125 $v->save();
119 } 126 }
120 - }  
121 127
122 - if ($v['amp_status'] == 1) {  
123 - $domain_array = parse_url($v['domain']);  
124 - $host = $domain_array['host'] ?? $domain_array['path'];  
125 - $host_array = explode('.', $host);  
126 - if (count($host_array) <= 2) {  
127 - array_unshift($host_array, 'm');  
128 - } else {  
129 - $host_array[0] = 'm'; 128 + if (empty($v['domain_end_time']) || $v['domain_end_time'] < date('Y-m-d H:i:s')) {
  129 + //获取主站域名有效期并更新
  130 + $valid_time = $this->getDomainValidTime($v['domain']);
  131 + if ($valid_time['start'] && $valid_time['end']) {
  132 + $v->domain_start_time = $valid_time['start'];
  133 + $v->domain_end_time = $valid_time['end'];
  134 + $v->save();
  135 + }
130 } 136 }
131 - $amp_domain = implode('.', $host_array);  
132 137
133 - if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {  
134 - //过滤已解析到别的ip的AMP域名  
135 - if (!check_domain_record($amp_domain, $servers_ip_info)) {  
136 - Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP');  
137 - continue; 138 + if ($v['amp_status'] == 1) {
  139 + $domain_array = parse_url($v['domain']);
  140 + $host = $domain_array['host'] ?? $domain_array['path'];
  141 + $host_array = explode('.', $host);
  142 + if (count($host_array) <= 2) {
  143 + array_unshift($host_array, 'm');
  144 + } else {
  145 + $host_array[0] = 'm';
  146 + }
  147 + $amp_domain = implode('.', $host_array);
  148 +
  149 + if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {
  150 + //过滤已解析到别的ip的AMP域名
  151 + if (!check_domain_record($amp_domain, $servers_ip_info)) {
  152 + Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP');
  153 + continue;
  154 + }
138 } 155 }
139 - }  
140 156
141 - //获取AMP站证书有效期并更新  
142 - $amp_ssl_time = $this->getDomainSslTime($amp_domain);  
143 - if ($amp_ssl_time['from'] && $amp_ssl_time['to']) {  
144 - $v->amp_certificate_start_time = $amp_ssl_time['from'];  
145 - $v->amp_certificate_end_time = $amp_ssl_time['to'];  
146 - $v->save(); 157 + //获取AMP站证书有效期并更新
  158 + $amp_ssl_time = $this->getDomainSslTime($amp_domain);
  159 + if ($amp_ssl_time['from'] && $amp_ssl_time['to']) {
  160 + $v->amp_certificate_start_time = $amp_ssl_time['from'];
  161 + $v->amp_certificate_end_time = $amp_ssl_time['to'];
  162 + $v->save();
  163 + }
147 } 164 }
148 } 165 }
149 } 166 }
@@ -717,7 +717,7 @@ class RelayInquiry extends Command @@ -717,7 +717,7 @@ class RelayInquiry extends Command
717 $project = Project::getProjectByDomain($domain); 717 $project = Project::getProjectByDomain($domain);
718 if (empty($project)) { 718 if (empty($project)) {
719 $this->logChannel()->info('广告任务ID:' . $task['id'] . ', 转发对象:' . $re_website . '非v6链接,转发失败;', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]); 719 $this->logChannel()->info('广告任务ID:' . $task['id'] . ', 转发对象:' . $re_website . '非v6链接,转发失败;', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]);
720 - return [[], $lang]; 720 + return [[], $lang, ''];
721 } 721 }
722 $lang = WebLanguage::getLangById($project->main_lang_id ?? 1)['short']; 722 $lang = WebLanguage::getLangById($project->main_lang_id ?? 1)['short'];
723 723
@@ -46,16 +46,17 @@ class RankDataLog extends BaseCommands @@ -46,16 +46,17 @@ class RankDataLog extends BaseCommands
46 { 46 {
47 while (true) { 47 while (true) {
48 $log_id = Redis::rpop('rank_data_task'); 48 $log_id = Redis::rpop('rank_data_task');
49 - echo $log_id . PHP_EOL; 49 +
50 if (!$log_id) { 50 if (!$log_id) {
51 - sleep(10);  
52 - continue; 51 + $log = RankDataLogModel::where('status', 0)->first();
  52 + }else{
  53 + $log = RankDataLogModel::where('id', $log_id)->where('status', 0)->first();
53 } 54 }
54 -  
55 - $log = RankDataLogModel::where('id', $log_id)->where('status', 0)->first();  
56 if(!$log){ 55 if(!$log){
  56 + sleep(10);
57 continue; 57 continue;
58 } 58 }
  59 +
59 try { 60 try {
60 $this->output('项目开始:ID'.$log->project_id . ',APINO' . $log->api_no); 61 $this->output('项目开始:ID'.$log->project_id . ',APINO' . $log->api_no);
61 $project = Project::find($log->project_id); 62 $project = Project::find($log->project_id);
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Tdk; @@ -5,6 +5,7 @@ namespace App\Console\Commands\Tdk;
5 use App\Exceptions\ValidateException; 5 use App\Exceptions\ValidateException;
6 use App\Helper\Arr; 6 use App\Helper\Arr;
7 use App\Helper\Gpt; 7 use App\Helper\Gpt;
  8 +use App\Helper\Translate;
8 use App\Models\Ai\AiCommand; 9 use App\Models\Ai\AiCommand;
9 use App\Models\Com\NoticeLog; 10 use App\Models\Com\NoticeLog;
10 use App\Models\Com\UpdateNotify; 11 use App\Models\Com\UpdateNotify;
@@ -14,6 +15,7 @@ use App\Models\Project\AggregateKeywordAffix; @@ -14,6 +15,7 @@ use App\Models\Project\AggregateKeywordAffix;
14 use App\Models\Project\DeployBuild; 15 use App\Models\Project\DeployBuild;
15 use App\Models\Project\DeployOptimize; 16 use App\Models\Project\DeployOptimize;
16 use App\Models\Project\ProjectKeywordAiTask; 17 use App\Models\Project\ProjectKeywordAiTask;
  18 +use App\Models\WebSetting\WebLanguage;
17 use App\Services\ProjectServer; 19 use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
19 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
@@ -51,6 +53,8 @@ class KeywordPageAiContent extends Command @@ -51,6 +53,8 @@ class KeywordPageAiContent extends Command
51 '折线图', 53 '折线图',
52 ]; 54 ];
53 55
  56 + protected $project;
  57 +
54 /** 58 /**
55 * @return bool 59 * @return bool
56 */ 60 */
@@ -66,7 +70,7 @@ class KeywordPageAiContent extends Command @@ -66,7 +70,7 @@ class KeywordPageAiContent extends Command
66 70
67 echo getmypid() . ' ' . date('Y-m-d H:i:s') . ' start project_id: ' . $project_id . PHP_EOL; 71 echo getmypid() . ' ' . date('Y-m-d H:i:s') . ' start project_id: ' . $project_id . PHP_EOL;
68 try { 72 try {
69 - ProjectServer::useProject($project_id); 73 + $this->project = ProjectServer::useProject($project_id);
70 74
71 $update_rows = $this->ai_content($task); 75 $update_rows = $this->ai_content($task);
72 76
@@ -109,6 +113,10 @@ class KeywordPageAiContent extends Command @@ -109,6 +113,10 @@ class KeywordPageAiContent extends Command
109 $prefix = empty($affix['prefix']) ? explode("\n", $default_affix['prefix']) : explode("\n", $affix['prefix']); 113 $prefix = empty($affix['prefix']) ? explode("\n", $default_affix['prefix']) : explode("\n", $affix['prefix']);
110 $suffix = empty($affix['suffix']) ? explode("\n", $default_affix['suffix']) : explode("\n", $affix['suffix']); 114 $suffix = empty($affix['suffix']) ? explode("\n", $default_affix['suffix']) : explode("\n", $affix['suffix']);
111 115
  116 + $lang = WebLanguage::getLangById($this->project['main_lang_id']??1);
  117 + $prefix = Translate::tran($prefix, $lang['short']);
  118 + $suffix = Translate::tran($suffix, $lang['short']);
  119 +
112 if (!$prefix || !$suffix) { 120 if (!$prefix || !$suffix) {
113 throw new ValidateException('扩展标题前后缀不存在'); 121 throw new ValidateException('扩展标题前后缀不存在');
114 } 122 }
@@ -193,8 +201,8 @@ class KeywordPageAiContent extends Command @@ -193,8 +201,8 @@ class KeywordPageAiContent extends Command
193 //打乱顺序 201 //打乱顺序
194 shuffle($prefix); 202 shuffle($prefix);
195 shuffle($suffix); 203 shuffle($suffix);
196 - //标题(title):{聚合页扩展标题前缀} keywords {聚合页扩展标题后缀} {聚合页扩展标题后缀}  
197 204
  205 + //标题(title):{聚合页扩展标题前缀} keywords {聚合页扩展标题后缀} {聚合页扩展标题后缀}
198 return sprintf('%s %s %s %s', $prefix[0], $title, $suffix[0], $suffix[1]); 206 return sprintf('%s %s %s %s', $prefix[0], $title, $suffix[0], $suffix[1]);
199 } 207 }
200 208
@@ -211,6 +219,11 @@ class KeywordPageAiContent extends Command @@ -211,6 +219,11 @@ class KeywordPageAiContent extends Command
211 shuffle($this->chart_types); 219 shuffle($this->chart_types);
212 $prompt = str_replace('{chart_type}', $this->chart_types[0], $prompt); 220 $prompt = str_replace('{chart_type}', $this->chart_types[0], $prompt);
213 } 221 }
  222 + if (strpos($prompt, '{lang}') !== false) {
  223 + $lang = WebLanguage::getLangById($this->project['main_lang_id']??1);
  224 + $lang = $lang['english'] ?? 'English';
  225 + $prompt = str_replace('{lang}', $lang, $prompt);
  226 + }
214 227
215 $text = Gpt::instance()->openai_chat_qqs($prompt); 228 $text = Gpt::instance()->openai_chat_qqs($prompt);
216 if (!$text) { 229 if (!$text) {
@@ -243,7 +256,7 @@ class KeywordPageAiContent extends Command @@ -243,7 +256,7 @@ class KeywordPageAiContent extends Command
243 foreach ($body->childNodes as $child) { 256 foreach ($body->childNodes as $child) {
244 $modifiedHtml .= $dom->saveHTML($child); 257 $modifiedHtml .= $dom->saveHTML($child);
245 } 258 }
246 - return $modifiedHtml; 259 + return html_entity_decode($modifiedHtml, ENT_QUOTES | ENT_HTML5, 'UTF-8');
247 } 260 }
248 261
249 public function sendNotify($project_id) 262 public function sendNotify($project_id)
@@ -25,7 +25,7 @@ class AsideTicketController extends BaseController @@ -25,7 +25,7 @@ class AsideTicketController extends BaseController
25 public function index(AsideTicketListRequest $request) 25 public function index(AsideTicketListRequest $request)
26 { 26 {
27 $validated = $request->validated(); 27 $validated = $request->validated();
28 - $lists = Tickets::with([ 28 + $query = Tickets::with([
29 'logs.engineer', 29 'logs.engineer',
30 'project.pm', 30 'project.pm',
31 'project.projectV6', 31 'project.projectV6',
@@ -66,9 +66,15 @@ class AsideTicketController extends BaseController @@ -66,9 +66,15 @@ class AsideTicketController extends BaseController
66 ->orWhere('company_name', 'like', '%' . $search . '%'); 66 ->orWhere('company_name', 'like', '%' . $search . '%');
67 }); 67 });
68 }); 68 });
69 - })  
70 - ->orderBy('id', 'desc')  
71 - ->paginate($this->row, ['*'], 'page', $this->page); 69 + });
  70 +
  71 + // 添加排序功能
  72 + $sortField = $request->input('sort_field', 'plan_end_at');
  73 + $sortOrder = strtolower($request->input('sort_order', 'asc'));
  74 + $query->orderBy($sortField, $sortOrder);
  75 + // 添加次要排序:按状态升序排列
  76 + $query->orderBy('status', 'asc');
  77 + $lists = $query->paginate($this->row, ['*'], 'page', $this->page);
72 $this->response('success', Code::SUCCESS, $lists); 78 $this->response('success', Code::SUCCESS, $lists);
73 } 79 }
74 80
@@ -95,6 +95,8 @@ class AsideTicketLogController extends BaseController @@ -95,6 +95,8 @@ class AsideTicketLogController extends BaseController
95 if ($project->wechat_switch && !$ticket->close_wechat) 95 if ($project->wechat_switch && !$ticket->close_wechat)
96 $project->pushWechatGroupMsg("工单(ID:{$ticket->id})已全部完成,请访问查看详情!"); 96 $project->pushWechatGroupMsg("工单(ID:{$ticket->id})已全部完成,请访问查看详情!");
97 $ticket->pushDing('finish'); 97 $ticket->pushDing('finish');
  98 + }else{
  99 + $ticket->status = Tickets::STATUS_YANSHOU;
98 } 100 }
99 } 101 }
100 $ticket->save(); 102 $ticket->save();
@@ -24,7 +24,7 @@ class TicketListRequest extends FormRequest @@ -24,7 +24,7 @@ class TicketListRequest extends FormRequest
24 public function rules() 24 public function rules()
25 { 25 {
26 return [ 26 return [
27 - 'status' => 'nullable|in:0,1,2,3|integer', 27 + 'status' => 'nullable|in:0,1,2,3,9|integer',
28 'search' => 'nullable|string', // 搜索关键词 28 'search' => 'nullable|string', // 搜索关键词
29 'page' => 'nullable|integer', 29 'page' => 'nullable|integer',
30 'size' => 'nullable|integer', 30 'size' => 'nullable|integer',
@@ -25,12 +25,14 @@ class AsideTicketListRequest extends FormRequest @@ -25,12 +25,14 @@ class AsideTicketListRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'project_id' => 'nullable|string', 27 'project_id' => 'nullable|string',
28 - 'status' => 'nullable|in:0,1,2,3|integer', 28 + 'status' => 'nullable|in:0,1,2,3,9|integer',
29 'star' => 'nullable|in:1,2,3|integer', 29 'star' => 'nullable|in:1,2,3|integer',
30 'search' => 'nullable|string', // 搜索关键词 30 'search' => 'nullable|string', // 搜索关键词
31 'engineer_id' => 'nullable|integer', // 工程师ID 31 'engineer_id' => 'nullable|integer', // 工程师ID
32 'page' => 'nullable|integer', 32 'page' => 'nullable|integer',
33 'size' => 'nullable|integer', 33 'size' => 'nullable|integer',
  34 + 'sort_field' => 'nullable|in:created_at,plan_end_at',
  35 + 'sort_order' => 'nullable|in:asc,desc',
34 ]; 36 ];
35 } 37 }
36 } 38 }
@@ -27,7 +27,7 @@ class AsideTicketUpdateRequest extends FormRequest @@ -27,7 +27,7 @@ class AsideTicketUpdateRequest extends FormRequest
27 'title' => 'nullable|string', 27 'title' => 'nullable|string',
28 'content' => 'nullable|string', 28 'content' => 'nullable|string',
29 'files' => 'nullable|array', 29 'files' => 'nullable|array',
30 - 'status' => 'nullable|in:0,1,2,3|integer', 30 + 'status' => 'nullable|in:0,1,2,3,9|integer',
31 'engineer_ids' => 'nullable|array', 31 'engineer_ids' => 'nullable|array',
32 'star' => 'nullable|in:1,2,3|integer', 32 'star' => 'nullable|in:1,2,3|integer',
33 'plan_end_at' => 'nullable|date', 33 'plan_end_at' => 'nullable|date',
@@ -15,8 +15,9 @@ class Tickets extends Base @@ -15,8 +15,9 @@ class Tickets extends Base
15 15
16 const STATUS_PEDDING = 0; // 待处理 16 const STATUS_PEDDING = 0; // 待处理
17 const STATUS_PROCESSING = 1; // 处理中 17 const STATUS_PROCESSING = 1; // 处理中
18 - const STATUS_COMPLETED = 2; // 已完成  
19 - const STATUS_CLOSED = 3; // 已关闭,已失效 18 + const STATUS_YANSHOU = 2; // 验收中
  19 + const STATUS_COMPLETED = 3; // 已完成
  20 + const STATUS_CLOSED = 9; // 已关闭,已失效,审核不通过,结束工单设置大一点,方便中途又要加状态
20 21
21 /** 22 /**
22 * @return void 23 * @return void