作者 刘锟

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

... ... @@ -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,6 +110,40 @@ class AiBlogAuthorId extends Command
* @time :2025/5/26 16:21
*/
public function sendCPost($project_id){
//获取项目所在服务器
$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/';
... ... @@ -119,4 +158,5 @@ class AiBlogAuthorId extends Command
$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);
}
}
}
... ...
... ... @@ -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
];
... ...
... ... @@ -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(){
... ...
... ... @@ -434,6 +434,10 @@ class WebTraffic extends Command
$query->whereNotIn('ip_area', $main_countries);
}
})->inRandomOrder()->first();
if(!$ipdata){
$data[] = [];
continue;
}
$ipdata = (array)$ipdata ?: [];
$ipdata['diff'] = $time_zones[$ipdata['ip_area']];
$data[] = $ipdata;
... ...
... ... @@ -479,6 +479,10 @@ 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 ?: [];
$res['diff'] = $time_zones[$res['ip_area']];
$data[] = $res;
... ...
... ... @@ -470,6 +470,10 @@ 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 ?: [];
$res['diff'] = $time_zones[$res['ip_area']];
$data[] = $res;
... ...
... ... @@ -420,6 +420,10 @@ class WebTrafficSpecial extends Command
$query->whereNotIn('ip_area', $main_countries);
}
})->inRandomOrder()->first();
if(!$ipdata){
$data[] = [];
continue;
}
$ipdata = (array)$ipdata ?: [];
$ipdata['diff'] = $time_zones[$ipdata['ip_area']];
$data[] = $ipdata;
... ...
... ... @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic;
use App\Models\Ai\AiBlog;
use App\Models\Blog\Blog;
use App\Models\Domain\DomainInfo;
use App\Models\Industry\ProjectIndustryRelated;
use App\Models\Inquiry\InquiryRelateDomain;
use App\Models\Manage\ManageHr;
use App\Models\News\News;
... ... @@ -47,10 +48,12 @@ 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', 'b.special'];
$field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special', 'gl_project.from_order_id'];// 'f.industry_name',
$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')
// ->leftJoin('gl_project_industry_related as e', 'gl_project.id', '=', 'e.project_id')
// ->leftJoin('gl_project_industry as f', 'e.industry_id', '=', 'f.id')
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.project_type',Project::TYPE_ZERO)
->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
... ... @@ -60,6 +63,14 @@ class PrivateController extends BaseController
})
->paginate($page_size)
->toArray();
// 直接关联查询, 会出现数据错误
$project_ids = array_column($result['list'], 'id');
$industry = ProjectIndustryRelated::leftJoin('gl_project_industry', 'gl_project_industry_related.industry_id', '=', 'gl_project_industry.id')->whereIn('project_id', $project_ids)->pluck('industry_name', 'project_id')->toArray();
foreach ($result['list'] as &$val) {
$val['industry_name'] = FALSE == empty($industry[$val['id']]) ? $industry[$val['id']] : '';
}
return $this->success($result);
}
... ...
... ... @@ -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'].'%'];
}
... ...