lqmac 5 months ago
commit d0b4626262
  1. 167
      app/common/enum/user/UserTypeEnum.php
  2. 30
      app/store/controller/Order.php

@ -1,83 +1,86 @@
<?php
namespace app\common\enum\user;
use app\common\enum\EnumBasics;
class UserTypeEnum extends EnumBasics
{
// 普通用户
const NORMAL = 10;
// 会员用户
const MEMBER = 20;
// 分销商用户
const DEALER = 30;
// 店长用户
const STORE = 40;
/**
* 获取用户类型值
* @return array
*/
public static function data(): array
{
return [
self::NORMAL => [
'name' => '游客',
'value' => self::NORMAL,
],
self::MEMBER => [
'name' => '会员',
'value' => self::MEMBER,
],
self::DEALER => [
'name' => '分销商',
'value' => self::DEALER,
],
self::STORE => [
'name' => '店长',
'value' => self::STORE,
]
];
}
/**
* 根据值获取名称
* @param string $value
* @return string
*/
public static function getName(string $value): string
{
return self::data()[$value]['name'];
}
public static function homeLocation(array $mobile){
}
public function getData($url,$header){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,3);
$handles = curl_exec($ch);
curl_close($ch);
return $handles;
}
<?php
namespace app\common\enum\user;
use app\common\enum\EnumBasics;
class UserTypeEnum extends EnumBasics
{
// 普通用户
const NORMAL = 10;
// 会员用户
const MEMBER = 20;
// 分销商用户
const DEALER = 30;
// 店长用户
const STORE = 40;
/**
* 获取用户类型值
* @return array
*/
public static function data(): array
{
return [
self::NORMAL => [
'name' => '游客',
'value' => self::NORMAL,
],
self::MEMBER => [
'name' => '会员',
'value' => self::MEMBER,
],
self::DEALER => [
'name' => '分销商',
'value' => self::DEALER,
],
self::STORE => [
'name' => '店长',
'value' => self::STORE,
]
];
}
/**
* 根据值获取名称
* @param string $value
* @return string
*/
public static function getName(string $value): string
{
return self::data()[$value]['name'];
}
public static function homeLocation(string $mobile){
$datatype = 'txt';
$url = 'https://api.ip138.com/mobile/?mobile='.$mobile.'&datatype='.$datatype;
$header = array('token:00d5cb1fac5dc5cbfe2ff218292a2dfd33');
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;
}
}

@ -16,6 +16,8 @@ use app\store\model\Order as OrderModel;
use app\store\model\Goods as GoodsModel;
use think\response\Json;
use app\common\model\UploadFile as UploadFileModel;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\F;
/**
* 订单管理
* Class Order
@ -116,4 +118,32 @@ class Order extends Controller
}
return $this->renderSuccess(compact('detail'));
}
public function getHomeLocation(string $mobile){
$host = "https://ec8a.api.huachen.cn";
$path = "/mobile";
$method = "GET";
$appcode = "06d67297e6e14268801dbc3c974bec7e";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$bodys = "";
$url = $host . $path . "?" .'mobile='. $mobile;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
print_r(curl_exec($curl));
exit;
// curl_setopt($curl, CURLOPT_HEADER, true);
// if (1 == strpos("$".$host, "https://"))
// {
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
// }
return (curl_exec($curl));
}
}

Loading…
Cancel
Save