123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- using Dapper;
- using JiaZhiQuan.Common.ClassEnum;
- using MathNet.Numerics.Statistics.Mcmc;
- using Microsoft.Extensions.Logging;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Wicture.DbRESTFul.Infrastructure.Repository;
- namespace JiaZhiQuan.Common.Config
- {
- public class ConfigFromDb
- {
- private readonly IConnectionManager _connectionManager;
- private readonly ILogger _logger;
- /// <summary>
- /// 主分类
- /// </summary>
- public static List<KeyValuePair<int, string>> PrimaryTypes { get; set; } = new List<KeyValuePair<int, string>>();
- /// <summary>
- /// 在App展示的主分类
- /// </summary>
- public static List<KeyValuePair<int, string>> PrimaryTypesVisibleInApp { get; set; } = new List<KeyValuePair<int, string>>();
- /// <summary>
- /// 在App展示的主分类(仅用于审核)
- /// </summary>
- public static List<KeyValuePair<int, string>> PrimaryTypesVisibleInAppPreview { get; set; } = new List<KeyValuePair<int, string>>();
- /// <summary>
- /// APP 版本Preview配置,配置之后,接口会返回用于审核的测试数据。数据格式为“channel,os_version”
- /// </summary>
- public static List<string> AppPreviewTypeList { get; set; } = new List<string>();
- /// <summary>
- /// 资源所属的市场
- /// </summary>
- public static List<KeyValuePair<int, string>> ResourceMarkets { get; set; } = new List<KeyValuePair<int, string>>()
- {
- new KeyValuePair<int, string>(1, "A股"),
- new KeyValuePair<int, string>(2, "港股"),
- new KeyValuePair<int, string>(4, "美股")
- };
- /// <summary>
- /// 社区
- /// </summary>
- public static List<AppIndexCusTabItem> AppIndexCusTabList = new List<AppIndexCusTabItem>();
- /// <summary>
- /// 商城
- /// </summary>
- public static List<AppIndexCusTabItem> MallAppIndexCusTabList = new List<AppIndexCusTabItem>();
- /// <summary>
- /// 不同天数的随机概率,2~15天
- /// </summary>
- public static List<List<int>> RandomProbabilities = new List<List<int>>
- {
- new List<int>{67, 33 },
- new List<int>{50, 33, 17 },
- new List<int>{40, 30, 20, 10 },
- new List<int>{35, 26, 20, 13, 6 },
- new List<int>{31, 23, 19, 14, 9, 4 },
- new List<int>{28, 21, 17, 14, 10, 7, 3 },
- new List<int>{26, 19, 16, 13, 11, 8, 5, 2 },
- new List<int>{24, 17, 15, 13, 11, 8, 6, 4, 2 },
- new List<int>{23, 16, 14, 12, 10, 9, 7, 5, 3, 1 },
- new List<int>{20, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1 },
- new List<int>{21, 14, 12, 11, 10, 8, 7, 6, 5, 3, 2, 1 },
- new List<int>{20, 13, 12, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
- new List<int>{21, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1 },
- new List<int>{18, 11, 10, 10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1 },
- };
- public ConfigFromDb(IConnectionManager manager, ILoggerFactory loggerFactory)
- {
- _connectionManager = manager;
- _logger = loggerFactory.CreateLogger("DbRESTFul");
- try
- {
- Resolve();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "ConfigFromDb 读取失败");
- }
- }
- public ConfigFromDb Resolve()
- {
- using (var conn = _connectionManager.GetConnection())
- {
- conn.Open();
- InitModel(SqlMapper.Query(conn, "select * from s_config"));
- // 初始化主分类
- var types = SqlMapper.Query(conn, "select id, name, hiddenInApp, previewable from s_types_main where state<>-1 order by displayOrder desc");
- PrimaryTypes = types.Select(e => new KeyValuePair<int, string>(e.id, e.name)).ToList();
- PrimaryTypesVisibleInApp = types.Where(e => e.hiddenInApp == 0).Select(e => new KeyValuePair<int, string>(e.id, e.name)).ToList();
- PrimaryTypesVisibleInAppPreview = types.Where(e => e.hiddenInApp == 0 && e.previewable > 0).Select(e => new KeyValuePair<int, string>(e.id, e.name)).ToList();
- AppPreviewTypeList = SqlMapper.Query(conn, "select channel, version from s_app_preview").Select(e => (e.channel + "," + e.version) as string).ToList();
- var custab= SqlMapper.Query<AppIndexCusTabItem>(conn,
- "select category,type, label, activeImg, deactiveImg, data from n_app_index_custab where state=0")
- .ToList();
- //社区
- AppIndexCusTabList = custab.Where(x => x.category == AppIndexTabEnum.COMMUNITY.category).ToList();
- //商品
- MallAppIndexCusTabList = custab.Where(x => x.category == AppIndexTabEnum.MALL.category).ToList();
- }
- return this;
- }
- public string SMSignName { get; set; }
- public string SMRsetMobileTemplateCode { get; set; }
- public string SMNormalValidationTemplateCode { get; set; }
- public string SMLoginTemplateCode { get; set; }
- public string WXGZAppID { get; set; }
- public string WXGZAppSecret { get; set; }
- public string WXAppID { get; set; }
- public string WXAppSecret { get; set; }
- public string QQAppID { get; set; }
- public string QQAppKey { get; set; }
- public string WeiboAppID { get; set; }
- public string WeiboAppSecret { get; set; }
- public string AliVisionAccessKeyId { get; set; }
- public string AliVisionAccessSecret { get; set; }
- public string AliOssAccessKeyId { get; set; }
- public string AliOssAccessSecret { get; set; }
- public string AliSMAccessKeyId { get; set; }
- public string AliSMAccessSecret { get; set; }
- public string AliDytnsAccessKeyId { get; set; }
- public string AliDytnsAccessSecret { get; set; }
- public string AliVodAccessKeyId { get; set; }
- public string AliVodAccessSecret { get; set; }
- public string AliVodCallbackUrl { get; set; }
- public string AliVodCallbackKey { get; set; }
- public string AliFaceVerifyAccessKeyId { get; set; }
- public string AliFaceVerifyAccessSecret { get; set; }
- public string AliPhoneNumberAuthCode { get; set; }
- public string AliPhoneNumberAccessKeyId { get; set; }
- public string AliPhoneNumberAccessSecret { get; set; }
- public string AliCaptchaAccessKeyId { get; set; }
- public string AliCaptchaAccessKeySecret { get; set; }
- public int PostPublishFirst { get; set; }
- public string UmengAppKeyAndroid { get; set; }
- public string UmengAppMasterSecretAndroid { get; set; }
- public string UmengAppKeyIOS { get; set; }
- public string UmengAppMasterSecretIOS { get; set; }
- public string SystemAdministratorPassword { get; set; }
- public string PointsName { get; set; }
- /// <summary>
- /// 用户签到赠送价值币数量列表,里面包含的即为一个周期
- /// </summary>
- public string UserSignInPointsCountList { get; set; }
- /// <summary>
- /// 用户发送请求时,参数MD5加密时的混淆串
- /// </summary>
- public string UserRequestParameterMD5Salt { get; set; }
- /// <summary>
- /// 用户默认头像地址,逗号分隔,路径为 olscdn.olssglobal.com/common/images/member/hdi/xxxxxx
- /// </summary>
- public string DefaultUserHeadImages { get; set; }
- /// <summary>
- /// 用户个人中心默认背景地址,逗号分隔,路径为 olscdn.olssglobal.com/common/images/member/hdi/xxxxxx
- /// </summary>
- public string DefaultUserHeadBackgroundImages { get; set; }
- /// <summary>
- /// Apple第三方登录私钥
- /// </summary>
- public string AppleSignInPrivateKey { get; set; }
- public string AppleTeamID { get; set; }
- public string AppleBundleID { get; set; }
- /// <summary>
- /// 短链地址
- /// </summary>
- public string ShorLinkPrefix { get; set; }
- /// <summary>
- /// H5 URL地址,无Http和/。如m.olssglobal.com
- /// </summary>
- public string H5UrlAddress { get; set; }
- /// <summary>
- /// 邀请好友注册短信模板
- /// </summary>
- public string ShareShortMessageTemplate { get; set; }
- /// <summary>
- /// 用户发动态任务获取的金币
- /// </summary>
- public int UserPointsPublishPost { get; set; }
- /// <summary>
- /// 发动态任务能够获取金币一天最多发放的数量
- /// </summary>
- public int UserPointsPublishPostMaxCount { get; set; }
- /// <summary>
- /// 用户评论任务获取的金币
- /// </summary>
- public int UserPointsComment { get; set; }
- /// <summary>
- /// 评论任务能够获取金币一天最多发放的数量
- /// </summary>
- public int UserPointsCommentMaxCount { get; set; }
- /// <summary>
- /// 用户点赞任务获取的金币
- /// </summary>
- public int UserPointsThumbsup { get; set; }
- /// <summary>
- /// 点赞任务能够获取金币需要达到的数量
- /// </summary>
- public int UserPointsThumbsupCount { get; set; }
- /// <summary>
- /// 用户分享任务获取的金币
- /// </summary>
- public int UserPointsShare { get; set; }
- /// <summary>
- /// 分享任务能够获取金币需要达到的数量
- /// </summary>
- public int UserPointsShareCount { get; set; }
- /// <summary>
- /// 用户被评论任务获取的金币
- /// </summary>
- public int UserPointsPassiveComment { get; set; }
- /// <summary>
- /// 被评论任务能够获取金币需要达到的数量
- /// </summary>
- public int UserPointsPassiveCommentCount { get; set; }
- /// <summary>
- /// 用户被点赞任务获取的金币
- /// </summary>
- public int UserPointsPassiveThumbsup { get; set; }
- /// <summary>
- /// 被点赞任务能够获取金币需要达到的数量
- /// </summary>
- public int UserPointsPassiveThumbsupCount { get; set; }
- /// <summary>
- /// 用户被分享任务获取的金币
- /// </summary>
- public int UserPointsPassiveShare { get; set; }
- /// <summary>
- /// 被分享任务能够获取金币需要达到的数量
- /// </summary>
- public int UserPointsPassiveShareCount { get; set; }
- /// <summary>
- /// 用户评级时,动态质量最小要达到的值,1-5
- /// </summary>
- public int UserLevelPostMinQuality { get; set; }
- /// <summary>
- /// 客服电话
- /// </summary>
- public string ConfigCSPhone { get; set; }
- /// <summary>
- /// 客服邮箱
- /// </summary>
- public string ConfigCSEmail { get; set; }
- /// <summary>
- /// QQ邮件发送邮件账户
- /// </summary>
- public string MailAccount { get; set; }
- /// <summary>
- /// QQ邮件发送邮件的授权码
- /// </summary>
- public string MailAuthCode { get; set; }
- /// <summary>
- /// 模拟文章用户列表
- /// </summary>
- public string MockPostUser { get; set; }
- /// <summary>
- /// 模拟评论用户列表
- /// </summary>
- public string MockCommentUser { get; set; }
- /// <summary>
- /// 是否禁用模拟评论文本AI审核,默认未禁用
- /// </summary>
- public int MockCommentDisableTextAiAuth { get; set; }
- /// <summary>
- /// 是否关闭文章自动点赞
- /// </summary>
- public int MockPostAutoThumbsupDisabled { get; set; }
- /// <summary>
- /// 是否关闭用户的自动关注
- /// </summary>
- public int MockUserAutoFocusDisabled { get; set; }
- /// <summary>
- /// 文章是否启用文本AI审核,大于0表示true, 等于0表示false
- /// </summary>
- public int EnablePostTextAiAuth { get; set; }
- /// <summary>
- /// 文章阅读统计同一用户每天最大有效阅读数量(有效阅读)
- /// </summary>
- public int PostReadStatisticMaxCountPerDayPerUser { get; set; }
- /// <summary>
- /// 文章阅读最小有效秒数
- /// </summary>
- public int PostReadStatisticMinSecs { get; set; }
- /// <summary>
- /// 文章阅读统计同一IP针对同一笔记(未登录),最多可统计的有效次数(有效阅读)
- /// </summary>
- public int PostReadStatisticMaxCountPerDayPerIP { get; set; }
- /// <summary>
- /// 文章阅读统计同一IP针对同一笔记(未登录),最多可统计的有效次数(非有效阅读)
- /// </summary>
- public int PostReadStatisticMaxCountPerDayPerIP_Normal { get; set; }
- /// <summary>
- /// 文章分享统计同一用户每天最大有效分享数量(有效分享)
- /// </summary>
- public int PostShareStatisticMaxCountPerDayPerUser { get; set; }
- /// <summary>
- /// 文章分享统计同一用户每天最大有效分享数量(非有效分享)
- /// </summary>
- public int PostShareStatisticMaxCountPerDayPerUser_Normal { get; set; }
- /// <summary>
- /// 同一用户同一文章最大有效分享数量(有效分享)
- /// </summary>
- public int PostShareStatisticMaxCountPerDayPerUserPerPost { get; set; }
- /// <summary>
- /// 同一用户同一文章最大有效分享数量(非有效分享)
- /// </summary>
- public int PostShareStatisticMaxCountPerDayPerUserPerPost_Normal { get; set; }
- /// <summary>
- /// 每天同一用户同一作者主页访问次数(非有效次数)
- /// </summary>
- public int PersonalPageVisitMaxCountPerDayPerUser2User_Normal { get; set; }
- /// <summary>
- /// 研报百次有效阅读单价(分为单位)
- /// </summary>
- public int PostStandpointSettlementPrice { get; set; }
- /// <summary>
- /// 价格变动提醒
- /// </summary>
- public string PostStandpointPriceChangeTip { get; set; }
- /// <summary>
- /// 视频笔记百次有效阅读单价(分为单位)
- /// </summary>
- public int PostDiaryHasVideoSettlementPrice { get; set; }
- /// <summary>
- /// 图文笔记百次有效阅读单价(分为单位)
- /// </summary>
- public int PostDiaryNoVideoSettlementPrice { get; set; }
- /// <summary>
- /// 价格变动提醒
- /// </summary>
- public string PostDiaryPriceChangeTip { get; set; }
- /// <summary>
- /// 创作者平台统计预警发送邮箱,多个用逗号分隔
- /// </summary>
- public string MPPostStatWarningMailTo { get; set; }
- /// <summary>
- /// 创作者平台统计预警配置,如{ diary: { read: { hours: 1, max: 5 }, thumbsup: { hours: 1, max: 5 }, share: { hours: 1, max: 5 }, totalRead: { hours: 1, max: 5 } }, standpoint: { ... } }
- /// </summary>
- public MPStatisticWarningConfig MPStatisticWarningConfig { get; set; }
- /// <summary>
- /// 文章最大推荐的天数,超过后,热度置0
- /// </summary>
- public int PostMaxRecommendDays { get; set; }
- /// <summary>
- /// 如果配置了此日期值,文章推荐则优先使用此值,而非PostMaxRecommendDays
- /// </summary>
- public string PostStartRecommendDate { get; set; }
- /// <summary>
- /// 文章距离当前时间多少小时内忽略热度值
- /// </summary>
- public int PostIgnoreHotRecentHours { get; set; }
- /// <summary>
- /// 文章冷却小时数,即在文章发布多久内计算冷却系数
- /// </summary>
- public int PostCoolingPeriodHours { get; set; }
- /// <summary>
- /// 文章在冷却周期内,小于等于此值时,冷却系数为1
- /// </summary>
- public int PostIgnoreCoolingMaxCountPerPeriod { get; set; }
- /// <summary>
- /// 用户主页默认背景图片地址
- /// </summary>
- public string UserPersonalPageBGImage { get; set; }
- /// <summary>
- /// 提现最小金额(含),单位为分
- /// </summary>
- public int CashoutMinAmount { get; set; }
- /// <summary>
- /// 提现最大金额(含),单位为分
- /// </summary>
- public int CashoutMaxAmount { get; set; }
- /// <summary>
- /// 提现每个自然月提现最大次数(含)
- /// </summary>
- public int CashoutMaxTimesPerMonth { get; set; }
- /// <summary>
- /// 用户邀请海报版本
- /// </summary>
- public int LastestInvitationPosterVersion { get; set; }
- /// <summary>
- /// 用户邀请海报生成参数
- /// </summary>
- public InvitationPosterParams InvitationPosterParams { get; set; }
- /// <summary>
- /// 邀请激活报警参数
- /// </summary>
- public InvitationAlarm InvitationAlarm { get; set; }
- /// <summary>
- /// 活动任务奖励兑换过期天数
- /// </summary>
- public int ActivityRewardExchangeExpireDays { get; set; }
- /// <summary>
- /// 价值币图标URL
- /// </summary>
- public string PointsIconUrl { get; set; }
- /// <summary>
- /// 平台微信客服二维码URL
- /// </summary>
- public string WXCSQRCodeUrl { get; set; }
- /// <summary>
- /// App社区Tab顺序及默认显示配置, 如:FOCUS,RECOMMEND,IMGPOST,VIDEOPOST|RECOMMEND
- /// </summary>
- public string AppIndexPageTabConfig { get; set; }
- /// <summary>
- /// App商城Tab顺序及默认显示配置, 如:FOCUS,RECOMMEND,IMGPOST,VIDEOPOST|RECOMMEND
- /// </summary>
- public string MallAppIndexPageTabConfig { get; set; } = "FOCUS,RECOMMEND,VIDEOPOST|RECOMMEND";
- /// <summary>
- /// App活动板块的火图标是否显示
- /// </summary>
- public int ActivityHotIconInAppVisible { get; set; }
- /// <summary>
- /// 内容推荐中每页包含的研报数量
- /// </summary>
- public int StandPointCountPerPageInRecommendation { get; set; }
- /// <summary>
- /// App中置顶资讯编号
- /// </summary>
- public long AppTopNewsId { get; set; }
- /// <summary>
- /// App中热门讨论出现的位置
- /// </summary>
- public int AppHotDiscussPosition { get; set; }
- /// <summary>
- /// App中推荐列表热门活动出现的位置,如果配置为-1表示不显示
- /// </summary>
- public int AppHotActivityPosition { get; set; }
- /// <summary>
- /// App活跃Tick接口调用间隔(秒)
- /// </summary>
- public int AppAliveTickInterval { get; set; } = 5;
- /// <summary>
- /// App同步行为数据时间间隔(秒)
- /// </summary>
- public int AppSyncActionDataInterval { get; set; } = 30;
- /// <summary>
- /// App一次同步行为数据量最大值
- /// </summary>
- public int AppSyncActionDataMaxSize { get; set; } = 100;
- /// <summary>
- /// VIVO商业开放平台AccessToken
- /// </summary>
- public string AdVivoAccessToken { get; set; }
- /// <summary>
- /// VIVO商业开放平台AccessToken过期时间
- /// </summary>
- public DateTime? AdVivoAccessTokenExpireAt { get; set; }
- /// <summary>
- /// VIVO商业开放平台refreshToken
- /// </summary>
- public string AdVivoRefreshToken { get; set; }
- /// <summary>
- /// 模拟评论时间随机因子1
- /// </summary>
- public int MockCommentRandomTimeFactor01 { get; set; } = 45;
- /// <summary>
- /// 模拟评论时间随机因子2
- /// </summary>
- public int MockCommentRandomTimeFactor02 { get; set; } = 120;
- /// <summary>
- /// 是否显示活动历史的按钮, 0 显示, 1 不显示
- /// </summary>
- public int AppActivityHistoryRecordsBtnVisible { get; set; }
- /// <summary>
- /// 商务邮箱
- /// </summary>
- public string CompanyEmail { get; set; }
- /// <summary>
- /// 无效评论关键词配置,正则表达式
- /// </summary>
- public string InvalidCommentReg { get; set; }
- /// <summary>
- /// Api中Sign检查是否禁用
- /// </summary>
- public int ApiSignCheckingDisabled { get; set; }
- /// <summary>
- /// Api中Sign每分钟最大验证错误次数,超过此次数,则禁止访问1个小时,如果配置0,则无最大错误次数
- /// </summary>
- public int ApiSignCheckingFailedMaxCountPerMin { get; set; }
- /// <summary>
- /// Api验签URL忽略正规
- /// </summary>
- public string ApiSignCheckingUrlIgnoreReg { get; set; }
- /// <summary>
- /// Api验签密钥
- /// </summary>
- public string ApiSignKey { get; set; }
- /// <summary>
- /// api加密白名单ip
- /// </summary>
- public string EncryptWhiteIPList { get; set; }
- /// <summary>
- /// 第元人民币相当于多少价值币
- /// </summary>
- public int PointsCountPerYuan { get; set; } = 500;
- /// <summary>
- /// 支付超时时间(分钟)
- /// </summary>
- public int PaymentTimeoutMinutes { get; set; } = 10;
- /// <summary>
- /// 卖家发货超时时间(小时)
- /// </summary>
- public int MallDeliveryTimeoutHours { get; set; } = 72;
- /// <summary>
- /// 买卖双方订单评论超时时间(小时)
- /// </summary>
- public int MallOrderRatingTimeoutHours { get; set; } = 15 * 24;
- /// <summary>
- /// 买家确认收货超时间(小时)
- /// </summary>
- public int MallReceiptTimeoutHours { get; set; } = 24 * 10;
- /// <summary>
- /// 买家操作延长确认收货时间的天数
- /// </summary>
- public int MallOrderConfirmReceiptExtendDays { get; set; } = 3;
- /// <summary>
- /// 快递鸟用户id
- /// </summary>
- public string KDNiaoEBusinessID { get; set; }
- /// <summary>
- /// 快递鸟用户apikey
- /// </summary>
- public string KDNiaoApiKey { get; set; }
- /// <summary>
- /// 于初科技代理商id
- /// </summary>
- public string YCTechAgentId { get; set; }
- /// <summary>
- /// 于初科技代理商key
- /// </summary>
- public string YCTechSignKey { get; set; }
- /// <summary>
- /// 于初科技接口host
- /// </summary>
- public string YCTechHost { get; set; }
- /// <summary>
- /// 于初科技订单结果回调接口url
- /// </summary>
- public string YCTechOrderCallBackUrl { get; set; }
- /// <summary>
- /// 于初科技平台id
- /// </summary>
- public int YCTechSupplierId { get; set; }
- /// <summary>
- /// 商品免责声明
- /// </summary>
- public string MallGoodsDisclaimer { get; set; }
- public double UEActivityDisplayOrder { get; set; }
- /// <summary>
- /// 卖家超过多少天未上架,超时上架天数
- /// </summary>
- public int UEShelveTimeout { get; set; }
- /// <summary>
- /// 平台退货,卖家自动确认收货超时时间
- /// </summary>
- public int UESellerReceiveTimeout { get; set; }
- public PlatformShopConfig PlatformShopConfig { get; set; }
- public HuiFuCommonConfig HuiFuConfig { get; set; }
- public string HuiFuJspayCallbackUrl { get; set; }
- public string HuiFuChashCallbackUrl { get; set; }
- public string HuiFuOpenCallbackUrl { get; set; }
- public string HuiFuRefundCallbackUrl { get; set; }
- public string HuiFuYuEPayCallbackUrl { get; set; }
- public string RongYunIMAppKey { get; set; }
- public string RongYunIMAppSecret { get; set; }
-
- /// <summary>
- /// 融云IM分配的客服编号列表,逗号分隔
- /// </summary>
- public string RongCloudIMCSIdList { get; set; }
-
- /// <summary>
- /// config 为从数据库查询出来的数据集合
- /// </summary>
- /// <param name="configs"></param>
- public void InitModel(dynamic configs)
- {
- var props = GetType().GetProperties();
- foreach (var config in configs)
- {
- if (string.IsNullOrEmpty(config.value)) continue;
- var prop = props.FirstOrDefault(e => e.Name.Equals(config.key));
- if (prop != null)
- {
- if (prop.PropertyType == typeof(int))
- {
- prop.SetValue(this, int.Parse(config.value));
- }
- if (prop.PropertyType == typeof(long))
- {
- prop.SetValue(this, long.Parse(config.value));
- }
- else if (prop.PropertyType == typeof(string))
- {
- prop.SetValue(this, config.value);
- }
- else if (prop.PropertyType == typeof(float))
- {
- prop.SetValue(this, float.Parse(config.value));
- }
- else if (prop.PropertyType == typeof(double))
- {
- prop.SetValue(this, double.Parse(config.value));
- }
- else if (prop.PropertyType == typeof(DateTime) || prop.PropertyType == typeof(DateTime?))
- {
- prop.SetValue(this, DateTime.Parse(config.value));
- }
- else if (typeof(IConfigFromDbJsonModel).IsAssignableFrom(prop.PropertyType))
- {
- var value = (string)config.value;
- if (!string.IsNullOrEmpty(value))
- {
- prop.SetValue(this, JsonConvert.DeserializeObject(value, prop.PropertyType));
- }
- }
- }
- }
- }
- }
- }
|