Commit 52d347df authored by hujun's avatar hujun

token 修改

parent 28ca87e3
...@@ -363,8 +363,8 @@ class Broker extends Basic ...@@ -363,8 +363,8 @@ class Broker extends Basic
*/ */
public function token(){ public function token(){
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$phone = $this->params['phone']; $data['phone'] = $this->params['phone'];
$token = $jwt->createToken($phone); $token = $jwt->createToken($data);
return $this->response(200, "", ['AuthToken'=>$token]); return $this->response(200, "", ['AuthToken'=>$token]);
} }
......
...@@ -54,7 +54,7 @@ class Client extends Basic ...@@ -54,7 +54,7 @@ class Client extends Basic
$data['start'] = $this->user->edit($this->params); $data['start'] = $this->user->edit($this->params);
if ($data['start'] == -1) { if ($data['start'] == -1) {
$this->code = 101; $this->code = 101;
$this->msg = '该客户手机号已存在于系统内!'; $this->msg = '该用户已存在';
} }
if($data['start']==1){ if($data['start']==1){
...@@ -89,15 +89,13 @@ class Client extends Basic ...@@ -89,15 +89,13 @@ class Client extends Basic
$table= new Agents; $table= new Agents;
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$search=$params['search'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field=['id','realname','phone']; $field = ['id','realname','phone'];
$where='level in(2,5) '; $where = 'level in(2,5) ';
if(!empty($search)){ if(!empty($params['search'])){
$where.=" and realname like '%$search%' or phone like '%$search%' "; $where .=" and realname like '%{$params['search']}%' or phone like '%{$params['search']}%' ";
$data['search'] = $params['search'];
$data['search']=$search;
} }
$order="id desc"; $order="id desc";
$data['list']=$table->searchList($pageNo, $pageSize,$order,$field, $where); $data['list']=$table->searchList($pageNo, $pageSize,$order,$field, $where);
......
...@@ -70,7 +70,8 @@ class Basic extends Controller ...@@ -70,7 +70,8 @@ class Basic extends Controller
$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->timeStamp_ = $result->timeStamp_; $this->timeStamp_ = $result->timeStamp_;
$is = Db::table('agents')->where('phone', $result->data)->count(); $this->agentPhone = $result->data->phone;
$is = Db::table('agents')->where('phone', $result->data->phone)->count();
if ($is == 0) { if ($is == 0) {
echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json")); echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json"));
...@@ -85,7 +86,7 @@ class Basic extends Controller ...@@ -85,7 +86,7 @@ class Basic extends Controller
/*临时验证 end*/ /*临时验证 end*/
/* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) { /* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$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
......
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