Commit 32771c62 authored by clone's avatar clone

bug

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