This commit is contained in:
lzw
2021-11-03 21:14:58 +08:00
parent eb51c3c755
commit 6f79f870bb
7 changed files with 26 additions and 14 deletions

View File

@@ -50,6 +50,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
if ( user_data!=null)
{
var token = MakeJwt.app(new jwtUser() {user=user_data,menuIds= menuList});
JobModel.visitNum += 1;
return Result.Success().SetData(new { user = new { user_data.id, user_data.username, user_data.introduction, user_data.icon, user_data.nick }, token });
}
return Result.Error();

View File

@@ -29,7 +29,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
_cacheClientDB = cacheClientDB;
}
/// <summary>
/// 查
@@ -38,8 +38,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpGet]
public Result GetSetting()
{
var setDto = Common.Helper.JsonHelper.ParseFormByJson<SettingDto>(_cacheClientDB.Get<string>(RedisConst.key));
return Result.Success().SetData(setDto);
var setDto = Common.Helper.JsonHelper.StrToObj<SettingDto>(_cacheClientDB.Get<string>(RedisConst.key));
return Result.Success().SetData( setDto);
}
/// <summary>
@@ -48,14 +48,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="settingDto"></param>
/// <returns></returns>
[HttpPut]
public Result UpdateSetting(SettingDto settingDto)
public Result UpdateSetting(SettingDto settingDto)
{
var setDto = Common.Helper.JsonHelper.GetJSON<SettingDto>(settingDto);
var setDto = Common.Helper.JsonHelper.ObjToStr<SettingDto>(settingDto);
_cacheClientDB.Set(RedisConst.key, setDto);
_cacheClientDB.Set(RedisConst.key, setDto);
return Result.Success();
}
}
}
}

View File

@@ -101,7 +101,7 @@ namespace Yi.Framework.ApiMicroservice
#region
//<2F><><EFBFBD><EFBFBD>ץȡ<D7A5><C8A1><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
#endregion
//app.UseErrorHandlingService();
app.UseErrorHandlingService();
#region
//<2F><>̬<EFBFBD>ļ<EFBFBD>ע<EFBFBD><D7A2>

View File

@@ -15,7 +15,7 @@
"Cors_Enabled": true,
"RabbitMQ_Enabled": false,
"Redis_Enabled": true,
"RedisSeed_Enabled": false,
"RedisSeed_Enabled": true,
"Kafka_Enabled": false,
"MutiDB_Enabled": false,
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -6,6 +6,17 @@ namespace Yi.Framework.Common.Helper
{
public class JsonHelper
{
public static string ObjToStr<T>(T obj)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(obj);
}
public static T StrToObj<T>(string str)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str);
}
/// <summary>
/// 转换对象为JSON格式数据
/// </summary>

View File

@@ -13,11 +13,11 @@ namespace Yi.Framework.WebCore.Init
{
public static void Seed(CacheClientDB _cacheClientDB)
{
var setDto = Common.Helper.JsonHelper.GetJSON<SettingDto>(new SettingDto()
var setDto = Common.Helper.JsonHelper.ObjToStr(new SettingDto()
{
ImageList_key = { "默认图片", "默认图片" },
InitRole_key = "默认角色",
Title_key = "默认标题",
ImageList_key =new List<string> { "默认图片", "默认图片" },
InitRole_key = "普通用户",
Title_key = "YiFramework",
InitIcon_key = "默认头像"
});
if (_cacheClientDB.Get<SettingDto>(RedisConst.key)==null)