Commit 32771c62 authored by clone's avatar clone

bug

parent 28e15be6
......@@ -82,10 +82,10 @@ class Basic extends Controller
try {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch( UnexpectedValueException $e) {
} catch (UnexpectedValueException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit;
} catch( InvalidArgumentException $e) {
} catch (InvalidArgumentException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit;
}
......@@ -112,11 +112,13 @@ class Basic extends Controller
* 默认城市选择
* @param $agentId
*/
public function getCity($agentId){
public function getCity($agentId)
{
$redis_ = RedisExt::getRedis();
if($redis_){
$this->city = $redis_->get("agent_city_".$agentId);
}else{
if ($redis_) {
$city = $redis_->get("agent_city_" . $agentId);
$this->city = empty($city) ? "上海" : $city;
} else {
$this->city = "上海";
}
......@@ -156,8 +158,8 @@ class Basic extends Controller
$agentModel = new AAgents();
$params["status"] = 0;
$params["id"] = $this->agentId;
$agentArr = $agentModel->getAgentById("id,store_id,name,phone",$params);
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId )) {
$agentArr = $agentModel->getAgentById("id,store_id,name,phone", $params);
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId)) {
echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit;
}
......@@ -307,7 +309,8 @@ class Basic extends Controller
* @param $requestPath
* @return bool
*/
public function userAuth($requestPath){
public function userAuth($requestPath)
{
$agents = new AAgents();
$is_auth = $agents->agentsAuthId($this->agentId, $requestPath);
......@@ -323,7 +326,8 @@ class Basic extends Controller
];
if (in_array($requestPath, $auth_arr) && empty($is_auth) && $this->agentId != 1) {
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));
exit;
}
return true;
......
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