yujian
2019-06-25 b7b8f2a4fe9059ef7b5470a68bb1b34787bc92b2
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
@@ -557,14 +557,9 @@
         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) {
@@ -631,7 +626,7 @@
                        : 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));
@@ -724,9 +719,9 @@
      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");
@@ -756,13 +751,19 @@
    * @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));
   }
@@ -773,8 +774,8 @@
    * @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")));