diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs index b1c7f0b7..b50bdea7 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs @@ -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(); diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs index c5a9e7a9..c801a075 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs @@ -29,7 +29,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers _cacheClientDB = cacheClientDB; } - + /// /// 查 @@ -38,8 +38,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers [HttpGet] public Result GetSetting() { - var setDto = Common.Helper.JsonHelper.ParseFormByJson(_cacheClientDB.Get(RedisConst.key)); - return Result.Success().SetData(setDto); + var setDto = Common.Helper.JsonHelper.StrToObj(_cacheClientDB.Get(RedisConst.key)); + return Result.Success().SetData( setDto); } /// @@ -48,14 +48,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// [HttpPut] - public Result UpdateSetting(SettingDto settingDto) + public Result UpdateSetting(SettingDto settingDto) { - var setDto = Common.Helper.JsonHelper.GetJSON(settingDto); + var setDto = Common.Helper.JsonHelper.ObjToStr(settingDto); - _cacheClientDB.Set(RedisConst.key, setDto); + _cacheClientDB.Set(RedisConst.key, setDto); return Result.Success(); } } - -} \ No newline at end of file +} diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs index 97d9f5c5..af3cb98d 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs @@ -101,7 +101,7 @@ namespace Yi.Framework.ApiMicroservice #region //ץȡע #endregion - //app.UseErrorHandlingService(); + app.UseErrorHandlingService(); #region //̬ļע diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json index ee2132c0..e08f7152 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json @@ -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" ], diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg new file mode 100644 index 00000000..0e7512ee Binary files /dev/null and b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg differ diff --git a/Yi.Framework/Yi.Framework.Common/Helper/JsonHelper.cs b/Yi.Framework/Yi.Framework.Common/Helper/JsonHelper.cs index 0bea6671..9b983cbe 100644 --- a/Yi.Framework/Yi.Framework.Common/Helper/JsonHelper.cs +++ b/Yi.Framework/Yi.Framework.Common/Helper/JsonHelper.cs @@ -6,6 +6,17 @@ namespace Yi.Framework.Common.Helper { public class JsonHelper { + + + public static string ObjToStr(T obj) + { + return Newtonsoft.Json.JsonConvert.SerializeObject(obj); + } + + public static T StrToObj(string str) + { + return Newtonsoft.Json.JsonConvert.DeserializeObject(str); + } /// /// 转换对象为JSON格式数据 /// diff --git a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs index 385b8a9e..a091428f 100644 --- a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs +++ b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs @@ -13,11 +13,11 @@ namespace Yi.Framework.WebCore.Init { public static void Seed(CacheClientDB _cacheClientDB) { - var setDto = Common.Helper.JsonHelper.GetJSON(new SettingDto() + var setDto = Common.Helper.JsonHelper.ObjToStr(new SettingDto() { - ImageList_key = { "默认图片", "默认图片" }, - InitRole_key = "默认角色", - Title_key = "默认标题", + ImageList_key =new List { "默认图片", "默认图片" }, + InitRole_key = "普通用户", + Title_key = "YiFramework", InitIcon_key = "默认头像" }); if (_cacheClientDB.Get(RedisConst.key)==null)