作者 lms

合并分支 'lms' 到 'develop'

Lms



查看合并请求 !78
... ... @@ -39,7 +39,7 @@ class ProjectFilePDF extends Command
{
$this->AiccWechat = new ProjectAssociation();
$this->DataFile = new DataFile();
$this->time = date("Y-m-d");
$this->time = date("Y-m");
parent::__construct();
}
... ... @@ -121,9 +121,12 @@ class ProjectFilePDF extends Command
// 获取PDF内容
$pdfContent = $dompdf->output();
$pdf_path = public_path('PDF/');
if (!file_exists($pdf_path)) {
mkdir($pdf_path, 0777, true);
}
// 指定保存路径和文件名
$savePath = public_path('PDF/' . $filename . '.pdf');
$savePath = $pdf_path . $filename . '.pdf';
// 将PDF内容保存到文件
file_put_contents($savePath, $pdfContent);
... ...
... ... @@ -79,7 +79,7 @@ class HtmlCollect extends Command
$web_url_domain = $collect_info->domain;
$home_url = $collect_info->domain;
$url_web_config = 'https://' . $collect_info->domain . '/wp-content/cache/user_config.text';
$data_config = http_get($url_web_config, ['charset' => 'UTF-8']);
$data_config = curl_c($url_web_config);
if ($data_config) {
$web_url_arr = parse_url($data_config['web_url_domain'] ?? '');
if (isset($web_url_arr['host'])) {
... ... @@ -94,20 +94,11 @@ class HtmlCollect extends Command
//采集html页面,下载资源到本地并替换
try {
$opts = [
'http' => [
'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
];
$html = file_get_contents('https://' . $collect_info->domain . $collect_info->route, false, stream_context_create($opts));
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
$source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url);
if ($source_list) {
$html = $this->upload_source($html, $source_list, $project_id, $opts);
$html = $this->upload_source($html, $source_list, $project_id);
}
} catch (\Exception $e) {
$collect_info->status = CollectTask::STATUS_FAIL;
... ... @@ -280,7 +271,7 @@ class HtmlCollect extends Command
}
//下载并替换资源
protected function upload_source($html, $source, $project_id, $opts)
protected function upload_source($html, $source, $project_id)
{
foreach ($source as $vs) {
... ... @@ -298,7 +289,7 @@ class HtmlCollect extends Command
if (substr($new_source, -3, 3) == 'css') {
// 下载css文件中的资源
$css_html = file_get_contents($vs['url_complete'], false, stream_context_create($opts));
$css_html = curl_c($vs['url_complete'], false);
preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source);
$css_source = $result_css_source[1] ?? [];
... ...
... ... @@ -54,12 +54,12 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$lists = $projectModel->list(['is_upgrade'=>0,'type'=>['!=',0]]);
$lists = $projectModel->list(['is_upgrade'=>0,'id'=>['>',167],'type'=>['!=',0]]);
foreach ($lists as $k => $v){
echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->setProductRoute($v['id']);
// $this->setProductKeywordRoute($v['id']);
// $this->setProductRoute($v['id']);
$this->setProductKeywordRoute($v['id']);
// $this->setBlogRoute($v['id']);
// $this->setNewsRoute($v['id']);
// $this->setBlogCateRoute($v['id']);
... ... @@ -194,11 +194,15 @@ class UpdateRoute extends Command
public function setProductKeywordRoute($project_id){
$keywordModel = new Keyword();
$keywordList = $keywordModel->list([],'id',['id','route']);
foreach ($keywordList as $v){
if(!ends_with($v['route'],'-tag')){
$route = $v['route'].'-tag';
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
RouteMap::setRoute($route, RouteMap::SOURCE_BLOG_CATE, $v['id'], $project_id);
if(!empty($keywordList)){
foreach ($keywordList as $v){
// if(!ends_with($v['route'],'-tag')){
// $route = $v['route'].'-tag';
// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
// }
$routeMapModel = new RouteMap();
$routeMapModel->edit(['route'=>$v['route']],['source_id'=>$v['id'],'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD]);
RouteMap::setRoute($v['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $project_id);
}
}
return true;
... ...
... ... @@ -32,7 +32,7 @@ class BTemplateModuleController extends BaseController
$moduleProjectModel = new BModuleProject();
$module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]);
$data['module_list'] = $module_list;
$this->response('success',Code::SUCCESS,$data);
$this->response('success',Code::SUCCESS,$list);
}
/**
... ...
... ... @@ -4,9 +4,7 @@ namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\DomainInfo;
use App\Models\Project\Payment;
use MongoDB\Client;
use App\Models\Domain\DomainInfo;
class DomainInfoLogic extends BaseLogic
{
... ... @@ -18,26 +16,15 @@ class DomainInfoLogic extends BaseLogic
public function getDomainInfo($project_id)
{
$project = (new ProjectLogic())->getProjectInfo($project_id);
$domain = (!empty($project['deploy_optimize']['domain']) ? ((new \App\Models\Domain\DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
$info = $this->model->where('project_id', $project_id)->first();
//不存在或时间过期了 重新获取信息
$expiration_date = $info['domain_info']['expiration_date'] ?? '';
$end_time = $info['ssl']['end_time'] ?? '';
if(!$info || $expiration_date < date("Y-m-d") || $end_time < date('Y-m-d')){
try {
$mongo = new Client("mongodb://root:globalso8837840@23.228.125.2:27017");
$db = $mongo->globalso_monitor;
$collection = $db->project_v1;
$project_zk = $collection->findOne(['main_url' => $domain]);
$info['domain'] = $domain;
$info['domain_info'] = (array) $project_zk['domain_info'] ?? [];
$info['ssl'] = (array) $project_zk['ssl'] ?? [];
parent::save($info);
}catch (\Exception $e){
return [];
}
}
return $info;
$domain_info = $this->model->where('project_id', $project_id)->first();
if(!$domain_info){
return [];
}
return [
'domain' => 'https://'.$domain_info['domain'].'/',
'domain_info' => date('Y-m-d', strtotime($domain_info['domain_start_time'])) . ' - ' .date('Y-m-d', strtotime($domain_info['domain_end_time'])),
'cert_info' => date('Y-m-d', strtotime($domain_info['certificate_start_time'])) . ' - ' .date('Y-m-d', strtotime($domain_info['certificate_end_time'])),
];
}
}
... ...
... ... @@ -60,9 +60,9 @@ class RankDataLogic extends BaseLogic
//项目信息
$data['project'] = [
'company' => $project['company'],
'domain' => (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ''),
'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''),
'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''),
'domain' => $domain_info['domain'] ?? '',
'domain_info' => $domain_info['domain_info'] ?? '',
'cert_info' => $domain_info['cert_info'] ?? '',
'plan' => Project::planMap()[$project['deploy_build']['plan']],
'keyword_num' => $project['deploy_build']['keyword_num'],
'compliance_day' => $rank['compliance_day'] ?? 0,
... ...
... ... @@ -28,11 +28,11 @@ class ProjectAssociation extends Model
# AICC朋友昵称
$isRes->nickname = $data['nickname'] ?? 0;
# AICC用户ID
$isRes->user_id = $data['user_id'] ?? 0;
$isRes->user_id = $data['user_id'] ?? 0;
# AICC用户姓名
$isRes->user_name = $data['user_name'] ?? '';
# AICC朋友头像
$isRes->image = $data['image'] ?? '';
$isRes->image = $data['image'] ?? '';
return $isRes->save();
}
... ... @@ -55,9 +55,9 @@ class ProjectAssociation extends Model
{
$status = 1; # 1 - 正常, 0 - 禁用
$lists = self::query()->where('status', $status)
->whereNotNull('project_id')
->whereNotNull('friend_id')
->whereNotNull('user_id')
->where('project_id', '!=', 0)
->where('friend_id', '!=', 0)
->where('user_id', '!=', 0)
->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page);
$items = $lists->Items();
$totalPage = $lists->lastPage();
... ...
... ... @@ -56,11 +56,9 @@ class RouteMap extends Base
$i=1;
$sign = generateRoute($title);
$route = $sign;
if($source != BTemplate::SOURCE_PRODUCT){
while(self::isExist($route, $source, $source_id, $project_id)){
$route = $sign .'-'.$i;
$i++;
}
while(self::isExist($route, $source, $source_id, $project_id)){
$route = $sign .'-'.$i;
$i++;
}
return $route;
}
... ...
... ... @@ -95,17 +95,8 @@ class CosService
],
]);
$opts = [
'http' => [
'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
];
try {
$body = file_get_contents($file_url,false,stream_context_create($opts));
$body = curl_c($file_url,false);
}catch (\Exception $e){
return '';
}
... ...