刘韬 hace 5 años
padre
commit
3ff6499fa3

+ 18 - 17
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/controller/WxaUserApiController.java

@@ -226,8 +226,10 @@ public class WxaUserApiController extends WxaController {
 		// 用户信息校验
 		WxaUserApi wxaUserApi = Duang.duang(WxaUserApi.class);
 //		 服务端解密用户信息
-		String json = decrypt(encryptedData.replace(" ", "+"), iv, sessionKey);
-		
+//		String json = decrypt(encryptedData.replace(" ", "+"), iv, sessionKey);
+		ApiResult apiResult = wxaUserApi.getUserInfo(sessionKey, encryptedData.replace(" ", "+"), iv);
+		renderJson(apiResult);
+		return;
 
 //		ApiResult apiResult = ApiResult.create(json);
 		
@@ -239,22 +241,21 @@ public class WxaUserApiController extends WxaController {
 		// 如果开发者拥有多个移动应用、网站应用、和公众帐号(包括小程序),可通过unionid来区分用户的唯一性
 		// 同一用户,对同一个微信开放平台下的不同应用,unionid是相同的。
 
-		JSONObject object = JSON.parseObject(json);
+//		JSONObject object = JSON.parseObject(json);
+//		
+//		String phone = object.getString("purePhoneNumber");
+//		if (StrKit.isBlank(phone)) {
+//			renderJson(ErrorConstant.ERROR_PHONE_BLANK);
+//			return;
+//		}
+//
+//
+//		Doctors doctors = Doctors.dao.findFirst("select * from doctors where phone=?", phone);
+//		if (doctors == null) {
+//			renderJson(ErrorConstant.ERROR_DOCTOR_NOT_FIND);
+//			return;
+//		}
 		
-		String phone = object.getString("purePhoneNumber");
-		if (StrKit.isBlank(phone)) {
-			renderJson(ErrorConstant.ERROR_PHONE_BLANK);
-			return;
-		}
-
-
-		Doctors doctors = Doctors.dao.findFirst("select * from doctors where phone=?", phone);
-		if (doctors == null) {
-			renderJson(ErrorConstant.ERROR_DOCTOR_NOT_FIND);
-			return;
-		}
-		renderJson(doctors);
-		return;
 //		DoctorsWechat doctorsWechat = DoctorsWechat.dao.findFirst("select * from doctors_wechat where wxa_openid=?",sessionResult.get("openid"));
 //		doctorsWechat.setDoctorId(doctors.getId());
 //		doctorsWechat.update();