admin
2018-12-10 a1538bb24b06589c24092c6847a977da21e63c00
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java
@@ -7,6 +7,7 @@
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;
@@ -22,11 +23,14 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.util.AESUtil;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.MonitorFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller(value = "ShareController1")
@@ -41,6 +45,9 @@
   @Resource
   private HongBaoManageService hongBaoManageService;
   @Resource
   private MonitorService monitorService;
   // 获取商品分享链接
   @RequestMapping(value = "getGoodsShareUrl")
@@ -59,7 +66,8 @@
    * @param out
    */
   @RequestMapping(value = "gettaobaosharelink")
   public void getTaobaoShareLink(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) {
   public void getTaobaoShareLink(AcceptData acceptData, Long uid, Long auctionId, HttpServletRequest request,
         PrintWriter out) {
      if (uid == null || uid <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
         return;
@@ -85,7 +93,8 @@
         data.put("clickUrl", url);
         data.put("token", taoBaoLink.getTaoToken());
         data.put("rule", "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
         data.put("rule",
               "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
         data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
         String shareText = "";
@@ -105,13 +114,20 @@
         }
         shareText = shareText.replace("[价格类型]", shopType);
         data.put("shareText", shareText);
         String descText=shareText.replace(taoBaoLink.getGoods().getTitle()+"\r\n", "");
         if(descText.startsWith("\\r\\n"))
            descText=descText.substring(0);
         data.put("descText",descText );
         String descText = shareText.replace(taoBaoLink.getGoods().getTitle() + "\r\n", "");
         if (descText.startsWith("\\r\\n"))
            descText = descText.substring(0);
         data.put("descText", descText);
         //
         String imgs = configService.get("goods_share_notify_imgs");
         JSONArray array = JSONArray.fromObject(imgs);
         int p = (int) (array.size() * Math.random());
         if (p < array.size())
            data.put("notifyPicture", array.optString(p));
         data.put("notifyDesc", configService.get("goods_share_notify"));
         // 添加分享记录
         BigDecimal rate = new BigDecimal(hongBaoManageService.get("hongbao_goods_proportion"));
         BigDecimal rate =hongBaoManageService.getFanLiRate();
         UserShareGoodsHistory history = new UserShareGoodsHistory();
         history.setTkCode(taoBaoLink.getTaoToken());
         history.setLink(taoBaoLink.getClickUrl());
@@ -141,6 +157,10 @@
         });
         return;
      } catch (ShareGoodsException e) {
         try {
            monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
         } catch (Exception e1) {
         }
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
      }