作者 赵彬吉
... ... @@ -85,7 +85,7 @@ class TemplateLog extends Command
* @time :2024/11/13 16:19
*/
public function deleteUserLog(){
$date = date('Y-m-d H:i:s', strtotime('-60 days'));
$date = date('Y-m-d H:i:s', strtotime('-90 days'));
$userLogModel = new UserLog();
return $userLogModel->del(['created_at'=>['<=',$date]]);
}
... ...
... ... @@ -42,7 +42,7 @@ class PrivateController extends BaseController
public function optimizeProjectList(Request $request)
{
$page_size = $request->input('page_size', 20);
$field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain'];
$field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special'];
$result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
... ...
... ... @@ -208,6 +208,7 @@ class CNoticeController extends BaseController
* 更新通知C端
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @param : type : 1->主站更新 4->聚合页更新
*/
public function sendNotify(Request $request)
{
... ... @@ -217,6 +218,13 @@ class CNoticeController extends BaseController
$url = $request->input('url', []);
$language = $request->input('language', []);
$is_sitemap = intval($request->input('is_sitemap', 0));
if($type == 4){//代表聚合页更新
$keywordModel = new Keyword();
$keywordInfo = $keywordModel->whereNull('seo_title')->orWhereNull('seo_keywords')->orWhereNull('seo_description')->first();
if(!empty($keywordInfo)){
$this->fail('TDK不全,禁止提交。');
}
}
//获取项目所在服务器
$project_model = new Project();
$project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']);
... ... @@ -239,7 +247,6 @@ class CNoticeController extends BaseController
$this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面');
}
}
if($servers_id == ServerConfig::SELF_SITE_ID){
//自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
$domain_model = new DomainInfo();
... ...
... ... @@ -159,8 +159,11 @@ class FileController
$nameArr = explode('.',$name);
$suffix = array_pop($nameArr) ?? 'jpg';
$nameStr = implode('-', $nameArr);
$enName = generateRoute(Translate::tran($nameStr, 'en'));
if(substr($enName, 0, 1) === '-'){
//为空时,重试三次
$enName = retry(3, function () use ($nameStr) {
return generateRoute(Translate::tran($nameStr, 'en'));
}, 100); // 100 毫秒后重试
if(empty($enName)){
$enName = md5(uniqid().$project_id.rand(1,1000));
}
$fileName = $enName;
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask;
use App\Models\Domain\DomainInfo;
use App\Models\Domain\DomainRedirectTask;
use App\Models\Project\CountryCustom;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
class DomainInfoLogic extends BaseLogic
... ... @@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic
}
if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
$this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]);
$this->fail('自建站服务器无生成站点');
$this->fail('自建站服务器无生成站点');
}
//域名是否都已经解析
if(!check_domain_record($info['domain'], $serversIpInfo)){
... ... @@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic
}
}
//小语种为二级目录的站点,强制跳转https
$is_https = 0;
$buildModel = new DeployBuild();
$build_info = $buildModel->read(['project_id' => $info['project_id']], ['linking_format']);
if ($build_info && $build_info['linking_format'] == 1) {
$is_https = 1;
}
//保存301跳转数据+其他域名
$data = [
'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])),
... ... @@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic
'type'=>$this->param['type'],
'private_key' => $this->param['key'] ?? '',
'private_cert' => $this->param['cert'] ?? '',
'is_https' => $this->param['is_https'] ?? 0,
'is_https' => $is_https,
'amp_status' => $this->param['amp_status'] ?? 0,
'amp_type' => $this->param['amp_type'] ?? 0,
'amp_extend_config'=>json_encode($amp_extend_config),
... ...
... ... @@ -146,16 +146,12 @@ class KeywordLogic extends BaseLogic
* @time :2024/10/28 10:47
*/
public function first_word($title){
$first_title = mb_substr($title, 0, 1);
//返回对应的键
$keywordModel = new Keyword();
$firstNumWord = $keywordModel->firstNumWord;
foreach($firstNumWord as $k => $v){
if(strtolower($v) == strtolower($first_title)){
return $k;
$first_title = mb_substr(strtolower($title), 0, 1);
if (is_numeric($first_title)){
return 0;
}
}
return 27;
$string_key = array_search($first_title, $this->model->firstNumWord);
return $string_key ?: 27;
}
/**
... ... @@ -171,7 +167,6 @@ class KeywordLogic extends BaseLogic
if(empty($v)){
continue;
}
$this->model = new Keyword();
$info = $this->model->read(['title'=>$v],['id']);
if($info === false){
$param['project_id'] = $this->user['project_id'];
... ...
... ... @@ -120,7 +120,8 @@ class Project extends Base
13 => 'AI站群',
14 => '未达标',
15 => 'AI案例',
16 => '6.0广告'
16 => '6.0广告',
17 => '超哥监控项目',
];
}
... ...