| | |
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.util.*;
|
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | |
|
| | | /**
|
| | | * 根据系统与unionid寻找用户
|
| | | *
|
| | | * @param system
|
| | | * @param unionId
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | *根据系统和淘宝的Openid寻找用户
|
| | | *
|
| | | * @param system
|
| | | * @param openId
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 根据系统和电话号码寻找用户
|
| | | *
|
| | | * @param system
|
| | | * @param phone
|
| | | * @return
|
| | |
| | | throw new UserAccountException(10, "请稍后再试");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserInfo loginTB(ProxyIP ipInfo, TaoBaoUser taoBaoUser, BusinessSystem businessSystem) throws UserAccountException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoUser.getUserid()))
|
| | | throw new UserAccountException(1, "淘宝授权信息不完整");
|
| | |
|
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByOpenId(taoBaoUser.getOpenId(), businessSystem.getSystem());
|
| | | if (userInfo != null) {
|
| | | // 更新账户登录信息
|
| | | updateLonginInfo(userInfo, 1, ipInfo);
|
| | | } else {
|
| | | userInfo = new UserInfo();
|
| | | userInfo.setNickName(taoBaoUser.getNick());
|
| | | userInfo.setPortrait(taoBaoUser.getAvatarUrl());
|
| | | userInfo.setAppId(businessSystem.getAppid());
|
| | | userInfo.setTaoBaoUid(taoBaoUser.getUserid());
|
| | | userInfo.setOpenid(taoBaoUser.getOpenId());
|
| | | userInfo.setLoginType(1);
|
| | | userInfo.setState(UserInfo.STATE_NORMAL);
|
| | | userInfo.setSystem(businessSystem.getSystem());
|
| | | // 创建用户
|
| | | addUser(userInfo);
|
| | | try {
|
| | | // 第一次登录时创建用户额外信息
|
| | | userInfoExtraService.createUserInfoExtra(userInfo.getId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public UserInfo loginPhoneNew(ProxyIP ipInfo, AcceptData acceptData, int loginType, String vcode, String phone, String appId)
|
| | | public UserInfo loginPhoneNew(ProxyIP ipInfo, AcceptData acceptData, int loginType, String vcode, String
|
| | | phone, String appId)
|
| | | throws UserAccountException {
|
| | | // 空额清理
|
| | | if (phone == null || phone.trim().length() == 0) {
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public UserInfo bindWXToLogin(ProxyIP ipInfo, AcceptData acceptData, String code, String appId, String key) throws UserAccountException {
|
| | | public UserInfo bindWXToLogin(ProxyIP ipInfo, AcceptData acceptData, String code, String appId, String key) throws
|
| | | UserAccountException {
|
| | | // 日志信息
|
| | | JSONObject logInfo = new JSONObject();
|
| | | logInfo.put("appId", appId);
|