| | |
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.alipay.api.AlipayApiException;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.LoginResult;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TBPid;
|
| | |
| | | import com.yeshi.fanli.exception.AlipayTransferException;
|
| | | import com.yeshi.fanli.exception.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.MoneyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.PassWordErrorRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | |
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordService moneyRecordService;
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private BindingAccountService bindingAccountService;
|
| | |
| | | private ExtractService extractService;
|
| | |
|
| | | @Resource
|
| | | private PassWordErrorRecordService passWordErrorRecordService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | |
|
| | | |
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | |
| | | private LostOrderService lostOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | |
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private InviteGetMoneyService inviteGetMoneyService;
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | | private SpreadUserImgService spreadUserImgService;
|
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | |
|
| | | @Resource
|
| | | private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | * @param tbOpenid
|
| | | * @param tbNickName
|
| | | * @param tbPortrait
|
| | | * @param tbSession(淘宝session数据,加密)
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "login")
|
| | | public void login(AcceptData acceptData, String code, String vcode, String phone, boolean wxinstall,
|
| | | String tbOpenid, String tbNickName, String tbPortrait, int loginType, Boolean first, HttpSession session,HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | String tbOpenid, String tbNickName, String tbPortrait, String tbSession, int loginType, Boolean first,
|
| | | HttpSession session, HttpServletRequest request, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (loginType == 3)// 验证短信验证码
|
| | | if (loginType == 3 && !Constant.IS_TEST)// 验证短信验证码
|
| | | {
|
| | | String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
|
| | | if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | // 苹果应用商店上线测试号码
|
| | | if ("17316780233".equalsIgnoreCase(phone) && "258168".equalsIgnoreCase(vcode)) {
|
| | | ;
|
| | | } else {
|
| | | String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
|
| | | if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | | }
|
| | |
|
| | | UserInfo tbUserInfo = new UserInfo();
|
| | | if (!StringUtil.isNullOrEmpty(tbSession)) {
|
| | | try {
|
| | | tbSession = DESUtil.decode(tbSession.replace("\n", ""), StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | JSONObject tbs = JSONObject.fromObject(tbSession);
|
| | | tbOpenid = tbs.optString("openId");
|
| | | tbNickName = tbs.optString("nick");
|
| | | tbPortrait = tbs.optString("avatarUrl");
|
| | | // 淘宝ID
|
| | | tbUserInfo.setTaoBaoUid(tbs.optString("taobao_user_id"));
|
| | | }
|
| | |
|
| | | tbUserInfo.setOpenid(tbOpenid);
|
| | | tbUserInfo.setTbName(tbNickName);
|
| | | tbUserInfo.setTbPic(tbPortrait);
|
| | |
|
| | | try {
|
| | | LoginResult result = userAccountService.login(request, first, system.getAppid(), code, phone, tbUserInfo,
|
| | | wxinstall, loginType);
|
| | |
| | | root.put("type", result.getType());
|
| | | root.put("data", data);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | final UserInfo uuser = result.getUser();
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.cookieLog("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @RequestMapping(value = "register")
|
| | | public void register(AcceptData acceptData, String tbOpenid, String tbNickName, String tbPortrait, String vcode,
|
| | | String phone, HttpServletRequest request, HttpSession session, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | */
|
| | | @RequestMapping(value = "connect")
|
| | | public void connect(AcceptData acceptData, long mainUid, long lessUid, HttpSession session, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | */
|
| | | @RequestMapping(value = "getuid")
|
| | | public void getUid(AcceptData acceptData, String code, String tbOpenid, String phone, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "获取微信用户信息失败"));
|
| | | return;
|
| | | }
|
| | | user = userAccountService.getUserInfoByWXUnionId(system.getAppid(), weiXinUser.getUnionid());
|
| | | try {
|
| | | user = userAccountService.getUserInfoByWXUnionId(system.getAppid(), weiXinUser.getUnionid());
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, null, "获取用户信息出错");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(tbOpenid)) {
|
| | | user = userAccountService.getUserInfoByTaoBaoOpenId(system.getAppid(), tbOpenid);
|
| | | try {
|
| | | user = userAccountService.getUserInfoByTaoBaoOpenId(system.getAppid(), tbOpenid);
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(phone)) {
|
| | | user = userAccountService.getUserInfoByPhone(system.getAppid(), phone);
|
| | | try {
|
| | | user = userAccountService.getUserInfoByPhone(system.getAppid(), phone);
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (user == null) {
|
| | |
| | | */
|
| | | @RequestMapping(value = "bindPhone")
|
| | | public void bindPhone(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | |
|
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
|
| | |
|
| | | if (!vcode.equalsIgnoreCase(oldVCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!vcode.equalsIgnoreCase(oldVCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | }
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | | }
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | |
|
| | | try {
|
| | | userAccountService.bindPhone(uid, phone);
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断电话号码是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的电话号码被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", UserUtil.filterForClientUser(user));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | */
|
| | | @RequestMapping(value = "unBindPhone")
|
| | | public void unBindPhone(AcceptData acceptData, Long uid, String phone, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | * @param tbOpenid
|
| | | * @param tbNickName
|
| | | * @param tbPortrait
|
| | | * @param tbSession
|
| | | * -淘宝授权session
|
| | | * @param out
|
| | | */
|
| | |
|
| | | @RequestMapping(value = "bindTaoBao")
|
| | | public void bindTaoBao(AcceptData acceptData, Long uid, String tbOpenid, String tbNickName, String tbPortrait,
|
| | | PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | String tbSession, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String taoBaoUid = "";
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tbSession)) {
|
| | | try {
|
| | | tbSession = DESUtil.decode(tbSession.replace("\n", ""), StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | JSONObject session = JSONObject.fromObject(tbSession);
|
| | | tbOpenid = session.optString("openId");
|
| | | tbNickName = session.optString("nick");
|
| | | tbPortrait = session.optString("avatarUrl");
|
| | | taoBaoUid = session.optString("taobao_user_id");
|
| | | }
|
| | |
|
| | | try {
|
| | | userAccountService.bindTaoBao(uid, tbOpenid, tbNickName, tbPortrait);
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | |
|
| | | // 判断taoBaoUid是否已经封禁
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoUid)) {
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.taobaoUid, taoBaoUid);
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER,
|
| | | Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的淘宝号被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", UserUtil.filterForClientUser(user));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | */
|
| | | @RequestMapping(value = "unBindTaoBao")
|
| | | public void unBindTaoBao(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | */
|
| | | @RequestMapping(value = "changeWX")
|
| | | public void changeWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | try {
|
| | | userAccountService.changeWXBind(uid, code);
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断taoBaoUid是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.wxUnionId, user.getWxUnionId());
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的微信号被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", UserUtil.filterForClientUser(user));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | */
|
| | | @RequestMapping(value = "getphone")
|
| | | public void getPhone(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | |
|
| | | @RequestMapping(value = "verifyvcodeforbind")
|
| | | public void verifyVcodeForbind(AcceptData acceptData, Long uid, String vcode, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | */
|
| | | @RequestMapping(value = "bindalipay")
|
| | | public void bindAlipay(AcceptData acceptData, Long uid, String name, String account, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | @RequestMapping(value = "bindalipaywithverify")
|
| | | public void bindAlipayWithVerify(AcceptData acceptData, Long uid, String name, String account, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | redisManager.removeCommonString(key);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @RequestMapping(value = "bindalipaywithverifynew")
|
| | | public void bindAlipayWithVerifyNew(AcceptData acceptData, Long uid, String name, String account, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 120);
|
| | |
|
| | | // 支付宝绑定
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.alipayAccount, account);
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的支付宝被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | // 可以展示给用户看的错误码
|
| | | String[] ALIPAY_CODES = new String[] { "SYSTEM_ERROR", "PERMIT_CHECK_PERM_LIMITED", "PERM_AML_NOT_REALNAME_REV",
|
| | | "PERM_AML_NOT_REALNAME_REV", "PAYEE_USER_INFO_ERROR", "PAYEE_ACC_OCUPIED",
|
| | | "PERMIT_CHECK_PERM_IDENTITY_THEFT", "PERMIT_NON_BANK_LIMIT_PAYEE", "EXCEED_LIMIT_UNRN_DM_AMOUNT" };
|
| | | try {
|
| | | BindingAccount bindingAccount = bindingAccountService.changeAlipayBindingWithVerify(uid, name, account);
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getGson().toJson(bindingAccount), "系统已成功转账0.1元到提现账号中,提现账号验证通过,恭喜你!可以提现了。"));
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getGson().toJson(bindingAccount),
|
| | | "系统已成功转账0.1元到提现账号中,提现账号验证通过,恭喜你!可以提现了。"));
|
| | | } catch (AlipayTransferException e1) {
|
| | | if (e1.getSubCode().equalsIgnoreCase("PAYEE_NOT_EXIST")) {
|
| | | String msg = "系统未能成功转账0.1元,提现账号信息有误,请核对后重新填写。";
|
| | |
| | | redisManager.removeCommonString(key);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取用户资金详情
|
| | |
| | | */
|
| | | @RequestMapping(value = "getusermoney")
|
| | | public void getMoneyDetail(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "用户不存在"));
|
| | | return;
|
| | | }
|
| | | BigDecimal moneyToday = inviteGetMoneyService.getMoneyToday(uid + "");
|
| | | BigDecimal moneyToday = userMoneyService.getMoneyToday(uid);
|
| | | if (moneyToday == null) {
|
| | | moneyToday = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal moneyMonth = inviteGetMoneyService.getMoneyMonth(uid + "");
|
| | | BigDecimal moneyMonth = userMoneyService.getMoneyMonth(uid);
|
| | | if (moneyMonth == null) {
|
| | | moneyMonth = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
|
| | | BigDecimal unOpenmoney = hongBaoService.getUnOpenHongBaoByUid(uid);
|
| | | BigDecimal totalFanMoney = hongBaoService.getMyTotalHongBaoByUid(user.getId());
|
| | | BigDecimal moneyLastMonth = userMoneyService.getMoneyLastMonth(uid);
|
| | | BigDecimal unOpenmoney = hongBaoV2Service.getUnRecievedFanLiMoney(uid);
|
| | | BigDecimal totalFanMoney = hongBaoV2Service.getTotalFanLiMoney(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | int spreadImgCount = spreadUserImgService.countUserSpreadImg(uid);
|
| | | long shareCount = userShareGoodsRecordService.countShareRecordByUid(uid);
|
| | |
|
| | | // IOS端数字按照字符串处理
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 33) {
|
| | | data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("moneyLastMonth", moneyLastMonth.toString());
|
| | | data.put("money", user.getMyHongBao().toString());
|
| | | data.put("unGetMoney", unOpenmoney.toString());
|
| | | data.put("totalFanLiMoney", totalFanMoney.toString());// 累计返利
|
| | | data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid).toString());// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid).toString()); // 未到账提成
|
| | | data.put("moneyLastMonth", moneyLastMonth.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("money", user.getMyHongBao().setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("unGetMoney", unOpenmoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("totalFanLiMoney", totalFanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());// 累计返利
|
| | | data.put("totalTiChengMoney",
|
| | | hongBaoV2Service.getTotalTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN).toString());// 累计提成
|
| | | data.put("totalUnGetTiChengMoney",
|
| | | hongBaoV2Service.getUnGetTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN).toString()); // 未到账提成
|
| | | // 展示提成数据
|
| | | data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
|
| | | if (configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | data.put("showTiCheng", false);
|
| | | else
|
| | | data.put("showTiCheng", spreadImgCount + shareCount > 0);
|
| | | } else {
|
| | | data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyLastMonth", moneyLastMonth);
|
| | | data.put("money", user.getMyHongBao());
|
| | | data.put("unGetMoney", unOpenmoney);
|
| | | data.put("totalFanLiMoney", totalFanMoney);// 累计返利
|
| | | data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid));// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid)); // 未到账提成
|
| | | data.put("moneyLastMonth", moneyLastMonth.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("money", user.getMyHongBao().setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("unGetMoney", unOpenmoney.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("totalFanLiMoney", totalFanMoney.setScale(2, BigDecimal.ROUND_DOWN));// 累计返利
|
| | | data.put("totalTiChengMoney",
|
| | | hongBaoV2Service.getTotalTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN));// 累计提成
|
| | | data.put("totalUnGetTiChengMoney",
|
| | | hongBaoV2Service.getUnGetTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN)); // 未到账提成
|
| | | // 展示提成数据
|
| | | data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
|
| | | data.put("showTiCheng", spreadImgCount + shareCount > 0);
|
| | | }
|
| | |
|
| | | user.setNoOpenHongBao(unOpenmoney);
|
| | |
| | |
|
| | | } else {
|
| | |
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | |
|
| | | }
|
| | |
|
| | | } else {
|
| | |
| | | deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | | * @param acceptData
|
| | | * @param vcode
|
| | | * @param phone
|
| | | * @param code
|
| | | * @param loginType 登录方式: 1-手机登录 2-微信登录
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "loginNew", method = RequestMethod.POST)
|
| | | public void loginNew(AcceptData acceptData, String vcode, String phone, String code,
|
| | | int loginType, HttpServletRequest request, PrintWriter out) {
|
| | | |
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo userInfo = null;
|
| | | // 手机登录
|
| | | if (loginType == 1) {
|
| | | userInfo = userAccountService.loginPhone(request, loginType, vcode, phone, system.getAppid());
|
| | | }
|
| | | |
| | | // 微信登录
|
| | | if (loginType == 2) {
|
| | | userInfo = userAccountService.loginWinXin(request,loginType, code, system.getAppid());
|
| | | }
|
| | | |
| | | if (userInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult("登录失败"));
|
| | | } else {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | |
| | | /* 同步未登录之前设备抽奖数据 */
|
| | | final UserInfo uuser = userInfo;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | | |
| | | }
|
| | | |
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | try {
|
| | | LogHelper.cookieLog("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("登录失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 绑定电话号码 V1.5.3
|
| | | * |
| | | * @param acceptData
|
| | | * @param vcode
|
| | | * @param phone
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "bindPhoneNew")
|
| | | public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) {
|
| | | |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(vcode)) {
|
| | | out.print(JsonUtil.loadFalseResult("验证码不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(phone)) {
|
| | | out.print(JsonUtil.loadFalseResult("电话号码不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | phone = phone.replaceAll(" ", "");
|
| | | |
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!vcode.equalsIgnoreCase(oldVCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(9001, "验证码错误,重新输入"));
|
| | | return;
|
| | | }
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
|
| | | }
|
| | | |
| | | |
| | | try {
|
| | | // 绑定用户
|
| | | userAccountService.bindPhoneNew(uid, phone);
|
| | | |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断电话号码是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的电话号码被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(user));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "绑定失败"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 更改微信
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param code
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "bindWeiXin")
|
| | | public void bindWeiXin(AcceptData acceptData, Long uid, String code, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | |
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(code)) {
|
| | | out.print(JsonUtil.loadFalseResult("请上传code"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userAccountService.bindWeiXin(uid, code);
|
| | | |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断taoBaoUid是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.wxUnionId, user.getWxUnionId());
|
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | // 封禁用户
|
| | | // 封禁绑定的正常用户
|
| | | if (user != null && user.getState() != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | | UserInfo update = new UserInfo(uid);
|
| | | update.setState(UserInfo.STATE_FORBIDDEN);
|
| | | update.setStateDesc("绑定被封禁的微信号被封禁");
|
| | | userInfoService.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(user));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|