| | |
| | | out.print(JsonUtil.loadFalseResult(4, "商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String from = null;
|
| | | if (tljId != null) {
|
| | | from = "taolijin";
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = getShareTemplate(uid, hasCoupon, from);
|
| | | template = getShareTemplate(uid, hasCoupon, tljId);
|
| | |
|
| | | // 校验券模板是否正确
|
| | | if (hasCoupon) {
|
| | |
| | | : goodsLink.getCouponLink());
|
| | | }
|
| | | String content = shareGoodsTextTemplateService.createContentByTemplate(template, uid, goods, token, shortLink,
|
| | | hasCoupon, from);
|
| | | hasCoupon, tljId);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("content", content);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | private String getShareTemplate(Long uid, boolean hasCoupon, String from) {
|
| | | private String getShareTemplate(Long uid, boolean hasCoupon, Long tljId) {
|
| | | if (hasCoupon) {
|
| | | if (!StringUtil.isNullOrEmpty(from) && "taolijin".equals(from)) {
|
| | | if (tljId != null) {
|
| | | String template = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configTaoLiJinService.getValueByKey("goods_share_text");
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShareTextTemplate", method = RequestMethod.POST)
|
| | | public void getShareTextTemplate(AcceptData acceptData, Long uid, String from, Boolean hasCoupon, PrintWriter out) {
|
| | | public void getShareTextTemplate(AcceptData acceptData, Long uid, Long tljId, Boolean hasCoupon, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (hasCoupon == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "是否有券字段为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("template", getShareTemplate(uid, hasCoupon, from));
|
| | | data.put("template", getShareTemplate(uid, hasCoupon, tljId));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShareTextTemplateRules", method = RequestMethod.POST)
|
| | | public void getShareTextTemplateRules(AcceptData acceptData, String from, PrintWriter out) {
|
| | | if (!StringUtil.isNullOrEmpty(from) && "taolijin".equals(from)) {
|
| | | public void getShareTextTemplateRules(AcceptData acceptData, Long tljId, PrintWriter out) {
|
| | | if (tljId != null) {
|
| | | out.print(JsonUtil.loadTrueResult( configTaoLiJinService.getValueByKey("share_goods_rules")));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(configService.get("share_goods_template_rules")));
|