作者 lyh

Merge branch 'lyh_edit' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -192,22 +192,11 @@ class DomainInfo extends Command @@ -192,22 +192,11 @@ class DomainInfo extends Command
192 public function updatePrivate($param) 192 public function updatePrivate($param)
193 { 193 {
194 $url = 'https://' . $param['domain'] . '/api/applySsl/'; 194 $url = 'https://' . $param['domain'] . '/api/applySsl/';
195 - $top_domain = $this->getTopDomain($param['domain']);  
196 - if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $param['id'] != 3) {  
197 - $extend_config = [  
198 - ['origin' => $top_domain, 'target' => $param['domain']]  
199 - ];  
200 - }  
201 $param = [ 195 $param = [
202 - 'project_id' => $param['project_id'],  
203 - 'type' => 1,  
204 - 'route' => 1,  
205 "domain" => $param['domain'], 196 "domain" => $param['domain'],
206 - "rewrite" => $extend_config ?? [],  
207 - 'other_domain' => [$top_domain, '*.' . $top_domain], 197 + "rewrite" => $param['extend_config'],
  198 + 'other_domain' => $param['other_domain'],
208 'is_https' => $param['is_https'], 199 'is_https' => $param['is_https'],
209 - 'private_key' => '',  
210 - 'cert' => ''  
211 ]; 200 ];
212 return $this->curlRequest($url, $param); 201 return $this->curlRequest($url, $param);
213 } 202 }
@@ -250,34 +239,6 @@ class DomainInfo extends Command @@ -250,34 +239,6 @@ class DomainInfo extends Command
250 return $this->curlRequest($url, $param); 239 return $this->curlRequest($url, $param);
251 } 240 }
252 241
253 - public static function getTopDomain($url)  
254 - {  
255 - $url = strtolower($url); //首先转成小写  
256 - $url = mb_ereg_replace('^( | )+', '', trim($url));  
257 - $url = mb_ereg_replace('( | )+$', '', $url);  
258 - if (!preg_match('/^(http:\/\/|https)/', $url)) {  
259 - $url = "https://" . $url;  
260 - }  
261 - $hosts = parse_url($url);  
262 - $host = $hosts['host'] ?? '';  
263 - //查看是几级域名  
264 - $data = explode('.', $host);  
265 - $n = count($data);  
266 - if ($n < 2) {  
267 - return $host;  
268 - }  
269 - //判断是否是双后缀  
270 - $preg = '/[\w].+\.(com|net|org|gov|edu|co|ne)\.[\w]/';  
271 - if (($n > 2) && preg_match($preg, $host)) {  
272 - //双后缀取后3位  
273 - $host = $data[$n - 3] . '.' . $data[$n - 2] . '.' . $data[$n - 1];  
274 - } else {  
275 - //非双后缀取后两位  
276 - $host = $data[$n - 2] . '.' . $data[$n - 1];  
277 - }  
278 - return $host;  
279 - }  
280 -  
281 public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60) 242 public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60)
282 { 243 {
283 $ch = curl_init(); 244 $ch = curl_init();
@@ -782,15 +782,18 @@ function check_remote_url_down($url,$project_id,$domain,$is_complete=0){ @@ -782,15 +782,18 @@ function check_remote_url_down($url,$project_id,$domain,$is_complete=0){
782 $host_arr = explode('.',$host); 782 $host_arr = explode('.',$host);
783 $path = $arr['path'] ?? ''; 783 $path = $arr['path'] ?? '';
784 784
785 - $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; 785 + if($path && substr($path,0,1) != '/'){
  786 + $path = '/'.$path;
  787 + }
786 788
787 if ( 789 if (
788 (empty($scheme) || $scheme == 'https' || $scheme == 'http') 790 (empty($scheme) || $scheme == 'https' || $scheme == 'http')
789 && (empty($host) || (strpos($host_arr[0], 'cdn') === false)) 791 && (empty($host) || (strpos($host_arr[0], 'cdn') === false))
790 && $path 792 && $path
791 - && (substr($path, 0, 1) == '/')  
792 && (strpos($path, '.') !== false) 793 && (strpos($path, '.') !== false)
793 ) { 794 ) {
  795 + $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path;
  796 +
794 $new_url = CosService::uploadRemote($project_id,'image_product',$url_complete); 797 $new_url = CosService::uploadRemote($project_id,'image_product',$url_complete);
795 if($new_url){ 798 if($new_url){
796 return $is_complete ? getImageUrl($new_url) : $new_url; 799 return $is_complete ? getImageUrl($new_url) : $new_url;
@@ -132,6 +132,7 @@ class FileManageController extends BaseController @@ -132,6 +132,7 @@ class FileManageController extends BaseController
132 } 132 }
133 133
134 134
  135 +
135 protected function checkFile($file){ 136 protected function checkFile($file){
136 $count = FileManage::where('project_id', $this->user['project_id'])->count(); 137 $count = FileManage::where('project_id', $this->user['project_id'])->count();
137 if($count >= $this->upload_config['upload_max_num']){ 138 if($count >= $this->upload_config['upload_max_num']){
@@ -31,14 +31,27 @@ class VisitController extends BaseController @@ -31,14 +31,27 @@ class VisitController extends BaseController
31 $this->response('success',Code::SUCCESS,$data); 31 $this->response('success',Code::SUCCESS,$data);
32 } 32 }
33 33
  34 + /**
  35 + * @remark :
  36 + * @name :item
  37 + * @author :lyh
  38 + * @method :post
  39 + * @time :2024/5/6 16:26
  40 + */
34 public function item(VisitLogic $logic){ 41 public function item(VisitLogic $logic){
35 - $this->request->validate([  
36 - 'id'=>'required'  
37 - ],[  
38 - 'id.required' => 'ID不能为空'  
39 - ]);  
40 $data = $logic->getItemList(); 42 $data = $logic->getItemList();
41 $this->response('success',Code::SUCCESS,$data); 43 $this->response('success',Code::SUCCESS,$data);
42 } 44 }
43 45
  46 + /**
  47 + * @remark :导出详情
  48 + * @name :downloadIndex
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/5/6 16:42
  52 + */
  53 + public function downloadIndex(VisitLogic $logic){
  54 + $data = $logic->downloadItem($this->map,$this->page,$this->row,$this->order);
  55 + $this->response('success',Code::SUCCESS,$data);
  56 + }
44 } 57 }
@@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic @@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic
31 31
32 public function getItemList(){ 32 public function getItemList(){
33 $this->model = new VisitItem(); 33 $this->model = new VisitItem();
34 - $map = [  
35 - 'customer_visit_id' => $this->param['id'],  
36 -// 'domain' => $this->user['domain'],  
37 - ];  
38 - $data = $this->model->list($map, 'created_at'); 34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $map = [
  36 + 'customer_visit_id' => $this->param['id'],
  37 + ];
  38 + }
  39 + $data = $this->model->list($map ?? [], 'created_at');
39 return $this->success($data); 40 return $this->success($data);
40 } 41 }
41 42
  43 + /**
  44 + * @remark :导出数据
  45 + * @name :downloadItem
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/5/6 16:39
  49 + */
  50 + public function downloadItem($map,$page,$row,$order,$filed = ['*']){
  51 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  52 + $itemModel = new VisitItem();
  53 + if(!empty($lists) && !empty($lists['list'])){
  54 + foreach ($lists['list'] as $k => $v){
  55 + $v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
  56 + $lists['list'][$k] = $v;
  57 + }
  58 + }
  59 + return $this->success($lists);
  60 + }
  61 +
42 } 62 }
@@ -21,7 +21,7 @@ class Visit extends Base @@ -21,7 +21,7 @@ class Visit extends Base
21 //连接数据库 21 //连接数据库
22 protected $connection = 'custom_mysql'; 22 protected $connection = 'custom_mysql';
23 protected $appends = ['device_text']; 23 protected $appends = ['device_text'];
24 - protected $fillable = ['ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at']; 24 +// protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
25 25
26 const DEVICE_PC = 1; 26 const DEVICE_PC = 1;
27 const DEVICE_MOBILE = 2; 27 const DEVICE_MOBILE = 2;
@@ -443,6 +443,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -443,6 +443,7 @@ Route::middleware(['bloginauth'])->group(function () {
443 Route::prefix('visit')->group(function () { 443 Route::prefix('visit')->group(function () {
444 Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list'); 444 Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list');
445 Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item'); 445 Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item');
  446 + Route::any('/downloadIndex', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'downloadIndex'])->name('visit_downloadIndex');
446 }); 447 });
447 448
448 //访问数据 449 //访问数据