Merge remote-tracking branch 'origin/master' into akun
正在显示
13 个修改的文件
包含
111 行增加
和
41 行删除
| @@ -9,9 +9,14 @@ | @@ -9,9 +9,14 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\Ai; | 10 | namespace App\Console\Commands\Ai; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 13 | +use App\Models\Com\Notify; | ||
| 14 | +use App\Models\Devops\ServerConfig; | ||
| 15 | +use App\Models\Devops\ServersIp; | ||
| 12 | use App\Models\Domain\DomainInfo; | 16 | use App\Models\Domain\DomainInfo; |
| 13 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; | 17 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; |
| 14 | use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel; | 18 | use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel; |
| 19 | +use App\Models\Project\Project; | ||
| 15 | use App\Services\AiBlogService; | 20 | use App\Services\AiBlogService; |
| 16 | use App\Services\ProjectServer; | 21 | use App\Services\ProjectServer; |
| 17 | use Illuminate\Console\Command; | 22 | use Illuminate\Console\Command; |
| @@ -105,18 +110,53 @@ class AiBlogAuthorId extends Command | @@ -105,18 +110,53 @@ class AiBlogAuthorId extends Command | ||
| 105 | * @time :2025/5/26 16:21 | 110 | * @time :2025/5/26 16:21 |
| 106 | */ | 111 | */ |
| 107 | public function sendCPost($project_id){ | 112 | public function sendCPost($project_id){ |
| 108 | - $domainModel = new DomainInfo(); | ||
| 109 | - $domain = $domainModel->getProjectIdDomain($project_id); | ||
| 110 | - $c_url = $domain.'api/update_page/'; | ||
| 111 | - $param = [ | ||
| 112 | - 'project_id' => $project_id, | ||
| 113 | - 'type' => 1, | ||
| 114 | - 'route' => 3, | ||
| 115 | - 'url' => $this->route, | ||
| 116 | - 'language'=> [], | ||
| 117 | - 'is_sitemap' => 0 | ||
| 118 | - ]; | ||
| 119 | - $res = http_post($c_url, json_encode($param,true)); | ||
| 120 | - echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 113 | + //获取项目所在服务器 |
| 114 | + $project_model = new Project(); | ||
| 115 | + $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']); | ||
| 116 | + if(!$project_info){ | ||
| 117 | + return false; | ||
| 118 | + } | ||
| 119 | + $serve_ip_model = new ServersIp(); | ||
| 120 | + $serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']); | ||
| 121 | + $servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0; | ||
| 122 | + if($servers_id == ServerConfig::SELF_SITE_ID){ | ||
| 123 | + //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 | ||
| 124 | + $domain_model = new DomainInfo(); | ||
| 125 | + $domain_info = $domain_model->read(['project_id'=>$this->user['project_id']],['domain']); | ||
| 126 | + if($domain_info){ | ||
| 127 | + //判断是否已有更新进行中 | ||
| 128 | + $notify_model = new Notify(); | ||
| 129 | + $data = [ | ||
| 130 | + 'project_id' => $project_id, | ||
| 131 | + 'type' => 1, | ||
| 132 | + 'route' => 3, | ||
| 133 | + 'server_id' => ServerConfig::SELF_SITE_ID, | ||
| 134 | + 'status' => ['!=',Notify::STATUS_FINISH_SITEMAP] | ||
| 135 | + ]; | ||
| 136 | + $notify = $notify_model->read($data,['id']); | ||
| 137 | + if(!$notify){ | ||
| 138 | + $domain = $domain_info['domain']; | ||
| 139 | + $data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$this->route,'language'=>[]]); | ||
| 140 | + $data['status'] = Notify::STATUS_INIT; | ||
| 141 | + $data['is_pull_html_zip'] = Notify::IS_PULL_HTML_ZIP_FALSE; | ||
| 142 | + $data['sort'] = 1; | ||
| 143 | + $notify_model->add($data); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + }else{ | ||
| 147 | + $domainModel = new DomainInfo(); | ||
| 148 | + $domain = $domainModel->getProjectIdDomain($project_id); | ||
| 149 | + $c_url = $domain.'api/update_page/'; | ||
| 150 | + $param = [ | ||
| 151 | + 'project_id' => $project_id, | ||
| 152 | + 'type' => 1, | ||
| 153 | + 'route' => 3, | ||
| 154 | + 'url' => $this->route, | ||
| 155 | + 'language'=> [], | ||
| 156 | + 'is_sitemap' => 0 | ||
| 157 | + ]; | ||
| 158 | + $res = http_post($c_url, json_encode($param,true)); | ||
| 159 | + echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | ||
| 160 | + } | ||
| 121 | } | 161 | } |
| 122 | } | 162 | } |
| @@ -35,7 +35,7 @@ class RemainDay extends Command | @@ -35,7 +35,7 @@ class RemainDay extends Command | ||
| 35 | * 按照达标天数收费的项目(白帽) | 35 | * 按照达标天数收费的项目(白帽) |
| 36 | */ | 36 | */ |
| 37 | protected $bm_projectId = [ | 37 | protected $bm_projectId = [ |
| 38 | - 4247,4299,4310,4215,4038,4084,4148,4178 | 38 | + 4247,4299,4310,4215,4038,4084,4148,4178,4405 |
| 39 | ]; | 39 | ]; |
| 40 | 40 | ||
| 41 | 41 |
| @@ -165,6 +165,7 @@ class GeoQuestionRes extends Command | @@ -165,6 +165,7 @@ class GeoQuestionRes extends Command | ||
| 165 | 'keywords_num'=>$keyword_num ?? [], | 165 | 'keywords_num'=>$keyword_num ?? [], |
| 166 | 'url_num'=>$url_num ?? [], | 166 | 'url_num'=>$url_num ?? [], |
| 167 | 'is_match'=>$is_match ?? 0, | 167 | 'is_match'=>$is_match ?? 0, |
| 168 | + 'label'=>$taskInfo['label'] ?? null, | ||
| 168 | 'created_at'=>date('Y-m-d H:i:s'), | 169 | 'created_at'=>date('Y-m-d H:i:s'), |
| 169 | 'updated_at'=>date('Y-m-d H:i:s'), | 170 | 'updated_at'=>date('Y-m-d H:i:s'), |
| 170 | ]; | 171 | ]; |
| @@ -50,7 +50,7 @@ class lyhDemo extends Command | @@ -50,7 +50,7 @@ class lyhDemo extends Command | ||
| 50 | protected $description = '更新路由'; | 50 | protected $description = '更新路由'; |
| 51 | 51 | ||
| 52 | public function handle(){ | 52 | public function handle(){ |
| 53 | - return $this->getExpectResult(); | 53 | + return $this->_actionRoute(); |
| 54 | return true; | 54 | return true; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| @@ -74,25 +74,22 @@ class lyhDemo extends Command | @@ -74,25 +74,22 @@ class lyhDemo extends Command | ||
| 74 | * @time :2025/7/22 15:14 | 74 | * @time :2025/7/22 15:14 |
| 75 | */ | 75 | */ |
| 76 | public function _actionRoute(){ | 76 | public function _actionRoute(){ |
| 77 | - $geo_service = new GeoService(); | ||
| 78 | - $data = $geo_service->getDeepSeekResult("创贸总共多少人?",'gpt-4o-mini'); | 77 | + $projectModel = new Project(); |
| 78 | + $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']); | ||
| 79 | + $data = []; | ||
| 80 | + foreach ($lists as $item){ | ||
| 81 | + echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; | ||
| 82 | + ProjectServer::useProject($item['id']); | ||
| 83 | + $aiBlogModel = new AiBlog(); | ||
| 84 | + $info = $aiBlogModel->read(['text'=>['like','%href="blog/%']],['id']); | ||
| 85 | + if($info !== false){ | ||
| 86 | + echo '需要处理->项目id:'.$item['id'].PHP_EOL; | ||
| 87 | + $data[] = $item['id']; | ||
| 88 | + } | ||
| 89 | + echo 'end'; | ||
| 90 | + DB::disconnect('custom_mysql'); | ||
| 91 | + } | ||
| 79 | dd($data); | 92 | dd($data); |
| 80 | -// $projectModel = new Project(); | ||
| 81 | -// $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']); | ||
| 82 | -// $data = []; | ||
| 83 | -// foreach ($lists as $item){ | ||
| 84 | -// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; | ||
| 85 | -// ProjectServer::useProject($item['id']); | ||
| 86 | -// $aiBlogModel = new AiBlog(); | ||
| 87 | -// $info = $aiBlogModel->read(['route'=>null],['id']); | ||
| 88 | -// if($info !== false){ | ||
| 89 | -// echo '项目id:'.$item['id'].PHP_EOL; | ||
| 90 | -// $data[] = $item['id']; | ||
| 91 | -// } | ||
| 92 | -// dd($data); | ||
| 93 | -// echo 'end'; | ||
| 94 | -// DB::disconnect('custom_mysql'); | ||
| 95 | -// } | ||
| 96 | } | 93 | } |
| 97 | 94 | ||
| 98 | public function _actionTemplateMain(){ | 95 | public function _actionTemplateMain(){ |
| @@ -434,6 +434,10 @@ class WebTraffic extends Command | @@ -434,6 +434,10 @@ class WebTraffic extends Command | ||
| 434 | $query->whereNotIn('ip_area', $main_countries); | 434 | $query->whereNotIn('ip_area', $main_countries); |
| 435 | } | 435 | } |
| 436 | })->inRandomOrder()->first(); | 436 | })->inRandomOrder()->first(); |
| 437 | + if(!$ipdata){ | ||
| 438 | + $data[] = []; | ||
| 439 | + continue; | ||
| 440 | + } | ||
| 437 | $ipdata = (array)$ipdata ?: []; | 441 | $ipdata = (array)$ipdata ?: []; |
| 438 | $ipdata['diff'] = $time_zones[$ipdata['ip_area']]; | 442 | $ipdata['diff'] = $time_zones[$ipdata['ip_area']]; |
| 439 | $data[] = $ipdata; | 443 | $data[] = $ipdata; |
| @@ -479,6 +479,10 @@ class WebTrafficRussia extends Command | @@ -479,6 +479,10 @@ class WebTrafficRussia extends Command | ||
| 479 | } | 479 | } |
| 480 | $ip_area = $this->get_rand($project_country); | 480 | $ip_area = $this->get_rand($project_country); |
| 481 | $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first(); | 481 | $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first(); |
| 482 | + if(!$res){ | ||
| 483 | + $data[] = []; | ||
| 484 | + continue; | ||
| 485 | + } | ||
| 482 | $res = (array)$res ?: []; | 486 | $res = (array)$res ?: []; |
| 483 | $res['diff'] = $time_zones[$res['ip_area']]; | 487 | $res['diff'] = $time_zones[$res['ip_area']]; |
| 484 | $data[] = $res; | 488 | $data[] = $res; |
| @@ -470,6 +470,10 @@ class WebTrafficRussiaSpecial extends Command | @@ -470,6 +470,10 @@ class WebTrafficRussiaSpecial extends Command | ||
| 470 | } | 470 | } |
| 471 | $ip_area = $this->get_rand($project_country); | 471 | $ip_area = $this->get_rand($project_country); |
| 472 | $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first(); | 472 | $res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first(); |
| 473 | + if(!$res){ | ||
| 474 | + $data[] = []; | ||
| 475 | + continue; | ||
| 476 | + } | ||
| 473 | $res = (array)$res ?: []; | 477 | $res = (array)$res ?: []; |
| 474 | $res['diff'] = $time_zones[$res['ip_area']]; | 478 | $res['diff'] = $time_zones[$res['ip_area']]; |
| 475 | $data[] = $res; | 479 | $data[] = $res; |
| @@ -420,6 +420,10 @@ class WebTrafficSpecial extends Command | @@ -420,6 +420,10 @@ class WebTrafficSpecial extends Command | ||
| 420 | $query->whereNotIn('ip_area', $main_countries); | 420 | $query->whereNotIn('ip_area', $main_countries); |
| 421 | } | 421 | } |
| 422 | })->inRandomOrder()->first(); | 422 | })->inRandomOrder()->first(); |
| 423 | + if(!$ipdata){ | ||
| 424 | + $data[] = []; | ||
| 425 | + continue; | ||
| 426 | + } | ||
| 423 | $ipdata = (array)$ipdata ?: []; | 427 | $ipdata = (array)$ipdata ?: []; |
| 424 | $ipdata['diff'] = $time_zones[$ipdata['ip_area']]; | 428 | $ipdata['diff'] = $time_zones[$ipdata['ip_area']]; |
| 425 | $data[] = $ipdata; | 429 | $data[] = $ipdata; |
| @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; | @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; | ||
| 12 | use App\Models\Ai\AiBlog; | 12 | use App\Models\Ai\AiBlog; |
| 13 | use App\Models\Blog\Blog; | 13 | use App\Models\Blog\Blog; |
| 14 | use App\Models\Domain\DomainInfo; | 14 | use App\Models\Domain\DomainInfo; |
| 15 | +use App\Models\Industry\ProjectIndustryRelated; | ||
| 15 | use App\Models\Inquiry\InquiryRelateDomain; | 16 | use App\Models\Inquiry\InquiryRelateDomain; |
| 16 | use App\Models\Manage\ManageHr; | 17 | use App\Models\Manage\ManageHr; |
| 17 | use App\Models\News\News; | 18 | use App\Models\News\News; |
| @@ -47,10 +48,12 @@ class PrivateController extends BaseController | @@ -47,10 +48,12 @@ class PrivateController extends BaseController | ||
| 47 | public function optimizeProjectList(Request $request) | 48 | public function optimizeProjectList(Request $request) |
| 48 | { | 49 | { |
| 49 | $page_size = $request->input('page_size', 20); | 50 | $page_size = $request->input('page_size', 20); |
| 50 | - $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special']; | 51 | + $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', |
| 51 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') | 52 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') |
| 52 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') | 53 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') |
| 53 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') | 54 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') |
| 55 | +// ->leftJoin('gl_project_industry_related as e', 'gl_project.id', '=', 'e.project_id') | ||
| 56 | +// ->leftJoin('gl_project_industry as f', 'e.industry_id', '=', 'f.id') | ||
| 54 | ->where('gl_project.type', Project::TYPE_TWO) | 57 | ->where('gl_project.type', Project::TYPE_TWO) |
| 55 | ->where('gl_project.project_type',Project::TYPE_ZERO) | 58 | ->where('gl_project.project_type',Project::TYPE_ZERO) |
| 56 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 | 59 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 |
| @@ -60,6 +63,14 @@ class PrivateController extends BaseController | @@ -60,6 +63,14 @@ class PrivateController extends BaseController | ||
| 60 | }) | 63 | }) |
| 61 | ->paginate($page_size) | 64 | ->paginate($page_size) |
| 62 | ->toArray(); | 65 | ->toArray(); |
| 66 | + | ||
| 67 | + // 直接关联查询, 会出现数据错误 | ||
| 68 | + $project_ids = array_column($result['list'], 'id'); | ||
| 69 | + $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(); | ||
| 70 | + foreach ($result['list'] as &$val) { | ||
| 71 | + $val['industry_name'] = FALSE == empty($industry[$val['id']]) ? $industry[$val['id']] : ''; | ||
| 72 | + } | ||
| 73 | + | ||
| 63 | return $this->success($result); | 74 | return $this->success($result); |
| 64 | } | 75 | } |
| 65 | 76 |
| @@ -62,6 +62,7 @@ class ServersController extends BaseController | @@ -62,6 +62,7 @@ class ServersController extends BaseController | ||
| 62 | unset($this->map['project_name']); | 62 | unset($this->map['project_name']); |
| 63 | } | 63 | } |
| 64 | if(isset($this->map['domain']) && !empty($this->map['domain'])){ | 64 | if(isset($this->map['domain']) && !empty($this->map['domain'])){ |
| 65 | + $this->map['domain'] = parse_url($this->map['domain'], PHP_URL_HOST); // 直接取域名部分 | ||
| 65 | $domainModel = new DomainInfo(); | 66 | $domainModel = new DomainInfo(); |
| 66 | $domainInfo = $domainModel->read(['domain'=>['like','%'.$this->map['domain'].'%']],['id','project_id']); | 67 | $domainInfo = $domainModel->read(['domain'=>['like','%'.$this->map['domain'].'%']],['id','project_id']); |
| 67 | if($domainInfo !== false && !empty($domainInfo['project_id'])){ | 68 | if($domainInfo !== false && !empty($domainInfo['project_id'])){ |
| @@ -74,6 +75,8 @@ class ServersController extends BaseController | @@ -74,6 +75,8 @@ class ServersController extends BaseController | ||
| 74 | $this->map['id'] = $ipInfo['servers_id']; | 75 | $this->map['id'] = $ipInfo['servers_id']; |
| 75 | } | 76 | } |
| 76 | } | 77 | } |
| 78 | + }else{ | ||
| 79 | + $this->map['id'] = 0; | ||
| 77 | } | 80 | } |
| 78 | unset($this->map['domain']); | 81 | unset($this->map['domain']); |
| 79 | } | 82 | } |
| @@ -102,11 +102,11 @@ class GeoQuestionController extends BaseController | @@ -102,11 +102,11 @@ class GeoQuestionController extends BaseController | ||
| 102 | 'type'=>'required', | 102 | 'type'=>'required', |
| 103 | ],[ | 103 | ],[ |
| 104 | 'project_id.required' => '项目ID不能为空', | 104 | 'project_id.required' => '项目ID不能为空', |
| 105 | - 'question.required' => '项目ID不能为空', | ||
| 106 | - 'keywords.required' => '项目ID不能为空', | ||
| 107 | - 'url.required' => '项目ID不能为空', | ||
| 108 | - 'status.required' => '项目ID不能为空', | ||
| 109 | - 'type.required' => '类型不能为空', | 105 | + 'question.required' => 'question不能为空', |
| 106 | + 'keywords.required' => 'keywords不能为空', | ||
| 107 | + 'url.required' => 'url不能为空', | ||
| 108 | + 'status.required' => 'status不能为空', | ||
| 109 | + 'type.required' => 'type类型不能为空', | ||
| 110 | ]); | 110 | ]); |
| 111 | $data = $this->logic->saveGeoQuestion(); | 111 | $data = $this->logic->saveGeoQuestion(); |
| 112 | $this->response('success',Code::SUCCESS,$data); | 112 | $this->response('success',Code::SUCCESS,$data); |
| @@ -49,7 +49,6 @@ class TicketController extends BaseController | @@ -49,7 +49,6 @@ class TicketController extends BaseController | ||
| 49 | ],[ | 49 | ],[ |
| 50 | 'dept_id.required' => '技术组id', | 50 | 'dept_id.required' => '技术组id', |
| 51 | ]); | 51 | ]); |
| 52 | - $this->order = 'ticket_num'; | ||
| 53 | $sort = $this->map['sort'] ?? 'desc'; | 52 | $sort = $this->map['sort'] ?? 'desc'; |
| 54 | $data = $this->logic->getManageTicketCount($this->map,$this->order,$sort); | 53 | $data = $this->logic->getManageTicketCount($this->map,$this->order,$sort); |
| 55 | $this->response('success',Code::SUCCESS,$data); | 54 | $this->response('success',Code::SUCCESS,$data); |
| @@ -48,11 +48,14 @@ class GeoQuestionResLogic extends BaseLogic | @@ -48,11 +48,14 @@ class GeoQuestionResLogic extends BaseLogic | ||
| 48 | */ | 48 | */ |
| 49 | public function getResultList($map = [],$page = 1,$row = 20){ | 49 | public function getResultList($map = [],$page = 1,$row = 20){ |
| 50 | $map['project_id'] = $this->user['project_id']; | 50 | $map['project_id'] = $this->user['project_id']; |
| 51 | - $filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','created_at','updated_at']; | 51 | + $filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','label','created_at','updated_at']; |
| 52 | if(!empty($map['created_at'])){ | 52 | if(!empty($map['created_at'])){ |
| 53 | $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']]; | 53 | $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']]; |
| 54 | $this->model = new GeoQuestionLog(); | 54 | $this->model = new GeoQuestionLog(); |
| 55 | } | 55 | } |
| 56 | + if(isset($map['label']) && !empty($map['label'])){ | ||
| 57 | + $map['label'] = ['like','%'.$map['label'].'%']; | ||
| 58 | + } | ||
| 56 | if(!empty($map['keywords'])){ | 59 | if(!empty($map['keywords'])){ |
| 57 | $map['keywords'] = ['like','%'.$map['keywords'].'%']; | 60 | $map['keywords'] = ['like','%'.$map['keywords'].'%']; |
| 58 | } | 61 | } |
-
请 注册 或 登录 后发表评论