| | |
| | | |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.doumee.dao.business.web.response.HomeResponse; |
| | | import com.doumee.dao.business.web.response.UserResponse; |
| | | import com.doumee.service.business.MemberService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | * @date 2023/09/27 18:06 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MemberServiceImpl implements MemberService { |
| | | |
| | | @Autowired |
| | |
| | | memberMapper.insert(member); |
| | | return member.getId(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String createManageMember(Member member) { |
| | |
| | | */ |
| | | @Override |
| | | public AccountResponse wxLogin(String code) { |
| | | log.error("================================"+code+ JSONObject.toJSONString( WxMiniConfig.wxMaService.getWxMaConfig())); |
| | | try { |
| | | //获取微信敏感数据 |
| | | WxMaJscode2SessionResult session = WxMiniConfig.wxMaService.getUserService().getSessionInfo(code); |
| | | log.error("================================"+ JSONObject.toJSONString(session)); |
| | | String openId = session.getOpenid(); |
| | | String unionId = session.getUnionid(); |
| | | if (StringUtils.isBlank(openId)) { |
| | |
| | | accountResponse.setUserResponse(userResponse); |
| | | return accountResponse; |
| | | } catch (WxErrorException e) { |
| | | log.error(e.getMessage()); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "微信登录异常!请联系管理员"); |
| | | } |
| | | } |