修改字段

This commit is contained in:
zpc 2024-07-16 14:58:49 +08:00
parent 5602837980
commit f3f1a1bc15
3 changed files with 9 additions and 9 deletions

View File

@ -85,15 +85,15 @@ namespace HuanMeng.MiaoYu.Code.Character
/// 首页-获取全部角色的Id
/// </summary>
/// <returns></returns>
public BaseResponse<List<CharacterId>> GetCharacters()
public BaseResponse<List<CharacterIdModel>> GetCharacters()
{
Random rng = new Random();
var charactersIds = MiaoYuCache.CharacterList.Select(it => new CharacterId { Id = it.Id }).OrderBy(x => rng.Next()).ToList();
var charactersIds = MiaoYuCache.CharacterList.Select(it => new CharacterIdModel { CharacterId = it.Id }).OrderBy(x => rng.Next()).ToList();
if (charactersIds == null)
{
charactersIds = new List<CharacterId>();
charactersIds = new List<CharacterIdModel>();
}
return new BaseResponse<List<CharacterId>>(ResonseCode.Success, "", charactersIds);
return new BaseResponse<List<CharacterIdModel>>(ResonseCode.Success, "", charactersIds);
}
}
}

View File

@ -9,12 +9,12 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
/// <summary>
/// 角色Id
/// </summary>
public class CharacterId
public class CharacterIdModel
{
/// <summary>
/// 角色Id
/// </summary>
public int Id { get; set; }
public int CharacterId { get; set; }
}
}

View File

@ -37,7 +37,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public BaseResponse<List<CharacterId>> GetCharacterIdList()
public BaseResponse<List<CharacterIdModel>> GetCharacterIdList()
{
CharacterBLL characterBLL = new CharacterBLL(ServiceProvider);
var obj = characterBLL.GetCharacters();
@ -58,7 +58,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
var obj = await characterBLL.GetCharacterInfo(requestCharacterInfo);
return obj;
//var obj = JsonConvert.DeserializeObject<List<CharacterInfoDto>>("[{\"Icon\":\"\",\"Intimacy\":10,\"CharacterId\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"Id\":1,\"Name\":\"美女\"},{\"Id\":2,\"Name\":\"二次元\"}],\"RemainingChatCount\":1}]");
//var obj = JsonConvert.DeserializeObject<List<CharacterInfoDto>>("[{\"Icon\":\"\",\"Intimacy\":10,\"CharacterIdModel\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"CharacterIdModel\":1,\"Name\":\"美女\"},{\"CharacterIdModel\":2,\"Name\":\"二次元\"}],\"RemainingChatCount\":1}]");
//return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", obj);
}