修改展示时间

development
温天培 2 years ago
parent 232e1abf59
commit 682b9f6c3a

@ -334,6 +334,11 @@
聊天详情
</summary>
</member>
<member name="F:GDZZ.Application.Enum.SystemConst.LIVE_UNREAD">
<summary>
聊天详情
</summary>
</member>
<member name="F:GDZZ.Application.Enum.SystemConst.MINI_USERINFO">
<summary>
小程序用户信息
@ -394,6 +399,14 @@
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Help.CacheService.SetUnreadAsync(System.Int64)">
<summary>
设置未读数
</summary>
<param name="UserID"></param>
<param name="ChatUserID"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Help.CacheService.DelMessage(System.Int64,System.Int64)">
<summary>
获取聊天列表
@ -1232,7 +1245,7 @@
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.UPLive(GDZZ.Application.UpdateLiveHistoryContactsInput)">
<summary>
修改消息条数
修改未读消息
</summary>
<returns></returns>
</member>

@ -112,6 +112,11 @@ namespace GDZZ.Application.Help
return _redisCache.Get<int>(cacheKey);
}
public async Task UpUnreadAsync(long UserID)
{
string cacheKey = SystemConst.LIVE_UNREAD + $"{UserID}";
await _redisCache.SetAsync(cacheKey, 0);
}
/// <summary>
/// 获取聊天列表

@ -21,6 +21,7 @@ namespace GDZZ.Application.Help
Task<int> GetUnreadAsync(long LiveID);
Task UpUnreadAsync(long UserID);
#endregion

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Help
{
public class Utils
{
public static bool ShowHelp(DateTime date)
{
bool isTheDay = false;
//判断日期是否是当天
DateTime time = DateTime.Now;//当天
DateTime time2 = new DateTime(time.Year, time.Month, time.Day);//当天的零时零分
DateTime time3 = time.AddDays(1);//后一天
DateTime time4 = new DateTime(time3.Year, time3.Month, time3.Day);//后一天的零时零分
if (date > time2 && date < time4)
{
isTheDay = true;
}
else
{
isTheDay = false;
}
return isTheDay;
}
}
}

@ -101,7 +101,7 @@ namespace GDZZ.Application
///最新消息时间格式
/// </summary>
public DateTime LastSendTimeData { get; set; }
public string LastSendTimeData { get; set; }
}

@ -78,17 +78,13 @@ namespace GDZZ.Application
/// <summary>
/// 修改消息条数
/// 修改未读消息
/// </summary>
/// <returns></returns>
[HttpPut("/Mini/LiveHistoryContacts/UPLive")]
public async Task UPLive(UpdateLiveHistoryContactsInput input)
{
var entity = input.Adapt<LiveHistoryContacts>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
await this.cacheService.DelLiveHistoryService(UserManager.UserId);
this.cacheService.UpUnreadAsync(input.Id);
}
@ -149,8 +145,18 @@ namespace GDZZ.Application
if (live != null)
{
var isNow = Utils.ShowHelp(live.SendTime);
if (isNow)
{
liveHis.LastSendTimeData = live.SendTime.ToString("HH:mm:ss");
}
else
{
liveHis.LastSendTimeData = live.SendTime.ToString("yyyy/MM/dd");
}
liveHis.LastSendTime = (live.SendTime.ToUniversalTime().Ticks - 621355968000000000) / 10000;
liveHis.LastSendTimeData = live.SendTime;
liveHis.LastContent = live.Content;
liveHis.Type = live.Type;
}
@ -203,8 +209,8 @@ namespace GDZZ.Application
id = UserManager.UserId
}
};
await this.cacheService.SetUnreadAsync(UserManager.UserId);
await this.cacheService.SetUnreadAsync(entity.OtherUserID);
//await this.cacheService.SetUnreadAsync(UserManager.UserId);
//await this.cacheService.SetUnreadAsync(entity.OtherUserID);
var livejson = livemes.ToJsonString();
await _chatHubContext.Clients.Client(user.ConnectionId).SendMessage(livejson, "SendMessage");

Loading…
Cancel
Save