Commit 9c2a789f authored by clone's avatar clone

bug

parent 660ecf0a
This diff is collapsed.
...@@ -9,8 +9,11 @@ namespace app\api\extend; ...@@ -9,8 +9,11 @@ namespace app\api\extend;
* Time: 9:35 * Time: 9:35
* 基类 * 基类
*/ */
use app\extra\RedisExt;
use app\model\Users; use app\model\Users;
use think\Controller; use think\Controller;
use think\Exception;
use Think\Log;
use think\Request; use think\Request;
use think\Response; use think\Response;
use Qiniu; use Qiniu;
...@@ -27,6 +30,8 @@ class Basic extends Controller ...@@ -27,6 +30,8 @@ class Basic extends Controller
public $params; public $params;
public $user_city;
protected $authToken; protected $authToken;
/** /**
...@@ -37,7 +42,7 @@ class Basic extends Controller ...@@ -37,7 +42,7 @@ class Basic extends Controller
protected $phone; protected $phone;
protected $timeStamp_; protected $timeStamp_;
protected $filterVerify = array( protected $filterVerify = array(
"api/shopDetail", "api/getShopList",
"api/sendSms", "api/sendSms",
"api/sendCode", "api/sendCode",
"api/userVerify", "api/userVerify",
...@@ -98,6 +103,8 @@ class Basic extends Controller ...@@ -98,6 +103,8 @@ class Basic extends Controller
$this->timeStamp_ = $result->timeStamp_; $this->timeStamp_ = $result->timeStamp_;
} }
//$this->getCity($this->userId);
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1]; $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口 //过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) { if (!in_array(trim($requestPath), $this->filterVerify)) {
...@@ -105,6 +112,27 @@ class Basic extends Controller ...@@ -105,6 +112,27 @@ class Basic extends Controller
} }
} }
/**
* 默认城市选择
* @param $userId
*/
public function getCity($userId)
{
try {
$redis_ = RedisExt::getRedis();
if ($redis_) {
$city = $redis_->get("user_city_" . $userId);
$this->user_city = empty($city) ? "上海市" : $city;
} else {
$this->user_city = "上海市";
}
Log::record("-------basic-------".$redis_->get("user_city_" . $userId),"info");
} catch (Exception $exception) {
$this->user_city = "上海市";
}
}
/** /**
* token 验证 * token 验证
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment