| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.money.InviteGetMoney;
|
| | |
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | 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.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankingsService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.annotation.integral.IntegralGetFrequencyLimit;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | data.put("activityRules", valueBr);
|
| | | data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
|
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
|
| | | List<SwiperPicture> pictureList = swiperPictureService.getByBannerCard("invite_top_banner");
|
| | | List<SwiperPicture> pictureList = swiperPictureService.getByBannerCardAndVersion("invite_top_banner",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (pictureList != null && pictureList.size() > 0) {
|
| | | SwiperPicture picture = pictureList.get(0);
|
| | | com.alibaba.fastjson.JSONObject pictureJson = new com.alibaba.fastjson.JSONObject();
|
| | |
| | | data.put("topBanner", pictureJson);
|
| | | }
|
| | |
|
| | |
|
| | | data.put("desc", configService.get("invite_desc"));
|
| | | data.put("desc", configService.get(ConfigKeyEnum.inviteDesc.getKey()));
|
| | |
|
| | | boolean hasCode = false;
|
| | | if (uid != null && uid.trim().length() > 0) {
|
| | | String inviteCode = userInfoExtraService.getUserInviteCode(Long.parseLong(uid));
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(Long.parseLong(uid));
|
| | | if (inviteCode != null && inviteCode.trim().length() > 0) {
|
| | | hasCode = true; // 已有邀请码
|
| | | }
|
| | |
| | |
|
| | | // 邀请激活链接
|
| | | if (!hasCode) {
|
| | | data.put("activationlink", configService.get("invite_activation_url"));
|
| | | data.put("activationlink", configService.get(ConfigKeyEnum.inviteActivationUrl.getKey()));
|
| | | }
|
| | |
|
| | | data.put("hasCode", hasCode);
|
| | |
| | | * @throws NotExistObjectException
|
| | | * @throws IOException
|
| | | */
|
| | | @RequestSerializableByKey(key = "'listInviteFriendImg-'+#uid")
|
| | | @RequestMapping(value = "/listInviteFriendImg", method = RequestMethod.POST)
|
| | | public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out)
|
| | | public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out, HttpServletRequest request)
|
| | | throws NotExistObjectException, IOException {
|
| | | JSONObject data = new JSONObject();
|
| | | if (uid != null && !uid.equals("0")) {
|
| | | List<String> imgList = spreadUserImgService.getUserSpreadImg(uid);
|
| | | List<String> imgList = spreadUserImgService.getUserSpreadImg(uid, request);
|
| | | data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
|
| | | }
|
| | |
|
| | | // 邀请链接
|
| | | String shortLink = HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/" |
| | | + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
|
| | | data.put("inviteLink", shortLink);
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | // String shortLink = HttpUtil.getShortLink("http://" +
|
| | | // Constant.wxGZConfig.getLoginHost() + "/"
|
| | | // + Constant.systemCommonConfig.getProjectName() +
|
| | | // "/client/threeShareNew?uid=" + uid);
|
| | | data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
|
| | |
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (!StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | data.put("inviteCode", inviteCode);
|
| | | }
|
| | | |
| | |
|
| | | // 邀请规则
|
| | | String key = "inviteRules"; // key值
|
| | | BusinessSystem system = new BusinessSystem();
|
| | |
| | | String valueN = values.getValue();
|
| | | String valueBr = valueN.replace("\n", "<br><br>");
|
| | |
|
| | | data.put("helpLink", configService.get("invite_help_link"));
|
| | | |
| | | data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
|
| | |
|
| | | data.put("inviteRules", valueBr);
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | }
|
| | |
| | | @RequestMapping(value = "getActivationTip")
|
| | | public void getActivationTip(AcceptData acceptData, String callback, PrintWriter out) {
|
| | | try {
|
| | | String tip = configService.get("invite_activation_tip");
|
| | | String tip = configService.get(ConfigKeyEnum.inviteActivationTip.getKey());
|
| | | if (tip == null || tip.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无提醒"));
|
| | | return;
|
| | |
| | | * 邀请嘛
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'activationInvite-'+#uid")
|
| | | @RequestMapping(value = "activationInvite")
|
| | | public void activationInvite(AcceptData acceptData, String callback, Long uid, String inviteCode, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | if (uid == null || inviteCode == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("激活失败"));
|
| | | return;
|
| | | }
|
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | String myInviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("inviteCode", myInviteCode);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("邀请码激活成功"));
|
| | | } else
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("邀请码激活成功"));
|
| | |
|
| | | } catch (UserInfoExtraException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 激活邀请
|
| | | *
|
| | |
| | | * 邀请嘛
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'activationInviteWX-'+#uid")
|
| | | @RequestMapping(value = "activationInviteWX")
|
| | | public void activationInviteWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
|
| | | public void activationInviteWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
|
| | | try {
|
| | | userInfoExtraService.activationInviteWX(uid, code);
|
| | | out.print(JsonUtil.loadTrueResult("邀请码激活成功"));
|
| | | userInfoExtraService.activationInviteWX(
|
| | | Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion()), uid, code);
|
| | |
|
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | String myInviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("inviteCode", myInviteCode);
|
| | | JsonUtil.printMode(out, "", JsonUtil.loadTrueResult(data));
|
| | | } else
|
| | | out.print(JsonUtil.loadTrueResult("邀请码激活成功"));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取邀请码
|
| | | *
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || userInfoExtra.getInviteCode() == null) {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("邀请码不存在"));
|
| | | return;
|
| | | }
|
| | | String tip = configService.get("invite_activation_success_tip");
|
| | | String tip = configService.get(ConfigKeyEnum.inviteActivationSuccessTip.getKey());
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | data.put("inviteCode", inviteCode);
|
| | | data.put("tip", tip);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|