Commit b503eb25 authored by clone's avatar clone

bug

parent e458efbf
......@@ -12,6 +12,7 @@ namespace app\api\controller;
*/
use app\api\extend\Basic;
use app\api\untils\JwtUntils;
use app\model\Users;
use app\model\UWxInfo;
use think\Exception;
......@@ -65,14 +66,31 @@ class WxSdk extends Basic
return $this->response("101", "request error:" . $exception);
}
$conditions["buyer_id"] = $id;
$fields = "id";
$fields = "id,user_nick,user_phone,user_pic,other_pic";
$user_info = $this->userModel->getUserByWhere($conditions, $fields);
$user_id = 0;
if (count($user_info) > 0) {
//如果绑定了直接返回用户数据,无需帐号验证码登录
if ($id > 0 && count($user_info) > 0) {
$user_id = $user_info[0]['id'];
}
if ($id > 0) {
return $this->response("200", "request success", [ "user_id" => $user_id ]);
$user_nick = $user_info[0]['user_nick'];
$user_phone = $user_info[0]['user_phone'];
$user_pic = $user_info[0]["user_pic"];
$other_pic = $user_info[0]["other_pic"];
$jwt_data['id'] = $user_id;
$jwt_data['userNick'] = $user_nick;
$jwt_data['phone'] = $user_phone;
$jwt = new JwtUntils();
$data["id"] = $user_id;
$data["user_nick"] = $user_nick;
$data["user_phone"] = $user_phone;
$data["user_pic"] = !empty($user_pic) ? HEADERIMGURL . $user_pic : $other_pic;
$data["AuthToken"] = $jwt->createToken($jwt_data);;
return $this->response("200", "request success", [ "data" => $data ]);
} elseif ($id > 0 && count($user_info) <= 0) {
return $this->response("200", "request success", [ "data" => null ]);
} else {
return $this->response("101", "request exception");
}
......
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