Commit a8c0f501 authored by hujun's avatar hujun

登录修改

parent 7555b249
...@@ -45,20 +45,20 @@ class Broker extends Basic ...@@ -45,20 +45,20 @@ class Broker extends Basic
$agents_data = $this->a_agents->getInfo($this->params['phone'], $this->params['pwd']); $agents_data = $this->a_agents->getInfo($this->params['phone'], $this->params['pwd']);
if (isset($agents_data->id) && ($agents_data->status == 0)) { if (isset($agents_data['id']) && ($agents_data['status'] == 0)) {
if ($agents_data->password == md5($this->params['pwd'])) { if ($agents_data['password'] == md5($this->params['pwd'])) {
$agents_data->last_login_ip = ip2long($this->request->ip()); $agents_data['last_login_ip'] = ip2long($this->request->ip());
$agents_data->last_login_time = date('Y-m-d H:i:s'); $agents_data['last_login_time'] = date('Y-m-d H:i:s');
$agents_data->allowField(true)->save(); $agents_data->allowField(true)->save();
if ($agents_data->img) { if (!empty($agents_data['img'])) {
$agents_data->img = AGENTHEADERIMGURL.$agents_data->img; $agents_data['img'] = AGENTHEADERIMGURL.$agents_data->img;
} }
$jwt_data['id'] = $agents_data->id; $jwt_data['id'] = $agents_data['id'];
$jwt_data['name'] = $agents_data->name; $jwt_data['name'] = $agents_data['name'];
$jwt_data['phone'] = $agents_data->phone; $jwt_data['phone'] = $agents_data['phone'];
$jwt_data['level'] = $agents_data->level; $jwt_data['level'] = $agents_data['level'];
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$data['data'] = $agents_data->getData(); $data['data'] = $agents_data->getData();
......
...@@ -71,11 +71,10 @@ class Basic extends Controller ...@@ -71,11 +71,10 @@ class Basic extends Controller
$jwt = new \Firebase\JWT\JWT(); $jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken']; $this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token $result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result->data->id; $this->agentId = $result->data->id;
$this->phone = $result->data->phone; $this->phone = $result->data->phone;
$this->userNick = $result->data->userNick; $this->name = $result->data->name;
$this->timeStamp_ = $result->timeStamp_; $this->timeStamp_ = $result->timeStamp_;
unset($this->params["AuthToken"]);
} }
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1]; $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
...@@ -83,8 +82,7 @@ class Basic extends Controller ...@@ -83,8 +82,7 @@ class Basic extends Controller
if (!in_array(trim($requestPath), $this->filterVerify)) { if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify(); $this->tokenVerify();
} }
unset($this->params["AuthToken"]);
} }
/** /**
......
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