作者 赵彬吉
@@ -85,7 +85,7 @@ class TemplateLog extends Command @@ -85,7 +85,7 @@ class TemplateLog extends Command
85 * @time :2024/11/13 16:19 85 * @time :2024/11/13 16:19
86 */ 86 */
87 public function deleteUserLog(){ 87 public function deleteUserLog(){
88 - $date = date('Y-m-d H:i:s', strtotime('-60 days')); 88 + $date = date('Y-m-d H:i:s', strtotime('-90 days'));
89 $userLogModel = new UserLog(); 89 $userLogModel = new UserLog();
90 return $userLogModel->del(['created_at'=>['<=',$date]]); 90 return $userLogModel->del(['created_at'=>['<=',$date]]);
91 } 91 }
@@ -42,7 +42,7 @@ class PrivateController extends BaseController @@ -42,7 +42,7 @@ class PrivateController extends BaseController
42 public function optimizeProjectList(Request $request) 42 public function optimizeProjectList(Request $request)
43 { 43 {
44 $page_size = $request->input('page_size', 20); 44 $page_size = $request->input('page_size', 20);
45 - $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain']; 45 + $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special'];
46 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') 46 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
47 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') 47 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
48 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 48 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
@@ -208,6 +208,7 @@ class CNoticeController extends BaseController @@ -208,6 +208,7 @@ class CNoticeController extends BaseController
208 * 更新通知C端 208 * 更新通知C端
209 * @param Request $request 209 * @param Request $request
210 * @return \Illuminate\Http\JsonResponse 210 * @return \Illuminate\Http\JsonResponse
  211 + * @param : type : 1->主站更新 4->聚合页更新
211 */ 212 */
212 public function sendNotify(Request $request) 213 public function sendNotify(Request $request)
213 { 214 {
@@ -217,6 +218,13 @@ class CNoticeController extends BaseController @@ -217,6 +218,13 @@ class CNoticeController extends BaseController
217 $url = $request->input('url', []); 218 $url = $request->input('url', []);
218 $language = $request->input('language', []); 219 $language = $request->input('language', []);
219 $is_sitemap = intval($request->input('is_sitemap', 0)); 220 $is_sitemap = intval($request->input('is_sitemap', 0));
  221 + if($type == 4){//代表聚合页更新
  222 + $keywordModel = new Keyword();
  223 + $keywordInfo = $keywordModel->whereNull('seo_title')->orWhereNull('seo_keywords')->orWhereNull('seo_description')->first();
  224 + if(!empty($keywordInfo)){
  225 + $this->fail('TDK不全,禁止提交。');
  226 + }
  227 + }
220 //获取项目所在服务器 228 //获取项目所在服务器
221 $project_model = new Project(); 229 $project_model = new Project();
222 $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']); 230 $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']);
@@ -239,7 +247,6 @@ class CNoticeController extends BaseController @@ -239,7 +247,6 @@ class CNoticeController extends BaseController
239 $this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面'); 247 $this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面');
240 } 248 }
241 } 249 }
242 -  
243 if($servers_id == ServerConfig::SELF_SITE_ID){ 250 if($servers_id == ServerConfig::SELF_SITE_ID){
244 //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 251 //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
245 $domain_model = new DomainInfo(); 252 $domain_model = new DomainInfo();
@@ -159,8 +159,11 @@ class FileController @@ -159,8 +159,11 @@ class FileController
159 $nameArr = explode('.',$name); 159 $nameArr = explode('.',$name);
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'));  
163 - if(substr($enName, 0, 1) === '-'){ 162 + //为空时,重试三次
  163 + $enName = retry(3, function () use ($nameStr) {
  164 + return generateRoute(Translate::tran($nameStr, 'en'));
  165 + }, 100); // 100 毫秒后重试
  166 + if(empty($enName)){
164 $enName = md5(uniqid().$project_id.rand(1,1000)); 167 $enName = md5(uniqid().$project_id.rand(1,1000));
165 } 168 }
166 $fileName = $enName; 169 $fileName = $enName;
@@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask; @@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Domain\DomainRedirectTask; 10 use App\Models\Domain\DomainRedirectTask;
11 use App\Models\Project\CountryCustom; 11 use App\Models\Project\CountryCustom;
  12 +use App\Models\Project\DeployBuild;
12 use App\Models\Project\Project; 13 use App\Models\Project\Project;
13 14
14 class DomainInfoLogic extends BaseLogic 15 class DomainInfoLogic extends BaseLogic
@@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic @@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic
169 } 170 }
170 if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ 171 if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
171 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]); 172 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]);
172 - $this->fail('自建站服务器无生成站点'); 173 + $this->fail('自建站服务器无生成站点');
173 } 174 }
174 //域名是否都已经解析 175 //域名是否都已经解析
175 if(!check_domain_record($info['domain'], $serversIpInfo)){ 176 if(!check_domain_record($info['domain'], $serversIpInfo)){
@@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic @@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic
242 } 243 }
243 } 244 }
244 245
  246 + //小语种为二级目录的站点,强制跳转https
  247 + $is_https = 0;
  248 + $buildModel = new DeployBuild();
  249 + $build_info = $buildModel->read(['project_id' => $info['project_id']], ['linking_format']);
  250 + if ($build_info && $build_info['linking_format'] == 1) {
  251 + $is_https = 1;
  252 + }
  253 +
245 //保存301跳转数据+其他域名 254 //保存301跳转数据+其他域名
246 $data = [ 255 $data = [
247 'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])), 256 'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])),
@@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic @@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic
249 'type'=>$this->param['type'], 258 'type'=>$this->param['type'],
250 'private_key' => $this->param['key'] ?? '', 259 'private_key' => $this->param['key'] ?? '',
251 'private_cert' => $this->param['cert'] ?? '', 260 'private_cert' => $this->param['cert'] ?? '',
252 - 'is_https' => $this->param['is_https'] ?? 0, 261 + 'is_https' => $is_https,
253 'amp_status' => $this->param['amp_status'] ?? 0, 262 'amp_status' => $this->param['amp_status'] ?? 0,
254 'amp_type' => $this->param['amp_type'] ?? 0, 263 'amp_type' => $this->param['amp_type'] ?? 0,
255 'amp_extend_config'=>json_encode($amp_extend_config), 264 'amp_extend_config'=>json_encode($amp_extend_config),
@@ -146,16 +146,12 @@ class KeywordLogic extends BaseLogic @@ -146,16 +146,12 @@ class KeywordLogic extends BaseLogic
146 * @time :2024/10/28 10:47 146 * @time :2024/10/28 10:47
147 */ 147 */
148 public function first_word($title){ 148 public function first_word($title){
149 - $first_title = mb_substr($title, 0, 1);  
150 - //返回对应的键  
151 - $keywordModel = new Keyword();  
152 - $firstNumWord = $keywordModel->firstNumWord;  
153 - foreach($firstNumWord as $k => $v){  
154 - if(strtolower($v) == strtolower($first_title)){  
155 - return $k;  
156 - } 149 + $first_title = mb_substr(strtolower($title), 0, 1);
  150 + if (is_numeric($first_title)){
  151 + return 0;
157 } 152 }
158 - return 27; 153 + $string_key = array_search($first_title, $this->model->firstNumWord);
  154 + return $string_key ?: 27;
159 } 155 }
160 156
161 /** 157 /**
@@ -171,7 +167,6 @@ class KeywordLogic extends BaseLogic @@ -171,7 +167,6 @@ class KeywordLogic extends BaseLogic
171 if(empty($v)){ 167 if(empty($v)){
172 continue; 168 continue;
173 } 169 }
174 - $this->model = new Keyword();  
175 $info = $this->model->read(['title'=>$v],['id']); 170 $info = $this->model->read(['title'=>$v],['id']);
176 if($info === false){ 171 if($info === false){
177 $param['project_id'] = $this->user['project_id']; 172 $param['project_id'] = $this->user['project_id'];
@@ -120,7 +120,8 @@ class Project extends Base @@ -120,7 +120,8 @@ class Project extends Base
120 13 => 'AI站群', 120 13 => 'AI站群',
121 14 => '未达标', 121 14 => '未达标',
122 15 => 'AI案例', 122 15 => 'AI案例',
123 - 16 => '6.0广告' 123 + 16 => '6.0广告',
  124 + 17 => '超哥监控项目',
124 ]; 125 ];
125 } 126 }
126 127