Commit 99a53377 authored by zazaname's avatar zazaname

修正登录保存的信息

parent 212d689d
Pipeline #11104 passed with stage
in 0 seconds
......@@ -53,35 +53,38 @@ class LoginService
}
// 判断用户是否存在,appid为CP的appid
$userInfo = DB::table('app_member')->where(['app_id' => $params['app_id'], 'uname' => $loginInfo['uname']])->first();
$curr_time = date('Y-m-d H:i:s');
if (is_null($userInfo)) {
//保存聚合用户的信息并返回token
$uid = DB::table('app_member')->insertGetId([
DB::table('app_member')->insert([
'uname' => $loginInfo['uname'],
'veruniqid' => $loginInfo['ver_user_id'],
'app_id' => $params['app_id'],
'ver' => $params['ctype'] ?? '',
'reg_ip' => CommonFunc::getTrustedProxiesIp(),
'reg_time' => date('Y-m-d H:i:s'),
'login_time' => date('Y-m-d H:i:s'),
'reg_time' => $curr_time,
'login_time' => $curr_time,
'login_ip' => CommonFunc::getTrustedProxiesIp(),
'add_time' => date('Y-m-d H:i:s')
'add_time' => $curr_time
]);
} else {
// 更新登录信息
DB::table('app_member')->where(['uname' => $loginInfo['uname'], 'app_id' => $gameInfo->app_id])->update([
'login_time' => date('Y-m-d H:i:s'),
'login_time' => $curr_time,
'login_ip' => CommonFunc::getTrustedProxiesIp()
]);
}
// 获取用户注册渠道,时间
$userInfo = DB::table('app_member')->where(['app_id' => $params['app_id'], 'uname' => $loginInfo['uname']])->first();
// 保存登录日志
DB::table('app_memberloginlog')->insert([
'uid' => $uid ?? $userInfo->uid,
'uid' => $userInfo->uid,
'uname' => $loginInfo['uname'],
'reg_ver' => $params['ctype'] ?? '',
'reg_time' => date('Y-m-d H:i:s'),
'reg_ver' => $userInfo->ver,
'reg_time' => $userInfo->reg_time,
'appid' => $params['app_id'],
'login_ver' => $params['ctype'] ?? '',
'login_time' => date('Y-m-d H:i:s'),
'login_time' => $curr_time,
'login_ip' => CommonFunc::getTrustedProxiesIp()
]);
// 产生一个token ,存redis ,有效期5分钟
......
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