| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpSession;
|
| | |
|
| | | import com.yeshi.fanli.util.*;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.alipay.api.AlipayApiException;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | |
| | | import com.yeshi.fanli.exception.user.AlipayAccountException;
|
| | | import com.yeshi.fanli.exception.user.AlipayTransferException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoException;
|
| | | 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.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | 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;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.entity.ProxyIP;
|
| | |
|
| | | /**
|
| | | * 账户系统
|
| | |
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | | private static final String EXTRACT_MAX_MONEY = "extract_max_money";
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | public void login(AcceptData acceptData, String code, String vcode, String phone, boolean wxinstall,
|
| | | String tbOpenid, String tbNickName, String tbPortrait, String tbSession, int loginType, Boolean first,
|
| | | HttpSession session, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | 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());
|
| | | // 绑定oppo,vivo推送
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | |
| | |
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.cookieLog("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | LogHelper.error("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | | @RequestMapping(value = "register")
|
| | | public void register(AcceptData acceptData, String tbOpenid, String tbNickName, String tbPortrait, String vcode,
|
| | | String phone, HttpServletRequest request, HttpSession session, PrintWriter out) {
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 账号打通
|
| | | * |
| | | * @param acceptData
|
| | | * @param mainUid
|
| | | * @param lessUid
|
| | | * @param session
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "connect")
|
| | | public void connect(AcceptData acceptData, long mainUid, long lessUid, HttpSession session, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (mainUid == 0 || lessUid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请上传打通用户ID"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userAccountService.connectUsers(new UserInfo(mainUid), new UserInfo(lessUid));
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(mainUid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", GsonUtil.toJsonExpose(UserUtil.filterForClientUser(user)));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户ID
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | return;
|
| | | }
|
| | | try {
|
| | | user = userAccountService.getUserInfoByWXUnionId(system.getAppid(), weiXinUser.getUnionid());
|
| | | user = userAccountService.getUserInfoByWXUnionId(SystemInfoUtil.getSystem(acceptData), weiXinUser.getUnionid());
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, null, "获取用户信息出错");
|
| | |
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(tbOpenid)) {
|
| | | try {
|
| | | user = userAccountService.getUserInfoByTaoBaoOpenId(system.getAppid(), tbOpenid);
|
| | | user = userAccountService.getUserInfoByTaoBaoOpenId(SystemInfoUtil.getSystem(acceptData), tbOpenid);
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(phone)) {
|
| | | try {
|
| | | user = userAccountService.getUserInfoByPhone(system.getAppid(), phone);
|
| | | user = userAccountService.getUserInfoByPhone(SystemInfoUtil.getSystem(acceptData), phone);
|
| | | } catch (UserAccountException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | |
|
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindAlipay, account);
|
| | | } catch (AlipayTransferException e1) {
|
| | | LogHelper.error("支付宝验证出错:"+new Gson().toJson(e1));
|
| | | if (e1.getSubCode().equalsIgnoreCase("PAYEE_NOT_EXIST")) {
|
| | | String msg = "系统未能成功转账0.1元,提现账号信息有误,请核对后重新填写。";
|
| | | out.print(JsonUtil.loadFalseResult(1, msg));
|
| | |
| | | data.put("totalUnGetTiChengMoney",
|
| | | hongBaoV2Service.getUnGetTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN).toString()); // 未到账提成
|
| | | // 展示提成数据
|
| | | if (configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | if (configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),SystemInfoUtil.getSystem(acceptData)))
|
| | | data.put("showTiCheng", false);
|
| | | else
|
| | | data.put("showTiCheng", spreadImgCount + shareCount > 0);
|
| | |
| | | public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | |
| | | UserInfo userInfo = null;
|
| | | // 手机登录
|
| | | if (loginType == 1) {
|
| | | userInfo = userAccountService.loginPhone(request, loginType, vcode, phone, system.getAppid());
|
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(),request.getRemotePort()), acceptData, loginType, vcode, phone, system.getAppid());
|
| | | }
|
| | |
|
| | | // 微信登录
|
| | | if (loginType == 2) {
|
| | | userInfo = userAccountService.loginWinXin(request, acceptData, loginType, code, system.getAppid());
|
| | | userInfo = userAccountService.loginWinXin(new ProxyIP(request.getRemoteHost(),request.getRemotePort()), acceptData, loginType, code, system.getAppid());
|
| | | }
|
| | |
|
| | | if (userInfo == null) {
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | /* 同步未登录之前设备抽奖数据 */
|
| | | 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, device);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 绑定oppo推送
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | |
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | try {
|
| | | LogHelper.cookieLog("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | LogHelper.error("登录出错:" + e.getCode() + "-" + e.getMessage());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | }
|