|
@@ -218,39 +218,39 @@ public class WxaUserApiController extends WxaController {
|
|
|
renderJson(ErrorConstant.ERROR_WXA_SESSION_BLANK3);
|
|
|
return;
|
|
|
}
|
|
|
- renderText(sessionKey+" " +encryptedData+" "+iv+" "+ encryptedData.replace(" ", "+"));
|
|
|
- return;
|
|
|
+// renderText(sessionKey+" " +encryptedData+" "+iv+" "+ encryptedData.replace(" ", "+"));
|
|
|
+// return;
|
|
|
// 用户信息校验
|
|
|
-// WxaUserApi wxaUserApi = Duang.duang(WxaUserApi.class);
|
|
|
+ WxaUserApi wxaUserApi = Duang.duang(WxaUserApi.class);
|
|
|
// 服务端解密用户信息
|
|
|
-// ApiResult apiResult = wxaUserApi.getUserInfo(sessionKey, encryptedData.replace(" ", "+"), iv);
|
|
|
-//
|
|
|
-// if (!apiResult.isSucceed()) {
|
|
|
-// ResultBean resultBean = new ResultBean(apiResult.getInt("errcode"), apiResult.getStr("errmsg"));
|
|
|
-// renderJson(resultBean);
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// // 如果开发者拥有多个移动应用、网站应用、和公众帐号(包括小程序),可通过unionid来区分用户的唯一性
|
|
|
-// // 同一用户,对同一个微信开放平台下的不同应用,unionid是相同的。
|
|
|
-//
|
|
|
-// String phone = apiResult.getStr("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;
|
|
|
-// }
|
|
|
-// DoctorsWechat doctorsWechat = DoctorsWechat.dao.findFirst("select * from doctors_wechat where wxa_openid=?",sessionResult.get("openid"));
|
|
|
-// doctorsWechat.setDoctorId(doctors.getId());
|
|
|
-// doctorsWechat.update();
|
|
|
-// LoginBean loginBean = new LoginBean();
|
|
|
-// loginBean.setSessionId(sessionId);
|
|
|
-// loginBean.setDoctorBean(doctors);
|
|
|
-// renderJson(new ResultBean(loginBean));
|
|
|
+ ApiResult apiResult = wxaUserApi.getUserInfo(sessionKey, encryptedData.replace(" ", "+"), iv);
|
|
|
+
|
|
|
+ if (!apiResult.isSucceed()) {
|
|
|
+ ResultBean resultBean = new ResultBean(apiResult.getInt("errcode"), apiResult.getStr("errmsg"));
|
|
|
+ renderJson(resultBean);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 如果开发者拥有多个移动应用、网站应用、和公众帐号(包括小程序),可通过unionid来区分用户的唯一性
|
|
|
+ // 同一用户,对同一个微信开放平台下的不同应用,unionid是相同的。
|
|
|
+
|
|
|
+ String phone = apiResult.getStr("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;
|
|
|
+ }
|
|
|
+ DoctorsWechat doctorsWechat = DoctorsWechat.dao.findFirst("select * from doctors_wechat where wxa_openid=?",sessionResult.get("openid"));
|
|
|
+ doctorsWechat.setDoctorId(doctors.getId());
|
|
|
+ doctorsWechat.update();
|
|
|
+ LoginBean loginBean = new LoginBean();
|
|
|
+ loginBean.setSessionId(sessionId);
|
|
|
+ loginBean.setDoctorBean(doctors);
|
|
|
+ renderJson(new ResultBean(loginBean));
|
|
|
|
|
|
}
|
|
|
}
|