同步
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 |
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user