作者 lyh

gx

@@ -8,6 +8,7 @@ use App\Helper\OaGlobalsoApi; @@ -8,6 +8,7 @@ use App\Helper\OaGlobalsoApi;
8 use App\Models\Channel\Channel; 8 use App\Models\Channel\Channel;
9 use App\Models\Com\NoticeLog; 9 use App\Models\Com\NoticeLog;
10 use App\Models\Com\UpdateLog; 10 use App\Models\Com\UpdateLog;
  11 +use App\Models\Com\UpdateVisit;
11 use App\Models\Project\After; 12 use App\Models\Project\After;
12 use App\Models\Project\DeployBuild; 13 use App\Models\Project\DeployBuild;
13 use App\Models\Project\DeployOptimize; 14 use App\Models\Project\DeployOptimize;
@@ -244,6 +245,7 @@ class SyncProject extends Command @@ -244,6 +245,7 @@ class SyncProject extends Command
244 foreach ($task_list as $task){ 245 foreach ($task_list as $task){
245 UpdateLog::createLog($id,$task,$param['get_data_url']); 246 UpdateLog::createLog($id,$task,$param['get_data_url']);
246 } 247 }
  248 + UpdateVisit::createLog($id,$param['get_data_url']);
247 } 249 }
248 DB::commit(); 250 DB::commit();
249 }catch (\Exception $e){ 251 }catch (\Exception $e){
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Test; @@ -5,6 +5,7 @@ namespace App\Console\Commands\Test;
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 use App\Models\Collect\CollectTask; 6 use App\Models\Collect\CollectTask;
7 use App\Models\Com\UpdateLog; 7 use App\Models\Com\UpdateLog;
  8 +use App\Models\Com\UpdateVisit;
8 use App\Models\Product\Product; 9 use App\Models\Product\Product;
9 use App\Services\ProjectServer; 10 use App\Services\ProjectServer;
10 use Illuminate\Console\Command; 11 use Illuminate\Console\Command;
@@ -29,31 +30,12 @@ class Temp extends Command @@ -29,31 +30,12 @@ class Temp extends Command
29 30
30 public function handle() 31 public function handle()
31 { 32 {
32 - $data_project = [162];  
33 -  
34 - foreach ($data_project as $project_id) {  
35 - $project = ProjectServer::useProject($project_id);  
36 - if ($project) {  
37 - $list = Product::get();  
38 - foreach ($list as $item) {  
39 - $seo = $item->seo_mate;  
40 - if ($seo) {  
41 - $seo['title'] = substr(strip_tags($seo['title']??''), 0, 70);  
42 - $seo['keyword'] = substr(strip_tags($seo['keyword']??''), 0, 255);  
43 - $seo['description'] = substr(strip_tags($seo['description']??''), 0, 200);  
44 - $item->seo_mate = Arr::a2s($seo);  
45 - try {  
46 - $item->save();  
47 - }catch (\Exception $e){  
48 - continue;  
49 - }  
50 - }  
51 - }  
52 - }  
53 - //关闭数据库  
54 - DB::disconnect('custom_mysql');  
55 -  
56 - echo $project_id . '成功, product' . PHP_EOL; 33 + $data = UpdateLog::where('api_type','website_info')->get();
  34 +
  35 + foreach ($data as $item) {
  36 + UpdateVisit::createLog($item->project_id,$item->api_url);
  37 +
  38 + echo $item->project_id . '成功' . PHP_EOL;
57 } 39 }
58 } 40 }
59 } 41 }
@@ -197,7 +197,9 @@ class HtmlCollect extends Command @@ -197,7 +197,9 @@ class HtmlCollect extends Command
197 $img = $result_img[2] ?? []; 197 $img = $result_img[2] ?? [];
198 foreach ($img as $vi) { 198 foreach ($img as $vi) {
199 $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url); 199 $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url);
200 - $check_vi && $source[] = $check_vi; 200 + if ($check_vi && (!in_array($check_vi, $source))) {
  201 + $check_vi && $source[] = $check_vi;
  202 + }
201 } 203 }
202 204
203 //js 205 //js
@@ -205,7 +207,9 @@ class HtmlCollect extends Command @@ -205,7 +207,9 @@ class HtmlCollect extends Command
205 $js = $result_js[2] ?? []; 207 $js = $result_js[2] ?? [];
206 foreach ($js as $vj) { 208 foreach ($js as $vj) {
207 $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url); 209 $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url);
208 - $check_vj && $source[] = $check_vj; 210 + if ($check_vj && (!in_array($check_vj, $source))) {
  211 + $check_vj && $source[] = $check_vj;
  212 + }
209 } 213 }
210 214
211 //video 215 //video
@@ -213,7 +217,9 @@ class HtmlCollect extends Command @@ -213,7 +217,9 @@ class HtmlCollect extends Command
213 $video = $result_video[2] ?? []; 217 $video = $result_video[2] ?? [];
214 foreach ($video as $vv) { 218 foreach ($video as $vv) {
215 $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url); 219 $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url);
216 - $check_vv && $source[] = $check_vv; 220 + if ($check_vv && (!in_array($check_vv, $source))) {
  221 + $check_vv && $source[] = $check_vv;
  222 + }
217 } 223 }
218 224
219 //css 225 //css
@@ -221,7 +227,9 @@ class HtmlCollect extends Command @@ -221,7 +227,9 @@ class HtmlCollect extends Command
221 $css = $result_css[2] ?? []; 227 $css = $result_css[2] ?? [];
222 foreach ($css as $vc) { 228 foreach ($css as $vc) {
223 $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url); 229 $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url);
224 - $check_vc && $source[] = $check_vc; 230 + if ($check_vc && (!in_array($check_vc, $source))) {
  231 + $check_vc && $source[] = $check_vc;
  232 + }
225 } 233 }
226 234
227 //css background 235 //css background
@@ -229,7 +237,9 @@ class HtmlCollect extends Command @@ -229,7 +237,9 @@ class HtmlCollect extends Command
229 $css_b = $result_css_b[1] ?? []; 237 $css_b = $result_css_b[1] ?? [];
230 foreach ($css_b as $vc_b) { 238 foreach ($css_b as $vc_b) {
231 $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url); 239 $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url);
232 - $check_vc_b && $source[] = $check_vc_b; 240 + if ($check_vc_b && (!in_array($check_vc_b, $source))) {
  241 + $check_vc_b && $source[] = $check_vc_b;
  242 + }
233 } 243 }
234 244
235 //a标签下载资源 245 //a标签下载资源
@@ -237,7 +247,9 @@ class HtmlCollect extends Command @@ -237,7 +247,9 @@ class HtmlCollect extends Command
237 $down = $result_a[2] ?? []; 247 $down = $result_a[2] ?? [];
238 foreach ($down as $vd) { 248 foreach ($down as $vd) {
239 $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url); 249 $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url);
240 - $check_vd && $source[] = $check_vd; 250 + if ($check_vd && (!in_array($check_vd, $source))) {
  251 + $check_vd && $source[] = $check_vd;
  252 + }
241 } 253 }
242 254
243 return $source; 255 return $source;
@@ -10,6 +10,7 @@ use App\Models\RouteMap\RouteMap; @@ -10,6 +10,7 @@ use App\Models\RouteMap\RouteMap;
10 use App\Services\CosService; 10 use App\Services\CosService;
11 use App\Services\ProjectServer; 11 use App\Services\ProjectServer;
12 use Illuminate\Console\Command; 12 use Illuminate\Console\Command;
  13 +use Illuminate\Support\Facades\Cache;
13 use Illuminate\Support\Facades\DB; 14 use Illuminate\Support\Facades\DB;
14 use Illuminate\Support\Facades\Redis; 15 use Illuminate\Support\Facades\Redis;
15 16
@@ -78,7 +79,8 @@ class HtmlLanguageCollect extends Command @@ -78,7 +79,8 @@ class HtmlLanguageCollect extends Command
78 $collect_info->save(); 79 $collect_info->save();
79 80
80 //获取站点正式和测试域名 81 //获取站点正式和测试域名
81 - $old_info = UpdateOldInfo::getOldDomain($project_id, $collect_info->domain); 82 + $domain_en = $this->get_domain_en($project_id);
  83 + $old_info = UpdateOldInfo::getOldDomain($project_id, $domain_en);
82 84
83 //采集html页面,下载资源到本地并替换 85 //采集html页面,下载资源到本地并替换
84 try { 86 try {
@@ -99,10 +101,10 @@ class HtmlLanguageCollect extends Command @@ -99,10 +101,10 @@ class HtmlLanguageCollect extends Command
99 $new_html = str_replace($v64, '', $new_html); 101 $new_html = str_replace($v64, '', $new_html);
100 } 102 }
101 103
102 - $source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']); 104 + $source_list = $this->html_preg($new_html, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);
103 105
104 if ($source_list) { 106 if ($source_list) {
105 - $html = $this->upload_source($html, $source_list, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']); 107 + $html = $this->upload_source($html, $source_list, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);
106 } 108 }
107 } catch (\Exception $e) { 109 } catch (\Exception $e) {
108 $collect_info->status = CollectTask::STATUS_FAIL; 110 $collect_info->status = CollectTask::STATUS_FAIL;
@@ -183,6 +185,20 @@ class HtmlLanguageCollect extends Command @@ -183,6 +185,20 @@ class HtmlLanguageCollect extends Command
183 return $task_id; 185 return $task_id;
184 } 186 }
185 187
  188 + //获取英文站域名
  189 + protected function get_domain_en($project_id)
  190 + {
  191 + $key = 'console_html_language_domain_en';
  192 + $domain = Cache::get($key);
  193 + if (!$domain) {
  194 + $domain = CollectTask::where('project_id', $project_id)->where('language', '')->value('domain');
  195 +
  196 + Cache::add($key, $domain, 3600);
  197 + }
  198 +
  199 + return $domain;
  200 + }
  201 +
186 //正则匹配html资源 202 //正则匹配html资源
187 protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url) 203 protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url)
188 { 204 {
@@ -197,7 +213,9 @@ class HtmlLanguageCollect extends Command @@ -197,7 +213,9 @@ class HtmlLanguageCollect extends Command
197 $img = $result_img[2] ?? []; 213 $img = $result_img[2] ?? [];
198 foreach ($img as $vi) { 214 foreach ($img as $vi) {
199 $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url); 215 $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url);
200 - $check_vi && $source[] = $check_vi; 216 + if ($check_vi && (!in_array($check_vi, $source))) {
  217 + $check_vi && $source[] = $check_vi;
  218 + }
201 } 219 }
202 220
203 //js 221 //js
@@ -205,7 +223,9 @@ class HtmlLanguageCollect extends Command @@ -205,7 +223,9 @@ class HtmlLanguageCollect extends Command
205 $js = $result_js[2] ?? []; 223 $js = $result_js[2] ?? [];
206 foreach ($js as $vj) { 224 foreach ($js as $vj) {
207 $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url); 225 $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url);
208 - $check_vj && $source[] = $check_vj; 226 + if ($check_vj && (!in_array($check_vj, $source))) {
  227 + $check_vj && $source[] = $check_vj;
  228 + }
209 } 229 }
210 230
211 //video 231 //video
@@ -213,7 +233,9 @@ class HtmlLanguageCollect extends Command @@ -213,7 +233,9 @@ class HtmlLanguageCollect extends Command
213 $video = $result_video[2] ?? []; 233 $video = $result_video[2] ?? [];
214 foreach ($video as $vv) { 234 foreach ($video as $vv) {
215 $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url); 235 $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url);
216 - $check_vv && $source[] = $check_vv; 236 + if ($check_vv && (!in_array($check_vv, $source))) {
  237 + $check_vv && $source[] = $check_vv;
  238 + }
217 } 239 }
218 240
219 //css 241 //css
@@ -221,7 +243,9 @@ class HtmlLanguageCollect extends Command @@ -221,7 +243,9 @@ class HtmlLanguageCollect extends Command
221 $css = $result_css[2] ?? []; 243 $css = $result_css[2] ?? [];
222 foreach ($css as $vc) { 244 foreach ($css as $vc) {
223 $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url); 245 $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url);
224 - $check_vc && $source[] = $check_vc; 246 + if ($check_vc && (!in_array($check_vc, $source))) {
  247 + $check_vc && $source[] = $check_vc;
  248 + }
225 } 249 }
226 250
227 //css background 251 //css background
@@ -229,7 +253,9 @@ class HtmlLanguageCollect extends Command @@ -229,7 +253,9 @@ class HtmlLanguageCollect extends Command
229 $css_b = $result_css_b[1] ?? []; 253 $css_b = $result_css_b[1] ?? [];
230 foreach ($css_b as $vc_b) { 254 foreach ($css_b as $vc_b) {
231 $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url); 255 $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url);
232 - $check_vc_b && $source[] = $check_vc_b; 256 + if ($check_vc_b && (!in_array($check_vc_b, $source))) {
  257 + $check_vc_b && $source[] = $check_vc_b;
  258 + }
233 } 259 }
234 260
235 //a标签下载资源 261 //a标签下载资源
@@ -237,7 +263,9 @@ class HtmlLanguageCollect extends Command @@ -237,7 +263,9 @@ class HtmlLanguageCollect extends Command
237 $down = $result_a[2] ?? []; 263 $down = $result_a[2] ?? [];
238 foreach ($down as $vd) { 264 foreach ($down as $vd) {
239 $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url); 265 $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url);
240 - $check_vd && $source[] = $check_vd; 266 + if ($check_vd && (!in_array($check_vd, $source))) {
  267 + $check_vd && $source[] = $check_vd;
  268 + }
241 } 269 }
242 270
243 return $source; 271 return $source;
@@ -94,6 +94,10 @@ class ProjectVisit extends Command @@ -94,6 +94,10 @@ class ProjectVisit extends Command
94 if (isset($item['id']) && $item['id']) { 94 if (isset($item['id']) && $item['id']) {
95 if ($item['id'] > $task->max_id) { 95 if ($item['id'] > $task->max_id) {
96 $url_arr = parse_url($item['request'] ?? ''); 96 $url_arr = parse_url($item['request'] ?? '');
  97 + $domain = $url_arr['host'] ?? '';
  98 + if(strlen($domain) > 50){
  99 + continue;
  100 + }
97 $insert[] = [ 101 $insert[] = [
98 'url' => $item['request'] ?? '', 102 'url' => $item['request'] ?? '',
99 'referrer_url' => $item['referrer'] ?? '', 103 'referrer_url' => $item['referrer'] ?? '',
@@ -101,7 +105,7 @@ class ProjectVisit extends Command @@ -101,7 +105,7 @@ class ProjectVisit extends Command
101 'country' => $item['ip_area'] ?? '', 105 'country' => $item['ip_area'] ?? '',
102 'ip' => $item['ip'] ?? '', 106 'ip' => $item['ip'] ?? '',
103 'depth' => $item['pv'], 107 'depth' => $item['pv'],
104 - 'domain' => $url_arr['host'] ?? '', 108 + 'domain' => $domain,
105 'is_inquiry' => $item['is_cf'] ?? 0, 109 'is_inquiry' => $item['is_cf'] ?? 0,
106 'created_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()), 110 'created_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()),
107 'updated_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()), 111 'updated_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()),
@@ -14,7 +14,10 @@ use App\Http\Controllers\Bside\BaseController; @@ -14,7 +14,10 @@ use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\CustomModule\CustomModuleExtendLogic; 14 use App\Http\Logic\Bside\CustomModule\CustomModuleExtendLogic;
15 use App\Models\CustomModule\CustomModuleExtend; 15 use App\Models\CustomModule\CustomModuleExtend;
16 use App\Models\CustomModule\CustomModuleExtentContent; 16 use App\Models\CustomModule\CustomModuleExtentContent;
  17 +<<<<<<< HEAD
17 use App\Models\Product\Extend; 18 use App\Models\Product\Extend;
  19 +=======
  20 +>>>>>>> 8cd12bff1a9683bab5e510abdf95218a42999a27
18 21
19 class CustomModuleExtentController extends BaseController 22 class CustomModuleExtentController extends BaseController
20 { 23 {
@@ -84,6 +87,7 @@ class CustomModuleExtentController extends BaseController @@ -84,6 +87,7 @@ class CustomModuleExtentController extends BaseController
84 } 87 }
85 88
86 /** 89 /**
  90 +<<<<<<< HEAD
87 * @remark :获取扩展模块的扩展字段 91 * @remark :获取扩展模块的扩展字段
88 * @name :lists 92 * @name :lists
89 * @author :lyh 93 * @author :lyh
@@ -100,4 +104,17 @@ class CustomModuleExtentController extends BaseController @@ -100,4 +104,17 @@ class CustomModuleExtentController extends BaseController
100 $this->response('success',Code::SUCCESS,$lists); 104 $this->response('success',Code::SUCCESS,$lists);
101 } 105 }
102 106
  107 +=======
  108 + * @remark :
  109 + * @name :getExtendContentList
  110 + * @author :lyh
  111 + * @method :post
  112 + * @time :2023/12/20 15:21
  113 + */
  114 + public function getExtendContentList(){
  115 + $extendContentModel = new CustomModuleExtentContent();
  116 + $lists = $extend->list($this->map);
  117 + $this->response('success',Code::SUCCESS,$lists);
  118 + }
  119 +>>>>>>> 8cd12bff1a9683bab5e510abdf95218a42999a27
103 } 120 }
@@ -81,6 +81,7 @@ class CollectLogic extends Logic @@ -81,6 +81,7 @@ class CollectLogic extends Logic
81 $data =[]; 81 $data =[];
82 foreach ($list['list'] as $item){ 82 foreach ($list['list'] as $item){
83 //关键词标签 没有就取seo 键词 83 //关键词标签 没有就取seo 键词
  84 + $keyword = '';
84 if($item['keyword_id']){ 85 if($item['keyword_id']){
85 $keyword = Keyword::whereIn('id', $item['keyword_id'])->pluck('title')->toArray(); 86 $keyword = Keyword::whereIn('id', $item['keyword_id'])->pluck('title')->toArray();
86 if($keyword){ 87 if($keyword){
@@ -36,12 +36,12 @@ class UpdateOldInfo extends Model @@ -36,12 +36,12 @@ class UpdateOldInfo extends Model
36 $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); 36 $web_url_arr = parse_url($data_config['web_url_domain'] ?? '');
37 $old_domain_online = $web_url_arr['host'] ?? ''; 37 $old_domain_online = $web_url_arr['host'] ?? '';
38 38
39 - if ($link_type && $old_domain_test && $old_domain_online) { 39 + if ($old_domain_test || $old_domain_online) {
40 $info = new self(); 40 $info = new self();
41 $info->project_id = $project_id; 41 $info->project_id = $project_id;
42 $info->link_type = $link_type; 42 $info->link_type = $link_type;
43 - $info->old_domain_test = $old_domain_test;  
44 - $info->old_domain_online = $old_domain_online; 43 + $info->old_domain_test = $old_domain_test ?: $domain;
  44 + $info->old_domain_online = $old_domain_online ?: $domain;
45 $info->save(); 45 $info->save();
46 } 46 }
47 47
@@ -12,4 +12,39 @@ class UpdateVisit extends Model @@ -12,4 +12,39 @@ class UpdateVisit extends Model
12 const STATUS_UN = 0;//未开始 12 const STATUS_UN = 0;//未开始
13 const STATUS_ING = 1;//导入中 13 const STATUS_ING = 1;//导入中
14 const STATUS_COM = 2;//导入完成 14 const STATUS_COM = 2;//导入完成
  15 +
  16 + /**
  17 + * 创建更新日志
  18 + * @param $project_id
  19 + * @param $url
  20 + * @return mixed
  21 + */
  22 + public static function createLog($project_id, $url)
  23 + {
  24 + $count = self::where('project_id', $project_id)->count('id');
  25 + if (!$count) {
  26 + $time = date('Y-m-d H:i:s');
  27 + $data = [
  28 + [
  29 + 'project_id' => $project_id,
  30 + 'api_type' => 'visit_list',
  31 + 'api_url' => str_replace('update_v6.php?w=website_info&page=1&pagesize=20', 'extend_api.php', $url),
  32 + 'sort' => 0,
  33 + 'created_at' => $time,
  34 + 'updated_at' => $time
  35 + ],
  36 + [
  37 + 'project_id' => $project_id,
  38 + 'api_type' => 'visit_detail_list',
  39 + 'api_url' => str_replace('update_v6.php?w=website_info&page=1&pagesize=20', 'extend_api.php', $url),
  40 + 'sort' => 1,
  41 + 'created_at' => $time,
  42 + 'updated_at' => $time
  43 + ]
  44 + ];
  45 +
  46 + return self::insert($data);
  47 + }
  48 + return true;
  49 + }
15 } 50 }