作者 刘锟

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

... ... @@ -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;
... ...
... ... @@ -120,7 +120,8 @@ class Project extends Base
13 => 'AI站群',
14 => '未达标',
15 => 'AI案例',
16 => '6.0广告'
16 => '6.0广告',
17 => '超哥监控项目',
];
}
... ...
... ... @@ -53,7 +53,7 @@ class SyncSubmitTaskService
//特殊处理
if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){
return false;
throw new InquiryFilterException( '黑名单邮箱');
}
//过滤url参数 清除全部参数
... ... @@ -69,8 +69,9 @@ class SyncSubmitTaskService
if ($data['country'] == '约旦' && empty($data['data']['referrer_url'])) {
$url_array = parse_url($data['data']['url']);
$path_array = explode('/', $url_array['path']);
if (FALSE == empty($path_array[1]) && strlen($path_array[1]) <= 3)
return false;
if (FALSE == empty($path_array[1]) && strlen($path_array[1]) <= 3){
throw new InquiryFilterException( '过滤被刷访问');
}
}
}
... ... @@ -79,18 +80,18 @@ class SyncSubmitTaskService
if(!empty($domain_info['not_allow_country'])){
$not_allow_countries = CountryCode::whereIn('id', $domain_info['not_allow_country'])->pluck('c_name')->toArray();
if(in_array($data['country'], $not_allow_countries)){
return false;
throw new InquiryFilterException( '过滤国家');
}
}
if(!empty($domain_info['not_allow_ip'])){
if(in_array($data['ip'], $domain_info['not_allow_ip'])){
return false;
throw new InquiryFilterException( '过滤ip');
}
}
$time = time();
if(!ProjectServer::useProject($project['id'])){
return false;
throw new InquiryFilterException( '项目不存在或数据库配置异常');
}
echo date('Y-m-d H:i:s') . ' | useProject time:' . (time() - $time) . PHP_EOL;
... ... @@ -108,7 +109,7 @@ class SyncSubmitTaskService
}
$filed == 'email' && $action = 'subscribe';
}
$handler = new self();
return $handler->$action($data, $date, $task['id'], $task['traffic']);
}
... ... @@ -204,7 +205,7 @@ class SyncSubmitTaskService
}
if(Cache::get($ip_lock_cache_key)){
Log::channel('inquiry')->info($task_id . '询盘ip重复锁定', [$data]);
return true;
throw new InquiryFilterException( 'ip半小时内重复询盘');
}
//数组key转为小写
... ...