Пример #1
0
        public bool UpdateGlobalConfig(BargainGlobalConfigModel request)
        {
            var oldGlobal = new BargainGlobalConfigModel();

            try
            {
                oldGlobal = ShareBargainManager.FetchBargainProductGlobalConfig();
            }
            catch (Exception ex)
            {
                Logger.Log(Level.Error, $"全局配置修改前获取数据失败ex:{ex}");
            }

            request.QAData = JsonConvert.SerializeObject(request.BargainRule);
            var result = ShareBargainManager.UpdateGlobalConfig(request);

            if (result)
            {
                using (var client = new ShareBargainClient())
                {
                    var refreshResult = client.RefreshShareBargainCache();
                    if (!refreshResult.Success)
                    {
                        Logger.Log(Level.Warning, $"UpdateGlobalConfig,刷新缓存失败,ErrorMessage:{refreshResult.ErrorMessage}");
                    }
                }

                //操作日志
                UpdateGlobalConfiguctLog(oldGlobal, request);
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 修改全局配置记录操作日志
        /// </summary>
        /// <param name="oldModel"></param>
        /// <param name="newModel"></param>
        private void UpdateGlobalConfiguctLog(BargainGlobalConfigModel oldModel, BargainGlobalConfigModel newModel)
        {
            try
            {
                oldModel = oldModel == null ? new BargainGlobalConfigModel() : oldModel;
                var operationLogModel = new SalePromotionActivityLogModel()
                {
                    ReferId          = "ShareBargin_GlobalConfig",
                    ReferType        = "ShareBargin",
                    OperationLogType = "ShareBargin_UpdateGlobalConfig",
                    CreateDateTime   = DateTime.Now.ToString(),
                    CreateUserName   = this.User.Identity.Name,
                    LogDetailList    = new List <SalePromotionActivityLogDetail>()
                };
                if (oldModel.QAData != newModel.QAData)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "问答组",
                        OldValue = GetQALogString(oldModel.BargainRule),
                        NewValue = GetQALogString(newModel.BargainRule)
                    });
                }
                if (oldModel.RulesCount != newModel.RulesCount)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "活动规则数量",
                        OldValue = oldModel.RulesCount.ToString(),
                        NewValue = newModel.RulesCount.ToString()
                    });
                }
                if (oldModel.SliceShowText != newModel.SliceShowText)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "砍价成功轮播文案",
                        OldValue = oldModel.SliceShowText,
                        NewValue = newModel.SliceShowText,
                    });
                }
                if (oldModel.WXAPPListShareText != newModel.WXAPPListShareText)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "小程序列表分享文案",
                        OldValue = oldModel.WXAPPListShareText,
                        NewValue = newModel.WXAPPListShareText,
                    });
                }
                if (oldModel.WXAPPListShareImg != newModel.WXAPPListShareImg)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "小程序列表分享图片",
                        OldValue = oldModel.WXAPPListShareImg,
                        NewValue = newModel.WXAPPListShareImg,
                    });
                }
                if (oldModel.APPListShareTag != newModel.APPListShareTag)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "APP列表页分享标签",
                        OldValue = oldModel.APPListShareTag,
                        NewValue = newModel.APPListShareTag,
                    });
                }
                if (oldModel.WXAPPDetailShareText != newModel.WXAPPDetailShareText)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "小程序详情分享文案",
                        OldValue = oldModel.WXAPPDetailShareText,
                        NewValue = newModel.WXAPPDetailShareText
                    });
                }
                if (oldModel.AppDetailShareTag != newModel.AppDetailShareTag)
                {
                    operationLogModel.LogDetailList.Add(new SalePromotionActivityLogDetail()
                    {
                        Property = "APP详情分享标签",
                        OldValue = oldModel.AppDetailShareTag,
                        NewValue = newModel.AppDetailShareTag
                    });
                }

                SetOperationLog(operationLogModel, "UpdateGlobalConfiguctLog");
            }
            catch (Exception ex)
            {
                Logger.Log(Level.Warning, $"UpdateGlobalConfiguctLog操作日志异常:{ex}");
            }
        }