作者 zhl

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

... ... @@ -9,9 +9,14 @@
namespace App\Console\Commands\Ai;
use App\Helper\Arr;
use App\Models\Com\Notify;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\ServersIp;
use App\Models\Domain\DomainInfo;
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
use App\Models\Project\Project;
use App\Services\AiBlogService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
... ... @@ -105,18 +110,53 @@ class AiBlogAuthorId extends Command
* @time :2025/5/26 16:21
*/
public function sendCPost($project_id){
$domainModel = new DomainInfo();
$domain = $domainModel->getProjectIdDomain($project_id);
$c_url = $domain.'api/update_page/';
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 3,
'url' => $this->route,
'language'=> [],
'is_sitemap' => 0
];
$res = http_post($c_url, json_encode($param,true));
echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
//获取项目所在服务器
$project_model = new Project();
$project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']);
if(!$project_info){
return false;
}
$serve_ip_model = new ServersIp();
$serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']);
$servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0;
if($servers_id == ServerConfig::SELF_SITE_ID){
//自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
$domain_model = new DomainInfo();
$domain_info = $domain_model->read(['project_id'=>$this->user['project_id']],['domain']);
if($domain_info){
//判断是否已有更新进行中
$notify_model = new Notify();
$data = [
'project_id' => $project_id,
'type' => 1,
'route' => 3,
'server_id' => ServerConfig::SELF_SITE_ID,
'status' => ['!=',Notify::STATUS_FINISH_SITEMAP]
];
$notify = $notify_model->read($data,['id']);
if(!$notify){
$domain = $domain_info['domain'];
$data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$this->route,'language'=>[]]);
$data['status'] = Notify::STATUS_INIT;
$data['is_pull_html_zip'] = Notify::IS_PULL_HTML_ZIP_FALSE;
$data['sort'] = 1;
$notify_model->add($data);
}
}
}else{
$domainModel = new DomainInfo();
$domain = $domainModel->getProjectIdDomain($project_id);
$c_url = $domain.'api/update_page/';
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 3,
'url' => $this->route,
'language'=> [],
'is_sitemap' => 0
];
$res = http_post($c_url, json_encode($param,true));
echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
}
}
... ...
... ... @@ -100,13 +100,13 @@ class DomainInfo extends Command
$v->domain_start_time = $valid_time['start'];
$v->domain_end_time = $valid_time['end'];
$v->save();
}
}
//域名到期提醒
if ($v->domain_end_time && $v->domain_end_time < $end_day) {
$is_end = $v->domain_end_time < date('Y-m-d H:i:s') ? 1 : 0;
$this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
//域名到期提醒
if ($valid_time['end'] < $end_day) {
$is_end = $valid_time['end'] < date('Y-m-d H:i:s') ? 1 : 0;
$this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
}
}
}
} else {
//除自建站项目外,记录已解析到别的ip的域名
... ... @@ -141,13 +141,13 @@ class DomainInfo extends Command
$v->domain_start_time = $valid_time['start'];
$v->domain_end_time = $valid_time['end'];
$v->save();
}
}
//域名到期提醒
if ($v->domain_end_time && $v->domain_end_time < $end_day) {
$is_end = $v->domain_end_time < date('Y-m-d H:i:s') ? 1 : 0;
$this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
//域名到期提醒
if ($valid_time['end'] < $end_day) {
$is_end = $valid_time['end'] < date('Y-m-d H:i:s') ? 1 : 0;
$this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
}
}
}
if ($v['amp_status'] == 1) {
... ... @@ -412,8 +412,9 @@ class DomainInfo extends Command
->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
->value('friend_id');
if ($friend_id) {
$tips = $is_end ? ' 已经到期' : ' 即将到期';
$message = '【域名到期提醒】' . PHP_EOL . '域名 ' . $domain . $tips . ',请及时处理。';
$top_domain = getTopDomain($domain);
$tips = $is_end ? ' 已经到期,请及时处理。' : ' 有效期不足一个月,请留意。';
$message = '【域名到期提醒】' . PHP_EOL . '域名 ' . $top_domain . $tips;
$param = [
'project_id' => $project_id,
'friend_id' => $friend_id,
... ...
... ... @@ -35,7 +35,7 @@ class RemainDay extends Command
* 按照达标天数收费的项目(白帽)
*/
protected $bm_projectId = [
4247,4299,4310,4215,4038,4084,4148,4178
4247,4299,4310,4215,4038,4084,4148,4178,4405
];
... ... @@ -120,7 +120,7 @@ class RemainDay extends Command
//白帽版本的系统
if($deploy_build['seo_plan'] == 1){
if($deploy_build['seo_service_duration'] != 0){
if(in_array($item['id'],$this->bm_projectId) || (strpos($item['level'], '19') !== false)){
if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){
$compliance_day = (int)$item['bm_finish_remain_day'];
$seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day'];
}else{
... ...
... ... @@ -165,6 +165,7 @@ class GeoQuestionRes extends Command
'keywords_num'=>$keyword_num ?? [],
'url_num'=>$url_num ?? [],
'is_match'=>$is_match ?? 0,
'label'=>$taskInfo['label'] ?? null,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
... ...
... ... @@ -50,7 +50,7 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
return $this->getExpectResult();
return $this->_actionRoute();
return true;
}
... ... @@ -74,25 +74,22 @@ class lyhDemo extends Command
* @time :2025/7/22 15:14
*/
public function _actionRoute(){
$geo_service = new GeoService();
$data = $geo_service->getDeepSeekResult("创贸总共多少人?",'gpt-4o-mini');
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'is_ai_blog'=>1,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
$data = [];
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
ProjectServer::useProject($item['id']);
$aiBlogModel = new AiBlog();
$info = $aiBlogModel->read(['text'=>['like','%href="blog/%']],['id']);
if($info !== false){
echo '需要处理->项目id:'.$item['id'].PHP_EOL;
$data[] = $item['id'];
}
echo 'end';
DB::disconnect('custom_mysql');
}
dd($data);
// $projectModel = new Project();
// $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
// $data = [];
// foreach ($lists as $item){
// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
// ProjectServer::useProject($item['id']);
// $aiBlogModel = new AiBlog();
// $info = $aiBlogModel->read(['route'=>null],['id']);
// if($info !== false){
// echo '项目id:'.$item['id'].PHP_EOL;
// $data[] = $item['id'];
// }
// dd($data);
// echo 'end';
// DB::disconnect('custom_mysql');
// }
}
public function _actionTemplateMain(){
... ...
... ... @@ -76,7 +76,7 @@ class TicketCount extends Command
$date = Carbon::yesterday()->toDateString(); // 昨日时间
$ticketManageCountModel = new TicketDailyManageCount();
foreach ($manageList as $item){
$average_time = '';
$average_time = null;
$this->output('按人员统计:执行的人员名称/id:'.$item['name'].'/'.$item['manage_id']);
$ticketLogModel = new TicketLog();
$ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
... ... @@ -88,6 +88,9 @@ class TicketCount extends Command
}
//最快完成的时间
$fastest_time = $ticketLogModel->formatQuery(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'end_at'=>['!=',null]])->min('end_time');
if(!$fastest_time){
$fastest_time = null;
}
//超时工单数量
$timeout_num = $ticketLogModel->counts(['end_at'=>null,'engineer_id'=>$item['manage_id'],'is_engineer'=>1,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
$complete_num = $ticketLogModel->counts(['end_at'=>['!=',null],'engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
... ... @@ -96,8 +99,8 @@ class TicketCount extends Command
'manage_id'=>$item['id'],
'manage_name'=>$item['name'],
'ticket_num'=>$ticket_num,//工单总数量
'average_time'=>$average_time ?? '',//平均完成工单时长
'fastest_time'=>$fastest_time,//最快完成工单时间
'average_time'=>$average_time ?? null,//平均完成工单时长
'fastest_time'=>$fastest_time ?? null,//最快完成工单时间
'timeout_num'=>$timeout_num,//超时工单数量
'complete_num'=>$complete_num,//完成工单数量
'dept_id'=>$item['dept_id']
... ... @@ -130,7 +133,7 @@ class TicketCount extends Command
$ticketDailyDeptModel = new TicketDailyDeptCount();
$date = Carbon::yesterday()->toDateString(); // "2025-08-07"
foreach ($groupList as $item){
$average_time = '';
$average_time = null;
$this->output('组统计:执行的组/id:'.$item['name'].'/'.$item['id']);
$manageIdArr = $manageHrModel->selectField(['belong_group'=>$item['id'],'status'=>1,'dept_id'=>1],'manage_id');
$ticket_num = $ticketLogModel->counts(['engineer_id'=>['in',$manageIdArr],'is_engineer'=>1]);
... ... @@ -143,7 +146,7 @@ class TicketCount extends Command
'dept_id'=>$item['id'],
'dept_name'=>$item['name'],
'ticket_num'=>$ticket_num ?? 0,
'average_time'=>$average_time ?? ''
'average_time'=>$average_time ?? null
];
$deptInfo = $ticketDailyDeptModel->read(['date'=>$date,'dept_id'=>$item['id']],['id']);
if($deptInfo === false){
... ... @@ -189,7 +192,7 @@ class TicketCount extends Command
'add_num'=>$add_num,
'untreated_num'=>$untreated_num,
'processed_num'=>$processed_num,
'average_time'=>$average_time ?? '',
'average_time'=>$average_time ?? null,
'source'=>json_encode(['a'=>$submit_a_side,'b'=>$submit_b_side],true),
'source_type'=>json_encode($dbResult,true)
];
... ...
... ... @@ -435,6 +435,7 @@ class WebTraffic extends Command
}
})->inRandomOrder()->first();
if(!$ipdata){
$data[] = [];
continue;
}
$ipdata = (array)$ipdata ?: [];
... ...
... ... @@ -480,6 +480,7 @@ class WebTrafficRussia extends Command
$ip_area = $this->get_rand($project_country);
$res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first();
if(!$res){
$data[] = [];
continue;
}
$res = (array)$res ?: [];
... ...
... ... @@ -471,6 +471,7 @@ class WebTrafficRussiaSpecial extends Command
$ip_area = $this->get_rand($project_country);
$res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first();
if(!$res){
$data[] = [];
continue;
}
$res = (array)$res ?: [];
... ...
... ... @@ -421,6 +421,7 @@ class WebTrafficSpecial extends Command
}
})->inRandomOrder()->first();
if(!$ipdata){
$data[] = [];
continue;
}
$ipdata = (array)$ipdata ?: [];
... ...
... ... @@ -216,11 +216,11 @@ class FetchTicketProjects extends Command
// 第一负责人
/**
* 5.0升级6.0的项目,白帽SEO的项目 都划给售后
* 5.0升级6.0的项目,白帽SEO, GEO的项目 都划给售后
* 其他:建站中找项目经理,建站完成找杨长远,推广找售后服务经理
*/
if ($item->is_upgrade || $item->project_type == 1)
$engineer_id = $assm_id; // V5升V6,白帽SEO,找售后服务经理
if ($item->is_upgrade || $item->project_type == 1 || $item->deploy_build->seo_plan > 0)
$engineer_id = $assm_id; // V5升V6,白帽SEO,GEO,找售后服务经理
elseif ($status == 1)
$engineer_id = $pm_id; // 建站中找项目经理
elseif ($status == 2)
... ...
... ... @@ -62,6 +62,7 @@ class ServersController extends BaseController
unset($this->map['project_name']);
}
if(isset($this->map['domain']) && !empty($this->map['domain'])){
$this->map['domain'] = parse_url($this->map['domain'], PHP_URL_HOST); // 直接取域名部分
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['domain'=>['like','%'.$this->map['domain'].'%']],['id','project_id']);
if($domainInfo !== false && !empty($domainInfo['project_id'])){
... ... @@ -74,6 +75,8 @@ class ServersController extends BaseController
$this->map['id'] = $ipInfo['servers_id'];
}
}
}else{
$this->map['id'] = 0;
}
unset($this->map['domain']);
}
... ...
... ... @@ -102,11 +102,11 @@ class GeoQuestionController extends BaseController
'type'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'question.required' => '项目ID不能为空',
'keywords.required' => '项目ID不能为空',
'url.required' => '项目ID不能为空',
'status.required' => '项目ID不能为空',
'type.required' => '类型不能为空',
'question.required' => 'question不能为空',
'keywords.required' => 'keywords不能为空',
'url.required' => 'url不能为空',
'status.required' => 'status不能为空',
'type.required' => 'type类型不能为空',
]);
$data = $this->logic->saveGeoQuestion();
$this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -49,7 +49,6 @@ class TicketController extends BaseController
],[
'dept_id.required' => '技术组id',
]);
$this->order = 'ticket_num';
$sort = $this->map['sort'] ?? 'desc';
$data = $this->logic->getManageTicketCount($this->map,$this->order,$sort);
$this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -48,11 +48,14 @@ class GeoQuestionResLogic extends BaseLogic
*/
public function getResultList($map = [],$page = 1,$row = 20){
$map['project_id'] = $this->user['project_id'];
$filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','created_at','updated_at'];
$filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','label','created_at','updated_at'];
if(!empty($map['created_at'])){
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
$this->model = new GeoQuestionLog();
}
if(isset($map['label']) && !empty($map['label'])){
$map['label'] = ['like','%'.$map['label'].'%'];
}
if(!empty($map['keywords'])){
$map['keywords'] = ['like','%'.$map['keywords'].'%'];
}
... ...
... ... @@ -345,6 +345,11 @@ class ProductLogic extends BaseLogic
}else{
$param['category_id'] = '';
}
if(isset($param['og_image']) && !empty($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}else{
$param['og_image'] = $param['gallery'][0]['url'] ?? '';
}
//产品图
if(isset($param['gallery']) && !empty($param['gallery'])){
foreach ($param['gallery'] as $k => $v){
... ... @@ -357,11 +362,6 @@ class ProductLogic extends BaseLogic
$param['thumb'] = Arr::a2s([]);
$param['gallery'] = Arr::a2s([]);
}
if(isset($param['og_image']) && !empty($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}else{
$param['og_image'] = $param['thumb']['url'] ?? '';
}
if(isset($param['files'])){
$param['files']['url'] = str_replace_url($param['files']['url'] ?? '');
$param['files'] = Arr::a2s($param['files'] ?? []);
... ...