瀏覽代碼

增加返回token

刘韬 5 年之前
父節點
當前提交
38157d8635

+ 4 - 0
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/common/ZskkConfig.java

@@ -84,6 +84,10 @@ public class ZskkConfig extends JFinalConfig {
 		RedisPlugin redisPlugin = new RedisPlugin("weixin_doctor", "10.46.159.65", 6379, 2000, "Zskk_2019", 2);
 		redisPlugin.setSerializer(JdkSerializer.me); // 需要使用fst高性能序列化的用户请删除这一行(Fst jar依赖请查看WIKI)
 		me.add(redisPlugin);
+		
+		RedisPlugin redisPluginPc = new RedisPlugin("pc", "10.46.159.65", 6379, 2000, "Zskk_2019", 0);
+		redisPluginPc.setSerializer(JdkSerializer.me); // 需要使用fst高性能序列化的用户请删除这一行(Fst jar依赖请查看WIKI)
+		me.add(redisPluginPc);
 	}
 
 	public void configInterceptor(Interceptors me) {

+ 16 - 2
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/controller/WxaUserApiController.java

@@ -15,6 +15,7 @@ import com.jfinal.aop.Duang;
 import com.jfinal.kit.Base64Kit;
 import com.jfinal.kit.Kv;
 import com.jfinal.kit.StrKit;
+import com.jfinal.plugin.redis.Redis;
 import com.jfinal.weixin.sdk.api.ApiConfigKit;
 import com.jfinal.weixin.sdk.api.ApiResult;
 import com.jfinal.weixin.sdk.cache.IAccessTokenCache;
@@ -77,7 +78,13 @@ public class WxaUserApiController extends WxaController {
 		accessTokenCache.set("wxa:session:" + sessionId, apiResult.getJson());
 		LoginBean loginBean = new LoginBean();
 		loginBean.setSessionId(sessionId);
-		loginBean.setDoctorBean(doctors);
+		if (doctors != null) {
+			doctors.setPassword("");
+			String tokenKey = "TOKEN_WXA_" + StrKit.getRandomUUID();
+			Redis.use("pc").setex(tokenKey, 7200, doctors.toJson());
+			loginBean.setDoctorBean(doctors);
+			loginBean.setToken(tokenKey);
+		}
 		renderJson(new ResultBean(loginBean));
 //		renderJson("sessionId", sessionId);
 	}
@@ -182,7 +189,14 @@ public class WxaUserApiController extends WxaController {
 		doctorsWechat.update();
 		LoginBean loginBean = new LoginBean();
 		loginBean.setSessionId(sessionId);
-		loginBean.setDoctorBean(doctors);
+		if (doctors != null) {
+			doctors.setPassword("");
+			String tokenKey = "TOKEN_WXA_" + StrKit.getRandomUUID();
+			Redis.use("pc").setex(tokenKey, 7200, doctors.toJson());
+			loginBean.setDoctorBean(doctors);
+			loginBean.setToken(tokenKey);
+			loginBean.setDoctorBean(doctors);
+		}
 		renderJson(new ResultBean(loginBean));
 	}
 

+ 12 - 1
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/controller/bean/LoginBean.java

@@ -13,6 +13,18 @@ public class LoginBean {
 
 	private String sessionId;
 	
+	private String token;
+	
+	private Doctors DoctorBean;
+	
+	public String getToken() {
+		return token;
+	}
+
+	public void setToken(String token) {
+		this.token = token;
+	}
+
 	public String getSessionId() {
 		return sessionId;
 	}
@@ -29,5 +41,4 @@ public class LoginBean {
 		DoctorBean = doctorBean;
 	}
 
-	private Doctors DoctorBean;
 }