|
|
@@ -6,6 +6,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.izouma.jiashanxia.config.Constants;
|
|
|
import com.izouma.jiashanxia.domain.User;
|
|
|
import com.izouma.jiashanxia.dto.PageQuery;
|
|
|
@@ -157,10 +158,13 @@ public class UserService {
|
|
|
|
|
|
// 解密用户信息
|
|
|
WxMaUserInfo wxUserInfo = wxMaService.getUserService().getUserInfo(sessionKey, encryptedData, iv);
|
|
|
- User user = userRepo.findByOpenIdAndDelFalse(wxUserInfo.getOpenId());
|
|
|
+ User user;
|
|
|
|
|
|
- if (wxUserInfo.getOpenId() == null) {
|
|
|
- user = SecurityUtils.getAuthenticatedUser();
|
|
|
+ log.info("openId----->" + wxUserInfo.getOpenId());
|
|
|
+ if (StrUtil.isBlank(wxUserInfo.getOpenId())) {
|
|
|
+ user = userRepo.findById(SecurityUtils.getAuthenticatedUser().getId()).orElse(null);
|
|
|
+ } else {
|
|
|
+ user = userRepo.findByOpenIdAndDelFalse(wxUserInfo.getOpenId());
|
|
|
}
|
|
|
|
|
|
String avatarUrl = Constants.DEFAULT_AVATAR;
|