static AliyunOssService() { AccessKeyId = CommonSetService.GetString("Aliyun.Oss.AccessKeyId"); AccessKeySecret = CommonSetService.GetString("Aliyun.Oss.AccessKeySecret"); Endpoint = CommonSetService.GetString("Aliyun.Oss.EndPoint"); BucketName = CommonSetService.GetString("Aliyun.Oss.BucketName"); }
/// <summary> /// 获取上传设置 /// </summary> /// <param name="resType">上传类型,为null则获取全局设置</param> /// <returns> /// 与类型对应的上传设置 /// </returns> public static UploadSettings GetSettings(string resType = null) { var exts = string.IsNullOrEmpty(resType) ? CommonSetService.GetString("Upload.Global.Exts") : CommonSetService.GetString($"Upload.{resType}.Exts") .SetWhenNullOrEmpty(CommonSetService.GetString("Upload.Global.Exts")); var maxLen = string.IsNullOrEmpty(resType) ? CommonSetService.GetString("Upload.Global.MaxLength") : CommonSetService.GetString($"Upload.{resType}.MaxLength") .SetWhenNullOrEmpty(CommonSetService.GetString("Upload.Global.MaxLength")); return(new UploadSettings { AllowExts = exts, MaxLength = maxLen.TryToLong().GetValueOrDefault(0) }); }
static AlidayuService() { ProductName = CommonSetService.GetString("Plat.Product.Name"); AccessKeyId = CommonSetService.GetString("Alidayu.AccessKeyId"); AccessKeySecret = CommonSetService.GetString("Alidayu.AccessKeySecret"); Endpoint = CommonSetService.GetString("Alidayu.EndPoint"); var keys = new[] { "Alidayu.Sign.Activity", "Alidayu.Sign.Auth", "Alidayu.Sign.LoginExcept", "Alidayu.Sign.LoginNormal", "Alidayu.Sign.Modify", "Alidayu.Sign.Register", "Alidayu.Sign.ResetPass", "Alidayu.Tpl.Activity", "Alidayu.Tpl.Auth", "Alidayu.Tpl.LoginExcept", "Alidayu.Tpl.LoginNormal", "Alidayu.Tpl.Modify", "Alidayu.Tpl.Register", "Alidayu.Tpl.ResetPass" }; foreach (var key in keys) { var value = CommonSetService.GetString(key); if (string.IsNullOrEmpty(value)) { Logger.Error($"没有配置数据:{key}"); } Dict.Add(key, value); } }
static ApiAuthService() { BeaSecret = CommonSetService.GetString("Plat.Auth.Bea.Secret"); }