域名判断优化、去除下单坐标转换
parent
a610fa206e
commit
5143490563
|
|
@ -1591,21 +1591,6 @@ class BuyService
|
|||
*/
|
||||
private static function OrderAddressInsert($order_id, $user_id, $address)
|
||||
{
|
||||
// 坐标处理
|
||||
if(in_array(APPLICATION_CLIENT_TYPE, MyConfig('shopxo.coordinate_transformation')))
|
||||
{
|
||||
// 坐标转换 火星(高德,谷歌,腾讯坐标) 转 百度
|
||||
if(isset($address['lng']) && isset($address['lat']))
|
||||
{
|
||||
$map = \base\GeoTransUtil::GcjToBd($address['lng'], $address['lat']);
|
||||
if(isset($map['lng']) && isset($map['lat']))
|
||||
{
|
||||
$address['lng'] = $map['lng'];
|
||||
$address['lat'] = $map['lat'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单收货地址
|
||||
$data = [
|
||||
'order_id' => $order_id,
|
||||
|
|
|
|||
|
|
@ -61,15 +61,20 @@ if(empty($_SERVER['HTTP_HOST']))
|
|||
// 查看是几级域名
|
||||
$arr = explode('.', $main_domain);
|
||||
$len = count($arr);
|
||||
// 判断是否是双后缀
|
||||
$preg = '/[\w].+\.(com|net|org|gov|edu|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn)\.cn$/';
|
||||
if($len > 2 && preg_match($preg, $main_domain))
|
||||
if($len < 2)
|
||||
{
|
||||
// 双后缀取后3位
|
||||
$main_domain = $arr[$len-3].'.'.$arr[$len-2].'.'.$arr[$len-1];
|
||||
$main_domain = '';
|
||||
} else {
|
||||
// 非双后缀取后两位
|
||||
$main_domain = $arr[$len-2].'.'.$arr[$len-1];
|
||||
// 判断是否是双后缀
|
||||
$preg = '/[\w].+\.(com|net|org|gov|edu|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn)\.cn$/';
|
||||
if($len > 2 && preg_match($preg, $main_domain))
|
||||
{
|
||||
// 双后缀取后3位
|
||||
$main_domain = $arr[$len-3].'.'.$arr[$len-2].'.'.$arr[$len-1];
|
||||
} else {
|
||||
// 非双后缀取后两位
|
||||
$main_domain = $arr[$len-2].'.'.$arr[$len-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
define('__MY_MAIN_DOMAIN__', $main_domain);
|
||||
|
|
|
|||
Loading…
Reference in New Issue