Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
9 个修改的文件
包含
47 行增加
和
73 行删除
| @@ -39,7 +39,7 @@ class ProjectFilePDF extends Command | @@ -39,7 +39,7 @@ class ProjectFilePDF extends Command | ||
| 39 | { | 39 | { |
| 40 | $this->AiccWechat = new ProjectAssociation(); | 40 | $this->AiccWechat = new ProjectAssociation(); |
| 41 | $this->DataFile = new DataFile(); | 41 | $this->DataFile = new DataFile(); |
| 42 | - $this->time = date("Y-m-d"); | 42 | + $this->time = date("Y-m"); |
| 43 | parent::__construct(); | 43 | parent::__construct(); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -121,9 +121,12 @@ class ProjectFilePDF extends Command | @@ -121,9 +121,12 @@ class ProjectFilePDF extends Command | ||
| 121 | 121 | ||
| 122 | // 获取PDF内容 | 122 | // 获取PDF内容 |
| 123 | $pdfContent = $dompdf->output(); | 123 | $pdfContent = $dompdf->output(); |
| 124 | - | 124 | + $pdf_path = public_path('PDF/'); |
| 125 | + if (!file_exists($pdf_path)) { | ||
| 126 | + mkdir($pdf_path, 0777, true); | ||
| 127 | + } | ||
| 125 | // 指定保存路径和文件名 | 128 | // 指定保存路径和文件名 |
| 126 | - $savePath = public_path('PDF/' . $filename . '.pdf'); | 129 | + $savePath = $pdf_path . $filename . '.pdf'; |
| 127 | 130 | ||
| 128 | // 将PDF内容保存到文件 | 131 | // 将PDF内容保存到文件 |
| 129 | file_put_contents($savePath, $pdfContent); | 132 | file_put_contents($savePath, $pdfContent); |
| @@ -79,7 +79,7 @@ class HtmlCollect extends Command | @@ -79,7 +79,7 @@ class HtmlCollect extends Command | ||
| 79 | $web_url_domain = $collect_info->domain; | 79 | $web_url_domain = $collect_info->domain; |
| 80 | $home_url = $collect_info->domain; | 80 | $home_url = $collect_info->domain; |
| 81 | $url_web_config = 'https://' . $collect_info->domain . '/wp-content/cache/user_config.text'; | 81 | $url_web_config = 'https://' . $collect_info->domain . '/wp-content/cache/user_config.text'; |
| 82 | - $data_config = http_get($url_web_config, ['charset' => 'UTF-8']); | 82 | + $data_config = curl_c($url_web_config); |
| 83 | if ($data_config) { | 83 | if ($data_config) { |
| 84 | $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); | 84 | $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); |
| 85 | if (isset($web_url_arr['host'])) { | 85 | if (isset($web_url_arr['host'])) { |
| @@ -94,20 +94,11 @@ class HtmlCollect extends Command | @@ -94,20 +94,11 @@ class HtmlCollect extends Command | ||
| 94 | 94 | ||
| 95 | //采集html页面,下载资源到本地并替换 | 95 | //采集html页面,下载资源到本地并替换 |
| 96 | try { | 96 | try { |
| 97 | - $opts = [ | ||
| 98 | - 'http' => [ | ||
| 99 | - 'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' | ||
| 100 | - ], | ||
| 101 | - 'ssl' => [ | ||
| 102 | - 'verify_peer' => false, | ||
| 103 | - 'verify_peer_name' => false, | ||
| 104 | - ] | ||
| 105 | - ]; | ||
| 106 | - $html = file_get_contents('https://' . $collect_info->domain . $collect_info->route, false, stream_context_create($opts)); | 97 | + $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false); |
| 107 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); | 98 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); |
| 108 | 99 | ||
| 109 | if ($source_list) { | 100 | if ($source_list) { |
| 110 | - $html = $this->upload_source($html, $source_list, $project_id, $opts); | 101 | + $html = $this->upload_source($html, $source_list, $project_id); |
| 111 | } | 102 | } |
| 112 | } catch (\Exception $e) { | 103 | } catch (\Exception $e) { |
| 113 | $collect_info->status = CollectTask::STATUS_FAIL; | 104 | $collect_info->status = CollectTask::STATUS_FAIL; |
| @@ -280,7 +271,7 @@ class HtmlCollect extends Command | @@ -280,7 +271,7 @@ class HtmlCollect extends Command | ||
| 280 | } | 271 | } |
| 281 | 272 | ||
| 282 | //下载并替换资源 | 273 | //下载并替换资源 |
| 283 | - protected function upload_source($html, $source, $project_id, $opts) | 274 | + protected function upload_source($html, $source, $project_id) |
| 284 | { | 275 | { |
| 285 | foreach ($source as $vs) { | 276 | foreach ($source as $vs) { |
| 286 | 277 | ||
| @@ -298,7 +289,7 @@ class HtmlCollect extends Command | @@ -298,7 +289,7 @@ class HtmlCollect extends Command | ||
| 298 | 289 | ||
| 299 | if (substr($new_source, -3, 3) == 'css') { | 290 | if (substr($new_source, -3, 3) == 'css') { |
| 300 | // 下载css文件中的资源 | 291 | // 下载css文件中的资源 |
| 301 | - $css_html = file_get_contents($vs['url_complete'], false, stream_context_create($opts)); | 292 | + $css_html = curl_c($vs['url_complete'], false); |
| 302 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); | 293 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); |
| 303 | $css_source = $result_css_source[1] ?? []; | 294 | $css_source = $result_css_source[1] ?? []; |
| 304 | 295 |
| @@ -54,12 +54,12 @@ class UpdateRoute extends Command | @@ -54,12 +54,12 @@ class UpdateRoute extends Command | ||
| 54 | */ | 54 | */ |
| 55 | public function handle(){ | 55 | public function handle(){ |
| 56 | $projectModel = new Project(); | 56 | $projectModel = new Project(); |
| 57 | - $lists = $projectModel->list(['is_upgrade'=>0,'type'=>['!=',0]]); | 57 | + $lists = $projectModel->list(['is_upgrade'=>0,'id'=>['>',167],'type'=>['!=',0]]); |
| 58 | foreach ($lists as $k => $v){ | 58 | foreach ($lists as $k => $v){ |
| 59 | echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL; | 59 | echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL; |
| 60 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 61 | - $this->setProductRoute($v['id']); | ||
| 62 | -// $this->setProductKeywordRoute($v['id']); | 61 | +// $this->setProductRoute($v['id']); |
| 62 | + $this->setProductKeywordRoute($v['id']); | ||
| 63 | // $this->setBlogRoute($v['id']); | 63 | // $this->setBlogRoute($v['id']); |
| 64 | // $this->setNewsRoute($v['id']); | 64 | // $this->setNewsRoute($v['id']); |
| 65 | // $this->setBlogCateRoute($v['id']); | 65 | // $this->setBlogCateRoute($v['id']); |
| @@ -194,11 +194,15 @@ class UpdateRoute extends Command | @@ -194,11 +194,15 @@ class UpdateRoute extends Command | ||
| 194 | public function setProductKeywordRoute($project_id){ | 194 | public function setProductKeywordRoute($project_id){ |
| 195 | $keywordModel = new Keyword(); | 195 | $keywordModel = new Keyword(); |
| 196 | $keywordList = $keywordModel->list([],'id',['id','route']); | 196 | $keywordList = $keywordModel->list([],'id',['id','route']); |
| 197 | - foreach ($keywordList as $v){ | ||
| 198 | - if(!ends_with($v['route'],'-tag')){ | ||
| 199 | - $route = $v['route'].'-tag'; | ||
| 200 | - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 201 | - RouteMap::setRoute($route, RouteMap::SOURCE_BLOG_CATE, $v['id'], $project_id); | 197 | + if(!empty($keywordList)){ |
| 198 | + foreach ($keywordList as $v){ | ||
| 199 | +// if(!ends_with($v['route'],'-tag')){ | ||
| 200 | +// $route = $v['route'].'-tag'; | ||
| 201 | +// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 202 | +// } | ||
| 203 | + $routeMapModel = new RouteMap(); | ||
| 204 | + $routeMapModel->edit(['route'=>$v['route']],['source_id'=>$v['id'],'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD]); | ||
| 205 | + RouteMap::setRoute($v['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $project_id); | ||
| 202 | } | 206 | } |
| 203 | } | 207 | } |
| 204 | return true; | 208 | return true; |
| @@ -32,7 +32,7 @@ class BTemplateModuleController extends BaseController | @@ -32,7 +32,7 @@ class BTemplateModuleController extends BaseController | ||
| 32 | $moduleProjectModel = new BModuleProject(); | 32 | $moduleProjectModel = new BModuleProject(); |
| 33 | $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]); | 33 | $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]); |
| 34 | $data['module_list'] = $module_list; | 34 | $data['module_list'] = $module_list; |
| 35 | - $this->response('success',Code::SUCCESS,$data); | 35 | + $this->response('success',Code::SUCCESS,$list); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /** | 38 | /** |
| @@ -4,9 +4,7 @@ namespace App\Http\Logic\Aside\Project; | @@ -4,9 +4,7 @@ namespace App\Http\Logic\Aside\Project; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Http\Logic\Aside\BaseLogic; | 6 | use App\Http\Logic\Aside\BaseLogic; |
| 7 | -use App\Models\Project\DomainInfo; | ||
| 8 | -use App\Models\Project\Payment; | ||
| 9 | -use MongoDB\Client; | 7 | +use App\Models\Domain\DomainInfo; |
| 10 | 8 | ||
| 11 | class DomainInfoLogic extends BaseLogic | 9 | class DomainInfoLogic extends BaseLogic |
| 12 | { | 10 | { |
| @@ -18,26 +16,15 @@ class DomainInfoLogic extends BaseLogic | @@ -18,26 +16,15 @@ class DomainInfoLogic extends BaseLogic | ||
| 18 | 16 | ||
| 19 | public function getDomainInfo($project_id) | 17 | public function getDomainInfo($project_id) |
| 20 | { | 18 | { |
| 21 | - $project = (new ProjectLogic())->getProjectInfo($project_id); | ||
| 22 | - $domain = (!empty($project['deploy_optimize']['domain']) ? ((new \App\Models\Domain\DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ''); | ||
| 23 | - $info = $this->model->where('project_id', $project_id)->first(); | ||
| 24 | - //不存在或时间过期了 重新获取信息 | ||
| 25 | - $expiration_date = $info['domain_info']['expiration_date'] ?? ''; | ||
| 26 | - $end_time = $info['ssl']['end_time'] ?? ''; | ||
| 27 | - if(!$info || $expiration_date < date("Y-m-d") || $end_time < date('Y-m-d')){ | ||
| 28 | - try { | ||
| 29 | - $mongo = new Client("mongodb://root:globalso8837840@23.228.125.2:27017"); | ||
| 30 | - $db = $mongo->globalso_monitor; | ||
| 31 | - $collection = $db->project_v1; | ||
| 32 | - $project_zk = $collection->findOne(['main_url' => $domain]); | ||
| 33 | - $info['domain'] = $domain; | ||
| 34 | - $info['domain_info'] = (array) $project_zk['domain_info'] ?? []; | ||
| 35 | - $info['ssl'] = (array) $project_zk['ssl'] ?? []; | ||
| 36 | - parent::save($info); | ||
| 37 | - }catch (\Exception $e){ | ||
| 38 | - return []; | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - return $info; | 19 | + $domain_info = $this->model->where('project_id', $project_id)->first(); |
| 20 | + if(!$domain_info){ | ||
| 21 | + return []; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + return [ | ||
| 25 | + 'domain' => 'https://'.$domain_info['domain'].'/', | ||
| 26 | + 'domain_info' => date('Y-m-d', strtotime($domain_info['domain_start_time'])) . ' - ' .date('Y-m-d', strtotime($domain_info['domain_end_time'])), | ||
| 27 | + 'cert_info' => date('Y-m-d', strtotime($domain_info['certificate_start_time'])) . ' - ' .date('Y-m-d', strtotime($domain_info['certificate_end_time'])), | ||
| 28 | + ]; | ||
| 42 | } | 29 | } |
| 43 | } | 30 | } |
| @@ -60,9 +60,9 @@ class RankDataLogic extends BaseLogic | @@ -60,9 +60,9 @@ class RankDataLogic extends BaseLogic | ||
| 60 | //项目信息 | 60 | //项目信息 |
| 61 | $data['project'] = [ | 61 | $data['project'] = [ |
| 62 | 'company' => $project['company'], | 62 | 'company' => $project['company'], |
| 63 | - 'domain' => (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ''), | ||
| 64 | - 'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''), | ||
| 65 | - 'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''), | 63 | + 'domain' => $domain_info['domain'] ?? '', |
| 64 | + 'domain_info' => $domain_info['domain_info'] ?? '', | ||
| 65 | + 'cert_info' => $domain_info['cert_info'] ?? '', | ||
| 66 | 'plan' => Project::planMap()[$project['deploy_build']['plan']], | 66 | 'plan' => Project::planMap()[$project['deploy_build']['plan']], |
| 67 | 'keyword_num' => $project['deploy_build']['keyword_num'], | 67 | 'keyword_num' => $project['deploy_build']['keyword_num'], |
| 68 | 'compliance_day' => $rank['compliance_day'] ?? 0, | 68 | 'compliance_day' => $rank['compliance_day'] ?? 0, |
| @@ -28,11 +28,11 @@ class ProjectAssociation extends Model | @@ -28,11 +28,11 @@ class ProjectAssociation extends Model | ||
| 28 | # AICC朋友昵称 | 28 | # AICC朋友昵称 |
| 29 | $isRes->nickname = $data['nickname'] ?? 0; | 29 | $isRes->nickname = $data['nickname'] ?? 0; |
| 30 | # AICC用户ID | 30 | # AICC用户ID |
| 31 | - $isRes->user_id = $data['user_id'] ?? 0; | 31 | + $isRes->user_id = $data['user_id'] ?? 0; |
| 32 | # AICC用户姓名 | 32 | # AICC用户姓名 |
| 33 | $isRes->user_name = $data['user_name'] ?? ''; | 33 | $isRes->user_name = $data['user_name'] ?? ''; |
| 34 | # AICC朋友头像 | 34 | # AICC朋友头像 |
| 35 | - $isRes->image = $data['image'] ?? ''; | 35 | + $isRes->image = $data['image'] ?? ''; |
| 36 | return $isRes->save(); | 36 | return $isRes->save(); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| @@ -55,9 +55,9 @@ class ProjectAssociation extends Model | @@ -55,9 +55,9 @@ class ProjectAssociation extends Model | ||
| 55 | { | 55 | { |
| 56 | $status = 1; # 1 - 正常, 0 - 禁用 | 56 | $status = 1; # 1 - 正常, 0 - 禁用 |
| 57 | $lists = self::query()->where('status', $status) | 57 | $lists = self::query()->where('status', $status) |
| 58 | - ->whereNotNull('project_id') | ||
| 59 | - ->whereNotNull('friend_id') | ||
| 60 | - ->whereNotNull('user_id') | 58 | + ->where('project_id', '!=', 0) |
| 59 | + ->where('friend_id', '!=', 0) | ||
| 60 | + ->where('user_id', '!=', 0) | ||
| 61 | ->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page); | 61 | ->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page); |
| 62 | $items = $lists->Items(); | 62 | $items = $lists->Items(); |
| 63 | $totalPage = $lists->lastPage(); | 63 | $totalPage = $lists->lastPage(); |
| @@ -56,11 +56,9 @@ class RouteMap extends Base | @@ -56,11 +56,9 @@ class RouteMap extends Base | ||
| 56 | $i=1; | 56 | $i=1; |
| 57 | $sign = generateRoute($title); | 57 | $sign = generateRoute($title); |
| 58 | $route = $sign; | 58 | $route = $sign; |
| 59 | - if($source != BTemplate::SOURCE_PRODUCT){ | ||
| 60 | - while(self::isExist($route, $source, $source_id, $project_id)){ | ||
| 61 | - $route = $sign .'-'.$i; | ||
| 62 | - $i++; | ||
| 63 | - } | 59 | + while(self::isExist($route, $source, $source_id, $project_id)){ |
| 60 | + $route = $sign .'-'.$i; | ||
| 61 | + $i++; | ||
| 64 | } | 62 | } |
| 65 | return $route; | 63 | return $route; |
| 66 | } | 64 | } |
| @@ -95,17 +95,8 @@ class CosService | @@ -95,17 +95,8 @@ class CosService | ||
| 95 | ], | 95 | ], |
| 96 | ]); | 96 | ]); |
| 97 | 97 | ||
| 98 | - $opts = [ | ||
| 99 | - 'http' => [ | ||
| 100 | - 'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' | ||
| 101 | - ], | ||
| 102 | - 'ssl' => [ | ||
| 103 | - 'verify_peer' => false, | ||
| 104 | - 'verify_peer_name' => false, | ||
| 105 | - ] | ||
| 106 | - ]; | ||
| 107 | try { | 98 | try { |
| 108 | - $body = file_get_contents($file_url,false,stream_context_create($opts)); | 99 | + $body = curl_c($file_url,false); |
| 109 | }catch (\Exception $e){ | 100 | }catch (\Exception $e){ |
| 110 | return ''; | 101 | return ''; |
| 111 | } | 102 | } |
-
请 注册 或 登录 后发表评论