作者 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
public function updatePrivate($param)
{
$url = 'https://' . $param['domain'] . '/api/applySsl/';
$top_domain = $this->getTopDomain($param['domain']);
if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $param['id'] != 3) {
$extend_config = [
['origin' => $top_domain, 'target' => $param['domain']]
];
}
$param = [
'project_id' => $param['project_id'],
'type' => 1,
'route' => 1,
"domain" => $param['domain'],
"rewrite" => $extend_config ?? [],
'other_domain' => [$top_domain, '*.' . $top_domain],
"rewrite" => $param['extend_config'],
'other_domain' => $param['other_domain'],
'is_https' => $param['is_https'],
'private_key' => '',
'cert' => ''
];
return $this->curlRequest($url, $param);
}
... ... @@ -250,34 +239,6 @@ class DomainInfo extends Command
return $this->curlRequest($url, $param);
}
public static function getTopDomain($url)
{
$url = strtolower($url); //首先转成小写
$url = mb_ereg_replace('^( | )+', '', trim($url));
$url = mb_ereg_replace('( | )+$', '', $url);
if (!preg_match('/^(http:\/\/|https)/', $url)) {
$url = "https://" . $url;
}
$hosts = parse_url($url);
$host = $hosts['host'] ?? '';
//查看是几级域名
$data = explode('.', $host);
$n = count($data);
if ($n < 2) {
return $host;
}
//判断是否是双后缀
$preg = '/[\w].+\.(com|net|org|gov|edu|co|ne)\.[\w]/';
if (($n > 2) && preg_match($preg, $host)) {
//双后缀取后3位
$host = $data[$n - 3] . '.' . $data[$n - 2] . '.' . $data[$n - 1];
} else {
//非双后缀取后两位
$host = $data[$n - 2] . '.' . $data[$n - 1];
}
return $host;
}
public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60)
{
$ch = curl_init();
... ...
... ... @@ -782,15 +782,18 @@ function check_remote_url_down($url,$project_id,$domain,$is_complete=0){
$host_arr = explode('.',$host);
$path = $arr['path'] ?? '';
$url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path;
if($path && substr($path,0,1) != '/'){
$path = '/'.$path;
}
if (
(empty($scheme) || $scheme == 'https' || $scheme == 'http')
&& (empty($host) || (strpos($host_arr[0], 'cdn') === false))
&& $path
&& (substr($path, 0, 1) == '/')
&& (strpos($path, '.') !== false)
) {
$url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path;
$new_url = CosService::uploadRemote($project_id,'image_product',$url_complete);
if($new_url){
return $is_complete ? getImageUrl($new_url) : $new_url;
... ...
... ... @@ -132,6 +132,7 @@ class FileManageController extends BaseController
}
protected function checkFile($file){
$count = FileManage::where('project_id', $this->user['project_id'])->count();
if($count >= $this->upload_config['upload_max_num']){
... ...
... ... @@ -31,14 +31,27 @@ class VisitController extends BaseController
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :
* @name :item
* @author :lyh
* @method :post
* @time :2024/5/6 16:26
*/
public function item(VisitLogic $logic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$data = $logic->getItemList();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :导出详情
* @name :downloadIndex
* @author :lyh
* @method :post
* @time :2024/5/6 16:42
*/
public function downloadIndex(VisitLogic $logic){
$data = $logic->downloadItem($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -31,12 +31,32 @@ class VisitLogic extends BaseLogic
public function getItemList(){
$this->model = new VisitItem();
if(isset($this->param['id']) && !empty($this->param['id'])){
$map = [
'customer_visit_id' => $this->param['id'],
// 'domain' => $this->user['domain'],
];
$data = $this->model->list($map, 'created_at');
}
$data = $this->model->list($map ?? [], 'created_at');
return $this->success($data);
}
/**
* @remark :导出数据
* @name :downloadItem
* @author :lyh
* @method :post
* @time :2024/5/6 16:39
*/
public function downloadItem($map,$page,$row,$order,$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
$itemModel = new VisitItem();
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
$lists['list'][$k] = $v;
}
}
return $this->success($lists);
}
}
... ...
... ... @@ -21,7 +21,7 @@ class Visit extends Base
//连接数据库
protected $connection = 'custom_mysql';
protected $appends = ['device_text'];
protected $fillable = ['ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
// protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at'];
const DEVICE_PC = 1;
const DEVICE_MOBILE = 2;
... ...
... ... @@ -443,6 +443,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('visit')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'index'])->name('visit_list');
Route::any('/item', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'item'])->name('visit_item');
Route::any('/downloadIndex', [\App\Http\Controllers\Bside\Visit\VisitController::class, 'downloadIndex'])->name('visit_downloadIndex');
});
//访问数据
... ...