@@ -196,19 +196,34 @@ public async Task<string> GetConfigValueByCode(string code, string defaultValue
196
196
/// <summary>
197
197
/// 获取配置参数值
198
198
/// </summary>
199
+ /// <typeparam name="T">类型</typeparam>
199
200
/// <param name="code">编码</param>
200
201
/// <param name="defaultValue">默认值</param>
201
202
/// <returns></returns>
202
203
[ NonAction ]
203
204
public async Task < T > GetConfigValueByCode < T > ( string code , T defaultValue = default )
205
+ {
206
+ return await GetConfigValueByCode < T > ( code , _userManager . UserId , defaultValue ) ;
207
+ }
208
+
209
+ /// <summary>
210
+ /// 获取配置参数值
211
+ /// </summary>
212
+ /// <typeparam name="T">类型</typeparam>
213
+ /// <param name="code">编码</param>
214
+ /// <param name="userId">用户Id</param>
215
+ /// <param name="defaultValue">默认值</param>
216
+ /// <returns></returns>
217
+ [ NonAction ]
218
+ public async Task < T > GetConfigValueByCode < T > ( string code , long userId , T defaultValue = default )
204
219
{
205
220
if ( string . IsNullOrWhiteSpace ( code ) ) return defaultValue ;
206
221
207
- var value = _sysCacheService . Get < string > ( $ "{ CacheConst . KeyUserConfig } { _userManager . UserId } { code } ") ;
222
+ var value = _sysCacheService . Get < string > ( $ "{ CacheConst . KeyUserConfig } { userId } { code } ") ;
208
223
if ( string . IsNullOrEmpty ( value ) )
209
224
{
210
225
value = ( await VSysConfig . FirstAsync ( u => u . Code == code ) ) ? . Value ;
211
- _sysCacheService . Set ( $ "{ CacheConst . KeyUserConfig } { _userManager . UserId } { code } ", value ) ;
226
+ _sysCacheService . Set ( $ "{ CacheConst . KeyUserConfig } { userId } { code } ", value ) ;
212
227
}
213
228
if ( string . IsNullOrWhiteSpace ( value ) ) return defaultValue ;
214
229
return ( T ) Convert . ChangeType ( value , typeof ( T ) ) ;
0 commit comments