pull/5/head
wanghousheng 4 months ago
parent 54bd83ecfc
commit 0e60d91ba8
  1. 61
      app/common/enum/user/UserTypeEnum.php

@ -30,17 +30,17 @@ class UserTypeEnum extends EnumBasics
'value' => self::NORMAL,
],
self::MEMBER => [
'name' => '会员',
'name' => '采购商',
'value' => self::MEMBER,
],
self::DEALER => [
'name' => '分销商',
'name' => '服务商',
'value' => self::DEALER,
],
self::STORE => [
'name' => '店长',
'value' => self::STORE,
]
// self::STORE => [
// 'name' => '店长',
// 'value' => self::STORE,
// ]
];
}
@ -55,32 +55,33 @@ class UserTypeEnum extends EnumBasics
}
public static function homeLocation(string $mobile){
public static function homeLocation(string $mobile): string
{
$datatype = 'txt';
$url = 'https://api.ip138.com/mobile/?mobile='.$mobile.'&datatype='.$datatype;
$url = 'https://api.ip138.com/mobile/?mobile=' . $mobile . '&datatype=' . $datatype;
$header = array('token:00d5cb1fac5dc5cbfe2ff218292a2dfd33');
return self::getName($url,$header );
return self::getName($url, $header);
}
public function getData($url,$header){
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,3);
$handles = curl_exec($curl);
curl_close($curl);
return $handles;
}
public function getData($url, $header)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3);
$handles = curl_exec($curl);
curl_close($curl);
return $handles;
}
}
Loading…
Cancel
Save