@RequestMapping(value = "/invite", method = RequestMethod.POST) public MomiaHttpResponse inviteCoupon( @RequestParam String mobile, @RequestParam(value = "invite") String inviteCode) { if (MomiaUtil.isInvalidMobile(mobile)) return MomiaHttpResponse.FAILED("无效的手机号码"); if (StringUtils.isBlank(inviteCode)) return MomiaHttpResponse.FAILED("无效的邀请码"); if (userServiceApi.getByMobile(mobile).exists()) return MomiaHttpResponse.FAILED("该手机号已经注册过,只有新用户才能领取"); couponServiceApi.invite(mobile, inviteCode); return MomiaHttpResponse.SUCCESS; }
@RequestMapping(value = "/share", method = RequestMethod.GET) public MomiaHttpResponse shareCoupon(@RequestParam String utoken) { if (StringUtils.isBlank(utoken)) return MomiaHttpResponse.TOKEN_EXPIRED; User user = userServiceApi.get(utoken); JSONObject shareJson = new JSONObject(); shareJson.put("img", Configuration.getString("Share.Img")); shareJson.put("desc", Configuration.getString("Share.Desc")); shareJson.put("url", Configuration.getString("Share.Url") + "?invite=" + user.getInviteCode()); shareJson.put("cover", Configuration.getString("Share.Cover")); shareJson.put("title", Configuration.getString("Share.Title")); shareJson.put("abstracts", Configuration.getString("Share.Abstracts")); return MomiaHttpResponse.SUCCESS(shareJson); }