作者 zhl

推送v5项目域名到期提醒

... ... @@ -36,12 +36,11 @@ class DomainInfo extends Command
*/
protected $description = '域名相关';
private $domains = [];
/**
* @remark :更新证书+证书有效时间
* @name :handle
* @author :lyh
* @method :post
* @time :2023/9/11 15:09
* 更新证书+证书有效时间
* @return bool
*/
public function handle()
{
... ... @@ -57,6 +56,9 @@ class DomainInfo extends Command
//创建的自定义小语种域名证书到期更新
$this->startUpdateCustomCert();
// 推送v5项目域名到期信息
$this->domainChatMessageV5();
return true;
}
... ... @@ -413,6 +415,7 @@ class DomainInfo extends Command
->value('friend_id');
if ($friend_id) {
$top_domain = getTopDomain($domain);
$this->domains[] = $top_domain;
$tips = $is_end ? ' 已经到期,请及时处理。' : ' 有效期不足一个月,请留意。';
$message = '【域名到期提醒】' . PHP_EOL . '域名 ' . $top_domain . $tips;
$param = [
... ... @@ -429,4 +432,46 @@ class DomainInfo extends Command
$messagePushModel->add($param);
}
}
/**
* 推送v5 项目域名到期时间
* @return bool
*/
public function domainChatMessageV5()
{
$domain_json = @file_get_contents('https://www.quanqiusou.cn/extend_api/aicc/domain_expire_lists.php');
$domains = json_decode($domain_json, true);
if (empty($domains))
return true;
$send_domain = $this->domains;
$today = date('Y-m-d');
$messagePushModel = new MessagePush();
foreach ($domains as $item) {
if (empty($item['domain']) || empty($item['friend_id'])) {
continue;
}
// 避免重复推送域名到期提示
if (in_array($item['domain'], $send_domain)) {
continue;
} else {
array_push($send_domain, $item['domain']);
}
$tips = $item['end_at'] >= $today ? ' 有效期不足一个月,请留意。' : ' 已经到期,请及时处理。';
$message = '【域名到期提醒】' . PHP_EOL . '域名 ' . $item['domain'] . $tips;
$param = [
'project_id' => $item['project_id'],
'friend_id' => $item['friend_id'],
'type' => MessagePush::TYPE_DOMAIN_V5,
'content' => $message,
'ref_ids' => 0,
'send_time' => date('Y-m-d 15:00:00'),
'status' => 0,
];
//写入一条推送消息 自动消费
$messagePushModel->add($param);
}
return true;
}
}
... ...
... ... @@ -29,6 +29,7 @@ class MessagePush extends Base
const TYPE_WEEK = 'week';
const TYPE_TICKET = 'Ticket';
const TYPE_DOMAIN = 'domain';
const TYPE_DOMAIN_V5 = 'domain_v5';
//设置关联表名
/**
* @var mixed
... ...