作者 张关杰

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

... ... @@ -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,17 @@ 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);
}
}
... ...
... ... @@ -31,11 +31,12 @@ class VisitLogic extends BaseLogic
public function getItemList(){
$this->model = new VisitItem();
$map = [
'customer_visit_id' => $this->param['id'],
// 'domain' => $this->user['domain'],
];
$data = $this->model->list($map, 'created_at');
if(isset($this->param['id']) && !empty($this->param['id'])){
$map = [
'customer_visit_id' => $this->param['id'],
];
}
$data = $this->model->list($map ?? [], 'created_at');
return $this->success($data);
}
... ...