张延森 3 years ago
parent
commit
756cac9307

+ 4
- 1
src/main/java/com/yunzhi/marketing/controller/MiniAppController.java View File

430
     @PostMapping("/signup")
430
     @PostMapping("/signup")
431
     public ResponseBean info(@RequestBody String paramStr, HttpServletRequest request) {
431
     public ResponseBean info(@RequestBody String paramStr, HttpServletRequest request) {
432
         String appid = request.getHeader("appid");
432
         String appid = request.getHeader("appid");
433
+        String openid = getOpenId(request);
433
         TaPerson person = null;
434
         TaPerson person = null;
434
         TaMiniapp miniapp = taMiniappService.getById(appid);
435
         TaMiniapp miniapp = taMiniappService.getById(appid);
435
         if (null == paramStr || "".equals(paramStr.trim()) || "{}".equals(paramStr.trim())) {
436
         if (null == paramStr || "".equals(paramStr.trim()) || "{}".equals(paramStr.trim())) {
436
-            String openid = getOpenId(request);
437
             List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
437
             List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
438
             if (null == taPersons || taPersons.size() != 1) {
438
             if (null == taPersons || taPersons.size() != 1) {
439
                 return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
439
                 return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
459
 
459
 
460
             // 解密用户信息
460
             // 解密用户信息
461
             WxMaUserInfo userInfo = miniAppService.getUserInfo(sessionKey, encryptedData, iv, appid);
461
             WxMaUserInfo userInfo = miniAppService.getUserInfo(sessionKey, encryptedData, iv, appid);
462
+            if (userInfo.getOpenId() == null) {
463
+                userInfo.setOpenId(openid);
464
+            }
462
 
465
 
463
             // 更新或保存用户信息
466
             // 更新或保存用户信息
464
             person = taPersonService.mergePersonWxInfo(userInfo);
467
             person = taPersonService.mergePersonWxInfo(userInfo);