| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("nickName", userInfo.getNickName());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("tips", "确认要成为TA的一级队员吗?邀请关系一旦建立不可更改。");
|
| | | data.put("tips", "确认要成为TA的直接粉丝吗?邀请关系一旦建立不可更改。");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | if (wxUnionId == null || wxUnionId.trim().length() == 0)
|
| | | throw new UserInfoExtraException(1, "微信授权失败");
|
| | |
|
| | | String activeWX = StringUtil.Md5("activeWX:" + weiXinUser.getUnionid());
|
| | | redisManager.cacheCommonString(activeWX, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("activeWX:" + weiXinUser.getUnionid()));
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | |
|
| | | // 邀请关系用户信息
|
| | | UserInfo userInfo = userInfoExtraService.getInviterInfo(uid, wxUnionId);
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("nickName", userInfo.getNickName());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("tips", "确认要成为TA的一级队员吗?邀请关系一旦建立不可更改。");
|
| | | data.put("key", activeWX);
|
| | | data.put("tips", "确认要成为TA的直接粉丝吗?邀请关系一旦建立不可更改。");
|
| | | data.put("key", key);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | @RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
|
| | | public void getMyTeam(AcceptData acceptData, long page, long uid, int type, PrintWriter out) {
|
| | | if (type != 1 && type != 2) {
|
| | | out.print(JsonUtil.loadFalseResult("队员类型不正确"));
|
| | | out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | boolean needVIPInfo = false;
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | needVIPInfo = true;
|
| | |
|
| | | // 组织数据
|
| | |
| | | */
|
| | | @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
|
| | | public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
|
| | | JSONObject bossData = getBossInfo(acceptData, uid, threeSaleSerivce.getMyBoss(uid));
|
| | | JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
|
| | | JSONObject resultData = new JSONObject();
|
| | |
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | resultData.put("boss", bossData);
|
| | | resultData.put("helpLink", configService.get("team_help_url"));
|
| | | resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
|
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("firstTeamTotal", threeSaleSerivce.countFirstTeam(uid, null));
|
| | | resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1));
|
| | |
| | | boolean hasTeam = true;
|
| | | if (firstTeam <= 0) {
|
| | | hasTeam = false;
|
| | | resultData.put("invitelink", configService.get("invite_activation_url"));
|
| | | resultData.put("invitelink", configService.get(ConfigKeyEnum.inviteActivationUrl.getKey()));
|
| | | }
|
| | | resultData.put("hasTeam", hasTeam);
|
| | |
|
| | |
| | | resultData.put("hasCode", hasCode);
|
| | | if (!hasCode) {
|
| | | List<String> tipCode = new ArrayList<String>();
|
| | | resultData.put("helpLinkActivate", configService.get("team_help_url"));
|
| | | tipCode.add("激活邀请功能后才可以邀请队员,一级队员是由你直接邀请,二级队员是由你的一级队员邀请。");
|
| | | resultData.put("helpLinkActivate", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
|
| | | tipCode.add("激活邀请功能后才可以邀请粉丝,直接粉丝是由你直接邀请,间接粉丝是由你的直接粉丝邀请。");
|
| | | tipCode.add("邀请激活功能,必须要有邀请码,邀请码可以通过金币兑换,也可以全网搜索。");
|
| | | resultData.put("tipCode", tipCode);
|
| | | }
|
| | |
| | | // 未添加微信号
|
| | | List<String> tipWeiXin = new ArrayList<String>();
|
| | | if (!bdWeiXin) {
|
| | | tipWeiXin.add("添加微信号后,你的邀请人和一级队员可通过微信号与你建立联系;");
|
| | | tipWeiXin.add("你也可以向邀请人学习或向一级队员教授赚钱技巧。");
|
| | | tipWeiXin.add("添加微信号后,你的邀请人和直接粉丝可通过微信号与你建立联系;");
|
| | | tipWeiXin.add("你也可以向邀请人学习或向直接粉丝教授赚钱技巧。");
|
| | | }
|
| | | resultData.put("tipWeiXin", tipWeiXin);
|
| | | resultData.put("tipWeiXinAdd", "添加微信号后,你的邀请人和一级队员可以通过微信与你建立联系。");
|
| | | resultData.put("tipWeiXinAdd", "添加微信号后,你的邀请人和直接粉丝可以通过微信与你建立联系。");
|
| | | resultData.put("bdWeiXin", bdWeiXin);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户信息
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBossInfo", method = RequestMethod.POST)
|
| | | public void getBossInfo(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
|
| | | out.print(JsonUtil.loadTrueResult(bossData));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 上级信息组织
|
| | | *
|
| | |
| | | * @param threeSale
|
| | | * @return
|
| | | */
|
| | | private JSONObject getBossInfo(AcceptData acceptData, long uid, ThreeSale threeSale) {
|
| | | private JSONObject getBossInfo(long uid, ThreeSale threeSale) {
|
| | | JSONObject bossData = new JSONObject();
|
| | | if (threeSale != null && threeSale.getBoss() != null) {
|
| | | UserInfo boss = threeSale.getBoss();
|
| | |
| | | bossData.put("inviteTime", "你于 " + sdf.format(inviteTime) + "接受了TA的邀请");
|
| | | } else {
|
| | | bossData.put("hasBoss", false);
|
| | | bossData.put("helpLink", configService.get("invite_code_hlep_link"));
|
| | | bossData.put("helpLink", configService.get(ConfigKeyEnum.inviteCodeHlepLink.getKey()));
|
| | | bossData.put("weiXinTip", "恭喜你,我们的优质用户;\r\n你并没有邀请人,但你的邀请激活功能是被默认开启的;\r\n你拥有独特的无邀请人激活码。");
|
| | | }
|
| | | return bossData;
|
| | |
| | |
|
| | | Long bossId = null;
|
| | | Long workerId = null;
|
| | | String title = "队员提醒消息";
|
| | | String title = "粉丝提醒消息";
|
| | | String content = "";
|
| | | if (remindBoss) {
|
| | | // 提示队长
|
| | | bossId = remindId;
|
| | | workerId = uid;
|
| | | content = "你的一级队员" + userInfo.getNickName()
|
| | | content = "你的直接粉丝" + userInfo.getNickName()
|
| | | + ",提醒你添加微信号,以便于和你取得联系和学习省钱技巧,赶快去添加吧;注:请升级到本软件最新版本在“我的-我的信息”中添加。";
|
| | | } else {
|
| | | // 提示队员
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | @RequestSerializableByKey(key = "'getInviteImgs-'+#uid")
|
| | | @RequestMapping(value = "/getInviteImgs", method = RequestMethod.POST)
|
| | | public void getInviteImgs(AcceptData acceptData, Long uid, Integer page, PrintWriter out, HttpServletRequest request) {
|
| | | if (uid == null || uid <= 0) {
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", spreadImgService.countAll());
|
| | | data.put("inviteCode", inviteCode);
|
| | | data.put("helpLink", configService.get("invite_help_link"));
|
| | | data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
|
| | | data.put("inviteRules", values.getValue().replace("\n", "<br><br>"));
|
| | | data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
|
| | | data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
|
| | | data.put("inviteLink", Constant.YINGYONGBAO_LINK);
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | out.print(JsonUtil.loadFalseResult("邀请信息获取失败"));
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 站内信提醒队员添加微信号
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param inviteId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "tailorCode")
|
| | | public void tailorCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户id缺失"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("num", threeSaleSerivce.countFirstTeam(uid, 1));
|
| | | data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | | }
|