Commit 32771c62 authored by clone's avatar clone

bug

parent 28e15be6
......@@ -78,14 +78,14 @@ class Basic extends Controller
}
if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$jwt = new \Firebase\JWT\JWT();
try {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch( UnexpectedValueException $e) {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} 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;
}
......@@ -102,7 +102,7 @@ class Basic extends Controller
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
$this->tokenVerify();
// $this->userAuth(trim($requestPath));
}
unset($this->params["AuthToken"]);
......@@ -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 = "上海";
}
......@@ -153,11 +155,11 @@ class Basic extends Controller
*/
public function verifyAgentInfo()
{
$agentModel = new AAgents();
$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 )) {
$params["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;
}
......@@ -275,11 +277,11 @@ class Basic extends Controller
public static function corsRequestHander()
{
return [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => true,
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
'Access-Defined-X-Support' => 'service@cuci.cc',
'Access-Defined-X-Servers' => 'Guangzhou Cuci Technology Co. Ltd',
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
'Access-Defined-X-Support' => 'service@cuci.cc',
'Access-Defined-X-Servers' => 'Guangzhou Cuci Technology Co. Ltd',
];
}
......@@ -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