Esempio n. 1
0
        public static int SaveCouponRuleInfo(PromotionModel PromotionModel, string action, string[] shoptypes, string[] shopids, string[] categorys, string[] brands, string[] pids)
        {
            PromotionModel.ConfigType = ((categorys ?? new string[] { }).Any() ? 1 : 0) +
                                        ((brands ?? new string[] { }).Any() ? 2 : 0) +
                                        ((pids ?? new string[] { }).Any() ? 4 : 0) +
                                        ((shoptypes ?? new string[] { }).Any() ? 8 : 0) +
                                        ((shopids ?? new string[] { }).Any() ? 16 : 0);
            switch (action)
            {
            case "add":
                return(DALPromotion.SaveCouponRuleInfo(PromotionModel, shoptypes, shopids, categorys, brands, pids));

            case "update":
                #region 链接信息处理
                //APP
                if (PromotionModel.CustomSkipPage == "{{TempProductListRouteLink}}")
                {
                    PromotionModel.CustomSkipPage = "/searchResult?ruleid=" + PromotionModel.PKID + "&s=";
                }
                else if (PromotionModel.CustomSkipPage == "{{GroupBuyingProductLink}}")
                {
                    PromotionModel.CustomSkipPage = "/webView?url=https%3A%2F%2Fwx.tuhu.cn%2Fvue%2FGroupBuy%2Fpages%2Fsearch%2Fsearch%3FruleId%3D" + PromotionModel.PKID;
                }
                //小程序
                if (PromotionModel.WxSkipPage == "{{TempProductListRouteLink}}")           //商品列表
                {
                    PromotionModel.WxSkipPage = "/pages/search/search?flag=coupon&ruleId=" + PromotionModel.PKID;
                }
                else if (PromotionModel.WxSkipPage == "{{GroupBuyingProductLink}}")        //拼团商品列表
                {
                    PromotionModel.WxSkipPage = "/pages/search/search?appid=wx25f9f129712845af&ruleId=" + PromotionModel.PKID;
                }
                //H5
                if (PromotionModel.H5SkipPage == "{{TempProductListRouteLink}}")
                {
                    PromotionModel.H5SkipPage = "http://wx.tuhu.cn/ChePin/CpList?ruleId=" + PromotionModel.PKID;
                }
                else if (PromotionModel.H5SkipPage == "{{GroupBuyingProductLink}}")
                {
                    PromotionModel.H5SkipPage = "https://wx.tuhu.cn/vue/GroupBuy/pages/search/search?ruleId=" + PromotionModel.PKID;
                }
                #endregion
                return(DALPromotion.UpdateCouponRuleInfo(PromotionModel, shoptypes, shopids, categorys, brands, pids));

            default:
                throw new Exception($"action={action}没有对应的处理方法");
            }
        }