@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); }
@RequestMapping(method = RequestMethod.GET) public MomiaHttpResponse index( HttpServletRequest request, @RequestParam(value = "city") int cityId, @RequestParam int start) { if (cityId < 0 || start < 0) return MomiaHttpResponse.BAD_REQUEST; JSONObject indexJson = new JSONObject(); if (start == 0) { int platform = getPlatform(request); String version = getVersion(request); indexJson.put("banners", getBanners(cityId, platform, version)); indexJson.put("icons", getIcons(cityId, platform, version)); indexJson.put("events", getEvents(cityId, platform, version, 0)); } indexJson.put("courses", getRecommendCourses(cityId, start)); return MomiaHttpResponse.SUCCESS(indexJson); }
@RequestMapping(value = "/code", method = RequestMethod.GET) public MomiaHttpResponse couponCode(@RequestParam String code) { if (StringUtils.isBlank(code)) return MomiaHttpResponse.FAILED("无效的优惠码"); return MomiaHttpResponse.SUCCESS(couponServiceApi.couponCode(code)); }
@RequestMapping(method = RequestMethod.GET) public MomiaHttpResponse getCoupon(@RequestParam int id) { Coupon coupon = couponServiceApi.get(id); if (!coupon.exists()) return MomiaHttpResponse.FAILED("无效的红包"); return MomiaHttpResponse.SUCCESS(coupon); }