作者 赵彬吉
... ... @@ -139,9 +139,9 @@ class DomainInfo extends Command
$serverIpModel = new ServersIp();
$domainCreateTaskModel = new DomainCreateTask();
$end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
$list = $domainModel->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray();
$list = $domainModel->where('status', '=', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray();
foreach ($list as $v) {
$project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']);
$project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']);
if (!$project_info) {
continue;
}
... ... @@ -161,14 +161,20 @@ class DomainInfo extends Command
continue;
}
if ($project_info['project_type'] == Project::PROJECT_TYPE_SEO) {
$type = DomainCreateTask::TYPE_BLOG;
} else {
$type = DomainCreateTask::TYPE_MAIN;
}
//创建更新站点证书任务
$task_info = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_MAIN, 'domain_id' => $v['id'], 'status' => ['<', DomainCreateTask::STATUS_SUC]]);
$task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $v['id'], 'status' => ['<', DomainCreateTask::STATUS_SUC]]);
if (!$task_info) {
$domainCreateTaskModel->add([
'server_id' => $servers_ip_info['servers_id'],
'project_id' => $v['project_id'],
'domain_id' => $v['id'],
'type' => DomainCreateTask::TYPE_MAIN
'type' => $type
]);
}
}
... ... @@ -186,7 +192,7 @@ class DomainInfo extends Command
$serverIpModel = new ServersIp();
$domainCreateTaskModel = new DomainCreateTask();
$end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
$list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray();
$list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '=', 1)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray();
foreach ($list as $v) {
$domain_array = parse_url($v['domain']);
$host = $domain_array['host'] ?? $domain_array['path'];
... ... @@ -243,7 +249,7 @@ class DomainInfo extends Command
$serverIpModel = new ServersIp();
$domainCreateTaskModel = new DomainCreateTask();
$end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
$list = $customModel->where('status', 1)->where('is_create', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray();
$list = $customModel->where('status', 1)->where('is_create', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray();
foreach ($list as $v) {
$project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']);
if (!$project_info) {
... ...
... ... @@ -67,10 +67,14 @@ class SendKeyword extends Command
$send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000];
$ban_domain = $this->banDomain();
foreach ($projects as $item) {
if (empty($item->is_auto_keywords))
if (empty($item->is_auto_keywords)) {
$this->output('项目ID:' . $item->id . ', 未开启推送配置;');
continue;
if (in_array($item->domain, $ban_domain))
}
if (in_array($item->domain, $ban_domain)) {
$this->output('项目ID:' . $item->id . ', 域名被禁用;');
continue;
}
if (empty($item->api_no)) {
$this->output('项目ID:' . $item->id . ', api_no为空;');
continue;
... ... @@ -89,11 +93,15 @@ class SendKeyword extends Command
// 项目是否达标
$compliance = RankData::where(['project_id' => $item->id, 'api_no' => $item->api_no, 'lang' => ''])->value('is_compliance');
if (FALSE == empty($compliance))
return false;
if (FALSE == empty($compliance)) {
$this->output('项目ID:' . $item->id . ', 项目已达标,不需要推送;');
continue;
}
$project = ProjectServer::useProject($item->id);
if (empty($project)) {
$this->output('项目ID:' . $item->id . ', 项目链接失败;');
DB::disconnect('custom_mysql');
continue;
}
... ... @@ -109,6 +117,7 @@ class SendKeyword extends Command
$item['apino'] = $item['api_no'];
$this->sendNotice($item);
}
$this->output('项目ID:' . $item['id'] . ', ' . ($send ? '推送完成' : '无推送关键词;'));
}
return true;
}
... ...
... ... @@ -162,18 +162,16 @@ class RecommendedSuppliers extends Command
$res = http_post($url,json_encode($param));
echo '请求返回状态'. ($res['code']?? '').PHP_EOL;
// echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL;
if(isset($res['code']) && $res['code'] == 200){
//保存多条数据
$saveData = [
'project_id'=>$project_id,
'keyword'=>$keyword,
'data'=>json_encode($res['data'])
'data'=>json_encode($res['data'] ?? [])
];
$purchaserModel = new Purchaser();
$purchaserModel->add($saveData);
if(!empty($res['data'])){
if(isset($res['code']) && $res['code'] == 200 && !empty($res['data'])){
$this->savePurchaserInfo($project_id,$keyword,$res['data']);
}
}else{
echo '未正常返回数据,跳过项目'.PHP_EOL;
}
... ... @@ -190,7 +188,7 @@ class RecommendedSuppliers extends Command
public function getKeywords($project_id){
$keywordModel = new Keyword();
$keyword_array = $this->getPurchaserList($project_id);
$title = $keywordModel->where('title', 'not in', $keyword_array)->orderRaw('RAND()')->limit(1)->value('title'); // 只返回 title 字段
$title = $keywordModel->whereNotIn('title', $keyword_array)->inRandomOrder()->limit(1)->value('title');
if(empty($title)){
return '';
}
... ... @@ -207,6 +205,9 @@ class RecommendedSuppliers extends Command
public function savePurchaserInfo($project_id,$keyword,$data){
$purchaserInfoModel = new PurchaserInfo();
foreach ($data as $k =>$v){
if(empty($v['buyer_id'])){
continue;
}
$v['project_id'] = $project_id;
$v['keyword'] = $keyword;
$v['email'] = json_encode($v['email']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
... ...
... ... @@ -44,6 +44,20 @@ class CheckListController extends BaseController
}
/**
* @remark :获取分页检查清单数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/4/17 9:31
*/
public function list(){
$this->map['status'] = 1;
$field = ['id','status','sort','text','created_at'];
$data = $this->model->list($this->map,'id',$field);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
... ... @@ -68,6 +82,7 @@ class CheckListController extends BaseController
* @time :2025/4/17 9:32
*/
public function save(){
$this->param['operator_id'] = $this->manage['id'];
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
... ...
... ... @@ -321,6 +321,9 @@ class NewsController extends BaseController
'keyword.required' => 'keyword不能为空',
]);
$data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true);
if(isset($data['data']['p'][0]) && !empty($data['data']['p'][0])){
$data['data']['p'][0] = str_replace('&nbsp' ,' ',$data['data']['p'][0]);
}
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -212,7 +212,7 @@ class DomainInfoLogic extends BaseLogic
$ssl_records = dns_get_record($ssl_domain,DNS_CNAME);
$ssl_target = $ssl_records[0]['target']??'';
if($ssl_target != '_acme-challenge.globalsosslcheck.com'){
$this->fail('域名' . $ssl_domain . '未解析至目标服务器');
$this->fail('缺少通配符证书必要的解析记录:'.$ssl_domain);
}
}
... ...
... ... @@ -309,7 +309,8 @@ Route::middleware(['aloginauth'])->group(function () {
//检查列表
Route::prefix('check_list')->group(function () {
Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_list');
Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
Route::any('/list', [Aside\Optimize\CheckListController::class, 'list'])->name('admin.check_list');
Route::any('/info', [Aside\Optimize\CheckListController::class, 'info'])->name('admin.check_list_info');
Route::any('/save', [Aside\Optimize\CheckListController::class, 'save'])->name('admin.check_list_save');
Route::any('/del', [Aside\Optimize\CheckListController::class, 'del'])->name('admin.check_list_del');
... ...