|
@@ -84,7 +84,7 @@ namespace GxPress.Repository.Implement
|
|
|
/// <returns></returns>
|
|
|
public async Task<int> InsertAsync(int userId, int groupId, GroupUserRoleTyeConst groupUserRoleId)
|
|
|
{
|
|
|
- GroupUser groupUser = new GroupUser { GroupId = groupId, UserId = userId, GroupUserRoleId = groupUserRoleId, IsUDisturb = false };
|
|
|
+ GroupUser groupUser = new GroupUser { GroupId = groupId, UserId = userId, GroupUserRoleId = groupUserRoleId, IsUDisturb = false, ReadDate = DateTime.Now };
|
|
|
return await _repository.InsertAsync(groupUser);
|
|
|
}
|
|
|
|
|
@@ -120,7 +120,7 @@ namespace GxPress.Repository.Implement
|
|
|
`GroupId`,
|
|
|
`UserId`,
|
|
|
`GroupUserRoleId`,
|
|
|
- `IsUDisturb`)
|
|
|
+ `IsUDisturb`,`ReadDate`)
|
|
|
VALUES";
|
|
|
if (groupUsers.Count == 0)
|
|
|
return false;
|
|
@@ -129,7 +129,7 @@ namespace GxPress.Repository.Implement
|
|
|
var guId = Guid.NewGuid().ToString();
|
|
|
var createdDate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
var IsUDisturb = item.IsUDisturb ? 1 : 0;
|
|
|
- sql += $@"('{guId}','{createdDate}','{createdDate}',{item.GroupId},{item.UserId},{item.GroupUserRoleId.GetHashCode()},{IsUDisturb}),";
|
|
|
+ sql += $@"('{guId}','{createdDate}','{createdDate}',{item.GroupId},{item.UserId},{item.GroupUserRoleId.GetHashCode()},{IsUDisturb},'{createdDate}'),";
|
|
|
}
|
|
|
sql = sql.Remove(sql.Length - 1, 1);
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
@@ -208,5 +208,19 @@ namespace GxPress.Repository.Implement
|
|
|
query.Where(nameof(Entity.GroupUser.UserId), userId);
|
|
|
return await _repository.ExistsAsync(query);
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 修改用户阅读时间
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="userId"></param>
|
|
|
+ /// <param name="groupId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<bool> UpdateGroupUserReadDateAsync(int userId, int groupId)
|
|
|
+ {
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.GroupUser.GroupId), groupId);
|
|
|
+ query.Where(nameof(Entity.GroupUser.UserId), userId);
|
|
|
+ query.Set(nameof(Entity.GroupUser.ReadDate), DateTime.Now.ToString());
|
|
|
+ return await _repository.UpdateAsync(query) > 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|