Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
9 个修改的文件
包含
106 行增加
和
22 行删除
| @@ -94,11 +94,20 @@ class HtmlCollect extends Command | @@ -94,11 +94,20 @@ class HtmlCollect extends Command | ||
| 94 | 94 | ||
| 95 | //采集html页面,下载资源到本地并替换 | 95 | //采集html页面,下载资源到本地并替换 |
| 96 | try { | 96 | try { |
| 97 | - $html = file_get_contents('https://' . $collect_info->domain . $collect_info->route); | 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)); | ||
| 98 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); | 107 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); |
| 99 | 108 | ||
| 100 | if ($source_list) { | 109 | if ($source_list) { |
| 101 | - $html = $this->upload_source($html, $source_list, $project_id); | 110 | + $html = $this->upload_source($html, $source_list, $project_id, $opts); |
| 102 | } | 111 | } |
| 103 | } catch (\Exception $e) { | 112 | } catch (\Exception $e) { |
| 104 | $collect_info->status = CollectTask::STATUS_FAIL; | 113 | $collect_info->status = CollectTask::STATUS_FAIL; |
| @@ -271,7 +280,7 @@ class HtmlCollect extends Command | @@ -271,7 +280,7 @@ class HtmlCollect extends Command | ||
| 271 | } | 280 | } |
| 272 | 281 | ||
| 273 | //下载并替换资源 | 282 | //下载并替换资源 |
| 274 | - protected function upload_source($html, $source, $project_id) | 283 | + protected function upload_source($html, $source, $project_id, $opts) |
| 275 | { | 284 | { |
| 276 | foreach ($source as $vs) { | 285 | foreach ($source as $vs) { |
| 277 | 286 | ||
| @@ -289,7 +298,7 @@ class HtmlCollect extends Command | @@ -289,7 +298,7 @@ class HtmlCollect extends Command | ||
| 289 | 298 | ||
| 290 | if (substr($new_source, -3, 3) == 'css') { | 299 | if (substr($new_source, -3, 3) == 'css') { |
| 291 | // 下载css文件中的资源 | 300 | // 下载css文件中的资源 |
| 292 | - $css_html = file_get_contents($vs['url_complete']); | 301 | + $css_html = file_get_contents($vs['url_complete'], false, stream_context_create($opts)); |
| 293 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); | 302 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); |
| 294 | $css_source = $result_css_source[1] ?? []; | 303 | $css_source = $result_css_source[1] ?? []; |
| 295 | 304 |
| @@ -93,11 +93,20 @@ class HtmlLanguageCollect extends Command | @@ -93,11 +93,20 @@ class HtmlLanguageCollect extends Command | ||
| 93 | 93 | ||
| 94 | //采集html页面,下载资源到本地并替换 | 94 | //采集html页面,下载资源到本地并替换 |
| 95 | try { | 95 | try { |
| 96 | - $html = file_get_contents('https://' . $collect_info->domain . $collect_info->route); | 96 | + $opts = [ |
| 97 | + 'http' => [ | ||
| 98 | + 'header' => 'User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' | ||
| 99 | + ], | ||
| 100 | + 'ssl' => [ | ||
| 101 | + 'verify_peer' => false, | ||
| 102 | + 'verify_peer_name' => false, | ||
| 103 | + ] | ||
| 104 | + ]; | ||
| 105 | + $html = file_get_contents('https://' . $collect_info->domain . $collect_info->route, false, stream_context_create($opts)); | ||
| 97 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); | 106 | $source_list = $this->html_preg($html, $project_id, $collect_info->domain, $web_url_domain, $home_url); |
| 98 | 107 | ||
| 99 | if ($source_list) { | 108 | if ($source_list) { |
| 100 | - $html = $this->upload_source($html, $source_list, $project_id); | 109 | + $html = $this->upload_source($html, $source_list, $project_id, $opts); |
| 101 | } | 110 | } |
| 102 | } catch (\Exception $e) { | 111 | } catch (\Exception $e) { |
| 103 | $collect_info->status = CollectTask::STATUS_FAIL; | 112 | $collect_info->status = CollectTask::STATUS_FAIL; |
| @@ -270,7 +279,7 @@ class HtmlLanguageCollect extends Command | @@ -270,7 +279,7 @@ class HtmlLanguageCollect extends Command | ||
| 270 | } | 279 | } |
| 271 | 280 | ||
| 272 | //下载并替换资源 | 281 | //下载并替换资源 |
| 273 | - protected function upload_source($html, $source, $project_id) | 282 | + protected function upload_source($html, $source, $project_id, $opts) |
| 274 | { | 283 | { |
| 275 | foreach ($source as $vs) { | 284 | foreach ($source as $vs) { |
| 276 | 285 | ||
| @@ -288,7 +297,7 @@ class HtmlLanguageCollect extends Command | @@ -288,7 +297,7 @@ class HtmlLanguageCollect extends Command | ||
| 288 | 297 | ||
| 289 | if (substr($new_source, -3, 3) == 'css') { | 298 | if (substr($new_source, -3, 3) == 'css') { |
| 290 | // 下载css文件中的资源 | 299 | // 下载css文件中的资源 |
| 291 | - $css_html = file_get_contents($vs['url_complete']); | 300 | + $css_html = file_get_contents($vs['url_complete'], false, stream_context_create($opts)); |
| 292 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); | 301 | preg_match_all("/url\(['\"](\s*[^>]+?)['\"]\)/i", $css_html, $result_css_source); |
| 293 | $css_source = $result_css_source[1] ?? []; | 302 | $css_source = $result_css_source[1] ?? []; |
| 294 | 303 |
| @@ -83,17 +83,11 @@ class IndexController extends BaseController | @@ -83,17 +83,11 @@ class IndexController extends BaseController | ||
| 83 | $this->request->validate([ | 83 | $this->request->validate([ |
| 84 | 'data' => 'required|array', | 84 | 'data' => 'required|array', |
| 85 | 'identifying'=>'required', | 85 | 'identifying'=>'required', |
| 86 | - 'code'=>'required' | ||
| 87 | ], [ | 86 | ], [ |
| 88 | 'data.required' => '自定义询盘数据不为空', | 87 | 'data.required' => '自定义询盘数据不为空', |
| 89 | 'data.array' => '必须为数组', | 88 | 'data.array' => '必须为数组', |
| 90 | 'identifying.required' => '唯一标识不为空', | 89 | 'identifying.required' => '唯一标识不为空', |
| 91 | - 'code'=>'加密串不能为空' | ||
| 92 | ]); | 90 | ]); |
| 93 | - $code = base64_encode(md5($this->param['identifying'])); | ||
| 94 | - if($code != $this->param['code']){ | ||
| 95 | - $this->response('签名错误',Code::SYSTEM_ERROR); | ||
| 96 | - } | ||
| 97 | $inquiryModel = new InquiryData(); | 91 | $inquiryModel = new InquiryData(); |
| 98 | $rs = $inquiryModel->add($this->param); | 92 | $rs = $inquiryModel->add($this->param); |
| 99 | if($rs === false){ | 93 | if($rs === false){ |
| @@ -101,5 +95,5 @@ class IndexController extends BaseController | @@ -101,5 +95,5 @@ class IndexController extends BaseController | ||
| 101 | } | 95 | } |
| 102 | $this->response('success'); | 96 | $this->response('success'); |
| 103 | } | 97 | } |
| 104 | - | 98 | + |
| 105 | } | 99 | } |
| @@ -817,11 +817,41 @@ class ProjectController extends BaseController | @@ -817,11 +817,41 @@ class ProjectController extends BaseController | ||
| 817 | * @time :2023/11/17 15:23 | 817 | * @time :2023/11/17 15:23 |
| 818 | */ | 818 | */ |
| 819 | public function saveOtherProject(ProjectLogic $logic){ | 819 | public function saveOtherProject(ProjectLogic $logic){ |
| 820 | + $this->request->validate([ | ||
| 821 | + 'id'=>'required', | ||
| 822 | + 'aicc'=>'required', | ||
| 823 | + 'hagro'=>'required', | ||
| 824 | + 'exclusive_aicc_day'=>'required', | ||
| 825 | + 'exclusive_hagro_day'=>'required', | ||
| 826 | + ],[ | ||
| 827 | + 'id.required' => 'id不能为空', | ||
| 828 | + 'aicc.required' => 'aicc是否开启不能为空', | ||
| 829 | + 'hagro.required' => 'hagro是否开启不能为空', | ||
| 830 | + 'exclusive_aicc_day.required' => '服务天数不能为空', | ||
| 831 | + 'exclusive_hagro_day.required' => '服务天数不能为空', | ||
| 832 | + ]); | ||
| 820 | $logic->saveOtherProject(); | 833 | $logic->saveOtherProject(); |
| 821 | $this->response('success'); | 834 | $this->response('success'); |
| 822 | } | 835 | } |
| 823 | 836 | ||
| 824 | /** | 837 | /** |
| 838 | + * @remark :获取其他项目配置 | ||
| 839 | + * @name :getOtherProject | ||
| 840 | + * @author :lyh | ||
| 841 | + * @method :post | ||
| 842 | + * @time :2023/11/17 15:23 | ||
| 843 | + */ | ||
| 844 | + public function getOtherProject(ProjectLogic $logic){ | ||
| 845 | + $this->request->validate([ | ||
| 846 | + 'id'=>'required', | ||
| 847 | + ],[ | ||
| 848 | + 'id.required' => 'id不能为空', | ||
| 849 | + ]); | ||
| 850 | + $info = $logic->getOtherProject(); | ||
| 851 | + $this->response('success',Code::SUCCESS,$info); | ||
| 852 | + } | ||
| 853 | + | ||
| 854 | + /** | ||
| 825 | * @remark :获取渠道信息 | 855 | * @remark :获取渠道信息 |
| 826 | * @name :getChannel | 856 | * @name :getChannel |
| 827 | * @author :lyh | 857 | * @author :lyh |
| @@ -110,4 +110,13 @@ class NavController extends BaseController | @@ -110,4 +110,13 @@ class NavController extends BaseController | ||
| 110 | $navLogic->navSort(); | 110 | $navLogic->navSort(); |
| 111 | $this->response('success'); | 111 | $this->response('success'); |
| 112 | } | 112 | } |
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * 一键导入子菜单 | ||
| 116 | + * @author zbj | ||
| 117 | + * @date 2023/11/21 | ||
| 118 | + */ | ||
| 119 | + public function import(){ | ||
| 120 | + | ||
| 121 | + } | ||
| 113 | } | 122 | } |
| @@ -710,4 +710,16 @@ class ProjectLogic extends BaseLogic | @@ -710,4 +710,16 @@ class ProjectLogic extends BaseLogic | ||
| 710 | return $this->success($this->param); | 710 | return $this->success($this->param); |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | + /** | ||
| 714 | + * @remark :获取其他配置 | ||
| 715 | + * @name :getOtherProject | ||
| 716 | + * @author :lyh | ||
| 717 | + * @method :post | ||
| 718 | + * @time :2023/11/21 15:45 | ||
| 719 | + */ | ||
| 720 | + public function getOtherProject(){ | ||
| 721 | + $info = $this->model->read(['id'=>$this->param['id']],['aicc','hagro','exclusive_aicc_day','exclusive_hagro_day']); | ||
| 722 | + return $this->success($info); | ||
| 723 | + } | ||
| 724 | + | ||
| 713 | } | 725 | } |
| @@ -21,6 +21,7 @@ class BNav extends Base | @@ -21,6 +21,7 @@ class BNav extends Base | ||
| 21 | use SoftDeletes; | 21 | use SoftDeletes; |
| 22 | 22 | ||
| 23 | public $hidden = ['deleted_at']; | 23 | public $hidden = ['deleted_at']; |
| 24 | + public $appends = ['able_import']; | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| @@ -74,4 +75,19 @@ class BNav extends Base | @@ -74,4 +75,19 @@ class BNav extends Base | ||
| 74 | $value = getImageUrl($value); | 75 | $value = getImageUrl($value); |
| 75 | return $value; | 76 | return $value; |
| 76 | } | 77 | } |
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 是否支持一键导入 | ||
| 81 | + * @param $value | ||
| 82 | + * @return int | ||
| 83 | + * @author zbj | ||
| 84 | + * @date 2023/11/21 | ||
| 85 | + */ | ||
| 86 | + public function getAbleImportAttribute($value) | ||
| 87 | + { | ||
| 88 | + if(in_array($this->url, ['products','news','blogs'])){ | ||
| 89 | + return 1; | ||
| 90 | + } | ||
| 91 | + return 0; | ||
| 92 | + } | ||
| 77 | } | 93 | } |
| @@ -6,6 +6,7 @@ use App\Helper\Translate; | @@ -6,6 +6,7 @@ use App\Helper\Translate; | ||
| 6 | use App\Http\Logic\Aside\Project\ProjectLogic; | 6 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 7 | use App\Models\Base; | 7 | use App\Models\Base; |
| 8 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 9 | +use App\Models\Template\BTemplate; | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * 路由映射表 | 12 | * 路由映射表 |
| @@ -55,9 +56,17 @@ class RouteMap extends Base | @@ -55,9 +56,17 @@ class RouteMap extends Base | ||
| 55 | $i=1; | 56 | $i=1; |
| 56 | $sign = generateRoute($title); | 57 | $sign = generateRoute($title); |
| 57 | $route = $sign; | 58 | $route = $sign; |
| 59 | + if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 60 | + $route = $sign.'-product'; | ||
| 61 | + }elseif ($source == 5){ | ||
| 62 | + $route = $sign.'-tag'; | ||
| 63 | + } | ||
| 58 | while(self::isExist($route, $source, $source_id, $project_id)){ | 64 | while(self::isExist($route, $source, $source_id, $project_id)){ |
| 59 | - $route = $sign .'-'.$i; | ||
| 60 | - $i++; | 65 | + if($source == BTemplate::SOURCE_PRODUCT){ |
| 66 | + $route = $sign .'-'.$i.'-product'; | ||
| 67 | + }elseif ($source == 5){ | ||
| 68 | + $route = $sign .'-'.$i.'-tag'; | ||
| 69 | + } | ||
| 61 | } | 70 | } |
| 62 | return $route; | 71 | return $route; |
| 63 | } | 72 | } |
| @@ -119,11 +128,6 @@ class RouteMap extends Base | @@ -119,11 +128,6 @@ class RouteMap extends Base | ||
| 119 | if(!$route_map){ | 128 | if(!$route_map){ |
| 120 | $route_map = new self(); | 129 | $route_map = new self(); |
| 121 | $route_map->source = $source; | 130 | $route_map->source = $source; |
| 122 | - if ($source == self::SOURCE_PRODUCT_KEYWORD){ | ||
| 123 | - $route = $route.'-tag'; | ||
| 124 | - }elseif ($source == self::SOURCE_PRODUCT){ | ||
| 125 | - $route = $route.'-product'; | ||
| 126 | - } | ||
| 127 | $route_map->source_id = $source_id; | 131 | $route_map->source_id = $source_id; |
| 128 | $route_map->project_id = $project_id; | 132 | $route_map->project_id = $project_id; |
| 129 | } | 133 | } |
| @@ -172,6 +172,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -172,6 +172,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 172 | Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject'); | 172 | Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject'); |
| 173 | Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token'); | 173 | Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token'); |
| 174 | Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置 | 174 | Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置 |
| 175 | + Route::any('/getOtherProject', [Aside\Project\ProjectController::class, 'getOtherProject'])->name('admin.project_getOtherProject');//获取其他项目设置 | ||
| 175 | Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置 | 176 | Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置 |
| 176 | //获取关键词前缀和后缀 | 177 | //获取关键词前缀和后缀 |
| 177 | Route::prefix('keyword')->group(function () { | 178 | Route::prefix('keyword')->group(function () { |
-
请 注册 或 登录 后发表评论