作者 周海龙

合并分支 'zhl' 到 'master'

添加@功能,推送关键词加规则



查看合并请求 !1900
... ... @@ -9,6 +9,7 @@ namespace App\Console\Commands\Monitor;
use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Project\DeployOptimize;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Repositories\ToolRepository;
... ... @@ -259,9 +260,29 @@ class Supervisory extends Command
file_put_contents(storage_path('data/robots/' . date('Ymd'). 'log.json'), json_encode($tmp, 256));
unset($tmp);
// 所有路由
$domain = array_column($spot_projects, 'domain');
$domain = array_unique(array_filter($domain));
// 通知对应优化师
$tmp = [];
foreach ($spot_projects as $item) {
$tmp[$item['domain']] = $item['project_id'];
}
$project_ids = array_column($spot_projects, 'project_id');
$optimist = DeployOptimize::leftJoin('gl_manage', 'gl_project_deploy_optimize.optimist_mid', '=', 'gl_manage.id')
->whereIn('project_id', $project_ids)
->pluck('mobile', 'project_id')
->toArray();
$notice = [];
$all_url = array_merge($error_url, $error, $page_404, $tdk_error);
foreach ($all_url as $url) {
if (FALSE == empty($optimist[$tmp[parse_url($url, PHP_URL_HOST)]]))
$notice[] = '86' . $optimist[$tmp[parse_url($url, PHP_URL_HOST)]];
}
$notice = array_filter(array_unique($notice));
$message[] = '开启robots项目数:' . count($robots_ids);
$message[] = '关闭robots项目:' . ($close_ids ? implode(',', $close_ids) : '无');
$message[] = '抽查项目数量: ' . count($domain);
... ... @@ -282,6 +303,7 @@ class Supervisory extends Command
'keyword' => '项目数据推送',
'msg' => $msg,
'isAtAll' => false, // 是否@所有人
'atMobiles' => $notice
];
$dingService->handle($body, $link);
}
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class Keyword extends Base
{
... ... @@ -136,6 +137,18 @@ class Keyword extends Base
foreach ($suffix_array as $suffix) {
array_push($result, trim($keyword . $suffix));
array_push($result, trim($prefix . $keyword . $suffix));
// 复数形式, 需要将单数的词也拼接上
if (Str::contains($suffix, ['Products', 'Exporters', 'Suppliers', 'Manufacturers'])) {
$suffix = trim($suffix, 's');
array_push($result, trim($keyword . $suffix));
array_push($result, trim($prefix . $keyword . $suffix));
}
if (Str::contains($suffix, [ 'Companies', 'Factories'])) {
$suffix = trim($suffix, 'ies');
array_push($result, trim($keyword . $suffix . 'y'));
array_push($result, trim($prefix . $keyword . $suffix . 'y'));
}
}
} catch (\Exception $e) {
continue;
... ...
... ... @@ -39,7 +39,7 @@ class DingService
'content' => $body['keyword'] . PHP_EOL . $body['msg']
],
'at' => [
'atMobiles' => [],
'atMobiles' => $body['atMobiles'],
'atUserIds' => [],
'isAtAll' => $body['isAtAll'],
]
... ...