Commit 9e5a7e9e authored by hujun's avatar hujun

token 修改

parent c66a313c
......@@ -363,8 +363,8 @@ class Broker extends Basic
*/
public function token(){
$jwt = new JwtUntils();
$phone = $this->params['phone'];
$token = $jwt->createToken($phone);
$data['phone'] = $this->params['phone'];
$token = $jwt->createToken($data);
return $this->response(200, "", ['AuthToken'=>$token]);
}
......
......@@ -54,7 +54,7 @@ class Client extends Basic
$data['start'] = $this->user->edit($this->params);
if ($data['start'] == -1) {
$this->code = 101;
$this->msg = '该客户手机号已存在于系统内!';
$this->msg = '该用户已存在';
}
if($data['start']==1){
......@@ -78,7 +78,32 @@ class Client extends Basic
}
/**经纪人搜索
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentSearch(){
header('Access-Control-Allow-Origin:*');
$table= new Agents;
$data['msg'] = '';
$params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = ['id','realname','phone'];
$where = 'level in(2,5) ';
if(!empty($params['search'])){
$where .=" and realname like '%{$params['search']}%' or phone like '%{$params['search']}%' ";
$data['search'] = $params['search'];
}
$order="id desc";
$data['list']=$table->searchList($pageNo, $pageSize,$order,$field, $where);
$total=$table->searchTotal($where);
$data['total']= ceil($total / $pageSize);
$data['page']=$pageNo;
return $this->response(200,'成功',$data);
}
/**经纪人搜索
* @return \think\Response
......
......@@ -70,7 +70,8 @@ class Basic extends Controller
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array('HS256')); //解码token
$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) {
echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json"));
......@@ -85,7 +86,7 @@ class Basic extends Controller
/*临时验证 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();
$this->authToken = $this->params['AuthToken'];
$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