Merge branch 'dev' of 123.207.203.228:server/HuanMengProject into dev
This commit is contained in:
commit
ac181d208d
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Model.Dto.Home
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户和人物信息
|
||||
/// </summary>
|
||||
public class CharacterInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 亲密值
|
||||
/// </summary>
|
||||
public int Intimacy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物id
|
||||
/// </summary>
|
||||
public int CharacterId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物名称
|
||||
/// </summary>
|
||||
public string CharacterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public int Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有多少人看过
|
||||
/// </summary>
|
||||
public int LookCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 背景图片
|
||||
/// </summary>
|
||||
public string BgUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 简介
|
||||
/// </summary>
|
||||
public string Biography { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开场白
|
||||
/// </summary>
|
||||
public string Prologue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签
|
||||
/// </summary>
|
||||
public List<LabelDto> Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 余下聊天次数
|
||||
/// </summary>
|
||||
public int RemainingChatCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人物角色标签
|
||||
/// </summary>
|
||||
public class LabelDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天列表信息
|
||||
/// </summary>
|
||||
public class ChatMessageDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Role { get; set; }
|
||||
public string Content { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
public int MessageType { get; set; }
|
||||
public string UserIcon { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天列表
|
||||
/// </summary>
|
||||
public class ChatListDto
|
||||
{
|
||||
public List<ChatMessageDto> ChatList { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
using HuanMeng.DotNetCore.Base;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Home;
|
||||
using HuanMeng.MiaoYu.WebApi.Base;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ChatController : MiaoYuControllerBase
|
||||
{
|
||||
|
||||
public ChatController(IServiceProvider _serviceProvider) : base(_serviceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人物信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<CharacterInfoDto>> GetCharacterInfo(int userId)
|
||||
{
|
||||
var obj = JsonConvert.DeserializeObject<CharacterInfoDto>("{\"Icon\":\"\",\"Intimacy\":10,\"CharacterId\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"Id\":1,\"Name\":\"美女\"},{\"Id\":2,\"Name\":\"二次元\"}],\"RemainingChatCount\":1}");
|
||||
|
||||
return new BaseResponse<CharacterInfoDto>(ResonseCode.Success, "", obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取聊天列表信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<ChatListDto>> GetChatInfo(int userId)
|
||||
{
|
||||
var obj = JsonConvert.DeserializeObject<ChatListDto>("{\"ChatList\":[{\"Id\":\"1\",\"Role\":\"user\",\"Content\":\"Hello, how are you?\",\"Timestamp\":\"2022-03-01 12:00:00 \",\"MessageType\":0,\"UserIcon\":\"\"},{\"Id\":\"2\",\"Role\":\"assistant\",\"Content\":\"I'm fine, thanks!\",\"Timestamp\":\"2022-03-01 12:05:00 \",\"UserIcon\":\"\"}]}");
|
||||
return new BaseResponse<ChatListDto>(ResonseCode.Success, "", obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user