From 55ee91970e67dceba776b861be8927ac65a1b90c Mon Sep 17 00:00:00 2001 From: wangyuan Date: Fri, 29 Nov 2019 15:05:48 +0800 Subject: [PATCH] fix account --- .../com/ljsd/controller/GetUserController.java | 14 ++++++++------ src/main/java/com/ljsd/redis/RedisKey.java | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ljsd/controller/GetUserController.java b/src/main/java/com/ljsd/controller/GetUserController.java index 5acfe45..630238c 100644 --- a/src/main/java/com/ljsd/controller/GetUserController.java +++ b/src/main/java/com/ljsd/controller/GetUserController.java @@ -90,13 +90,7 @@ public class GetUserController extends HttpServlet { dbObject.put("openId", openId); dbObject.put("serverId", serverId); dbObject.put("platform", platform); - if (gid != null && !gid.isEmpty()) { - dbObject.put("gid", gid); - } - if (pid != null && !pid.isEmpty()) { - dbObject.put("pid", pid); - } int uid = 0; @@ -107,6 +101,12 @@ public class GetUserController extends HttpServlet { dbObject.put("uid", uid); dbObject.put("_id", uid); userInfos.add(dbObject); + if (gid != null && !gid.isEmpty()) { + dbObject.put("gid", gid); + } + if (pid != null && !pid.isEmpty()) { + dbObject.put("pid", pid); + } BaseGlobal.getInstance().mongoDBPool.save(_COLLECTION_NAME, dbObject); } Random random = new Random(); @@ -115,6 +115,8 @@ public class GetUserController extends HttpServlet { res.put("uid", uid); res.put("token", utoken); BaseGlobal.getInstance().redisApp.set(RedisKey.TOKEN, String.valueOf(uid), utoken, -1, false); + BaseGlobal.getInstance().redisApp.set(RedisKey.PIDGIDTEMP, String.valueOf(uid), pid+gid, -1, false); + PrintWriter out = response.getWriter(); out.print(res); out.flush(); diff --git a/src/main/java/com/ljsd/redis/RedisKey.java b/src/main/java/com/ljsd/redis/RedisKey.java index 0d4dd1a..d45b411 100644 --- a/src/main/java/com/ljsd/redis/RedisKey.java +++ b/src/main/java/com/ljsd/redis/RedisKey.java @@ -2,6 +2,7 @@ package com.ljsd.redis; public interface RedisKey { String TOKEN = "JL_TOKEN"; + String PIDGIDTEMP = "PIDGIDTEMP"; String LOGIN_TOKEN = "JL_LOGIN_TOKEN"; /**