Commit 36f0c343 authored by clone's avatar clone

bug 微信直接登录加最后登录时间和第一次登录时间

parent cb2c9127
...@@ -12,6 +12,7 @@ namespace app\api\controller; ...@@ -12,6 +12,7 @@ namespace app\api\controller;
*/ */
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api\service\RegisterService;
use app\api\untils\JwtUntils; use app\api\untils\JwtUntils;
use app\model\Users; use app\model\Users;
use app\model\UWxInfo; use app\model\UWxInfo;
...@@ -67,9 +68,23 @@ class WxSdk extends Basic ...@@ -67,9 +68,23 @@ class WxSdk extends Basic
return $this->response("101", "request error:" . $exception); return $this->response("101", "request error:" . $exception);
} }
$conditions["buyer_id"] = $id; $conditions["buyer_id"] = $id;
$fields = "id,user_nick,user_phone,user_pic,other_pic"; $fields = "id,user_nick,user_phone,user_pic,other_pic,last_login_time,last_login_ip,first_login_time";
$user_info = $this->userModel->getUserByWhere($conditions, $fields); $user_info = $this->userModel->getUserByWhere($conditions, $fields);
//todo 判断用户是否第一次登陆了没有则更新数据
if (count($user_info) > 0 && empty($user_info[0]["last_login_time"]) || empty($user_info[0]["last_login_ip"])
|| empty($user_info[0]["first_login_time"])) {
$userArr = array(
"id" => $user_info[0]['id'],
"last_login_time" => date("Y-m-d H:i:s", time()),
"last_login_ip" => ip2long($this->request->ip()),
"first_login_time" => date("Y-m-d H:i:s", time()),
);
//保存数据
$id = $this->userModel->saveUser($userArr);
}
//如果绑定了直接返回用户数据,无需帐号验证码登录 //如果绑定了直接返回用户数据,无需帐号验证码登录
if ($id > 0 && count($user_info) > 0) { if ($id > 0 && count($user_info) > 0) {
$user_id = $user_info[0]['id']; $user_id = $user_info[0]['id'];
......
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