| | |
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.util.*;
|
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | | import org.yeshi.utils.entity.ProxyIP;
|
| | | import org.yeshi.utils.entity.wx.WeiXinUser;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.util.wx.MyWXLoginUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.wx.WXAppLoginUtil;
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | | import redis.clients.jedis.Transaction;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | // @Resource
|
| | | // private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
| | | @Resource
|
| | | private UserInfoDeleteRecordService userInfoDeleteRecordService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | | private ConfigService configService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | |
| | | LogHelper.lgoinInfo(logInfo.toString());
|
| | |
|
| | | HttpSession session = request.getSession();
|
| | | if (first != null && first == true)
|
| | | if (first != null && first == true) {
|
| | | session.removeAttribute("LAST_LOGIN_USER");
|
| | | // 会话中上次登录的用户
|
| | | }
|
| | | // 会话中上次登录的用户
|
| | | if (wxinstall) {// 安装了微信的状态
|
| | | UserInfo lastUser = (UserInfo) session.getAttribute("LAST_LOGIN_USER");
|
| | | UserInfo userInfo = null;
|
| | |
| | | case 2:// 微信
|
| | | // 通过Code换取信息
|
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
|
| | | weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | weiXinUser = MyWXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | wxAccount.getAppSecret());
|
| | | if (weiXinUser == null)
|
| | | throw new UserAccountException(1001, "无法获取到微信个人信息");
|
| | |
| | | case 2:// 微信
|
| | | // 通过Code换取信息
|
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
|
| | | weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | weiXinUser = MyWXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | wxAccount.getAppSecret());
|
| | | if (weiXinUser == null)
|
| | | throw new UserAccountException(1001, "无法获取到微信个人信息");
|
| | |
| | | if (user == null)
|
| | | throw new UserAccountException(4, "用户不存在");
|
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | WeiXinUser weiXinUser = MyWXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | wxAccount.getAppSecret());
|
| | | if (weiXinUser == null)
|
| | | throw new UserAccountException(10, "获取微信用户信息失败");
|
| | |
| | | throw new UserAccountException(1, "请输入手机号码");
|
| | | }
|
| | | phone = phone.replaceAll(" ", "");
|
| | | boolean isDemo=false;
|
| | | //查询上线测试的号码与验证码
|
| | | String demoLogin = configService.getValue(ConfigKeyEnum.demoLoginUser, businessSystem.getSystem());
|
| | | if (!StringUtil.isNullOrEmpty(demoLogin)) {
|
| | | String demoPhone = demoLogin.split("#")[0];
|
| | | String demoCode = demoLogin.split("#")[1];
|
| | | if(phone.equalsIgnoreCase(demoPhone)&&demoCode.equalsIgnoreCase(vcode)){
|
| | | isDemo=true;
|
| | | }
|
| | | }
|
| | |
|
| | | // "17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode);
|
| | |
|
| | | // 苹果应用商店上线测试号码
|
| | | if ("17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode)) {
|
| | | if (isDemo) {//测试号码
|
| | | ;
|
| | | } else {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(vcode)) {
|
| | | throw new UserAccountException(1, "请输入验证码");
|
| | | }
|
| | |
| | | LogHelper.lgoinInfo(logInfo.toString());
|
| | |
|
| | | // 通过Code换取信息
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, businessSystem.getWxAppId(), businessSystem.getWxAppSecret());
|
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, businessSystem.getWxAppId(), businessSystem.getWxAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserAccountException(1, "微信帐号授权失败");
|
| | | }
|
| | |
| | | LogHelper.lgoinInfo(logInfo.toString());
|
| | |
|
| | | // 通过Code换取信息
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(wxCode, businessSystem.getWxAppId(), businessSystem.getWxAppSecret());
|
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(wxCode, businessSystem.getWxAppId(), businessSystem.getWxAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserAccountException(1, "微信帐号授权失败");
|
| | | }
|
| | |
| | | @Override
|
| | | public void bindWeiXin(AcceptData acceptData, Long uid, String code) throws UserAccountException {
|
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
|
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserAccountException(2, "微信帐号授权失败");
|
| | | }
|
| | |
| | |
|
| | | // 通过Code换取信息
|
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
|
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserAccountException(1, "微信帐号授权失败");
|
| | | }
|