|
@@ -15,6 +15,7 @@ using GxPress.Request.App.Middle;
|
|
|
using System;
|
|
|
using GxPress.Request.Inbox;
|
|
|
using System.Linq;
|
|
|
+using GxPress.EnumConst;
|
|
|
|
|
|
namespace GxPress.Repository.Implement
|
|
|
{
|
|
@@ -322,5 +323,27 @@ namespace GxPress.Repository.Implement
|
|
|
}
|
|
|
return returnIds;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 清空草稿箱
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="userId"></param>
|
|
|
+ /// <param name="typeValue"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<bool> ClearDraftAsync(int userId, int typeValue)
|
|
|
+ {
|
|
|
+ //获取用户草稿
|
|
|
+ var sql = $"select Id from tede_note where UserId={userId} and IsDraft=1";
|
|
|
+ var databaseType = _databaseTypeStr.ToEnum<DatabaseType>(DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var noteIds = await connection.QueryAsync<int>(sql);
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.UserId), userId);
|
|
|
+ query.WhereIn(nameof(Entity.Middle.Middle.MiddleId), noteIds);
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.FolderType), typeValue == 1 ? AllTypeConst.TopicNote.GetHashCode() : AllTypeConst.Note.GetHashCode());
|
|
|
+ query.Set(nameof(Entity.Middle.Middle.IsDelete), true);
|
|
|
+ return await UpdateAsync(query);
|
|
|
+ }
|
|
|
}
|
|
|
}
|