李昊 4 年之前
父節點
當前提交
91e113b6cd
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. 9 4
      gx_api/GxPress/Service/GxPress.Service.Implement/Reply/ReplyService.Praise.cs

+ 9 - 4
gx_api/GxPress/Service/GxPress.Service.Implement/Reply/ReplyService.Praise.cs

@@ -17,13 +17,14 @@ namespace GxPress.Service.Implement.Reply
     public partial class ReplyService
     {
         /// <summary>
-        /// 获取话题本赞
+        /// 获取 笔记话题本赞
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
         public async Task<IEnumerable<ReplyResult>> GetNotePraiseAsync(ReplyRequest request)
         {
             var topicNoteConstValue = AllTypeConst.TopicNote.GetHashCode();
+            var noteConstValue = AllTypeConst.Note.GetHashCode();
             string sqlStr = string.Empty;
             if (!string.IsNullOrEmpty(request.KeyWord))
             {
@@ -56,8 +57,8 @@ namespace GxPress.Service.Implement.Reply
                                             INNER JOIN
                                         tede_middle e ON e.MiddleId = b.Id
                                     WHERE
-                                        a.TypeValue ={topicNoteConstValue} AND e.IsDelete = 0
-                                            AND  e.FolderType ={topicNoteConstValue}
+                                        a.TypeValue in ({topicNoteConstValue},{noteConstValue}) AND e.IsDelete = 0
+                                            AND  e.FolderType in({topicNoteConstValue},{noteConstValue})
                                             AND a.CommentId = 0
                                             AND e.UserId = b.UserId
                                             AND a.AnalyzeType = 1 
@@ -259,6 +260,7 @@ namespace GxPress.Service.Implement.Reply
         /// <returns></returns>
         public async Task<int> GetUReadPraiseCountAsync(int userId)
         {
+            //笔记话题本
             var sql = $@" SELECT 
                         COUNT(1)
                     FROM
@@ -281,6 +283,7 @@ namespace GxPress.Service.Implement.Reply
             var database = new Database(DatabaseType.MySql, ConfigHelper.GetValue("Database:ConnectionString"));
             var connection = database.GetConnection();
             var count = await connection.ExecuteScalarAsync<int>(sql);
+            //评论
             sql = $@" SELECT 
                         count(1)
                         FROM
@@ -292,11 +295,12 @@ namespace GxPress.Service.Implement.Reply
                                 INNER JOIN
                             tede_user d ON d.Id = a.UserId
                         WHERE
-                            a.TypeValue IN ({AllTypeConst.Topic.GetHashCode()},{AllTypeConst.Notice.GetHashCode()},{AllTypeConst.Note.GetHashCode()})
+                            a.TypeValue IN ({AllTypeConst.Topic.GetHashCode()},{AllTypeConst.Notice.GetHashCode()},{AllTypeConst.Note.GetHashCode()},{AllTypeConst.TopicNote.GetHashCode()})
                                 AND a.UserId ={userId}
                                 AND b.AnalyzeType = 2
                                 AND b.IsRead = 0";
             count += await connection.ExecuteScalarAsync<int>(sql);
+            //通知
             sql = $@"  SELECT 
                             COUNT(1)
                         FROM
@@ -318,6 +322,7 @@ namespace GxPress.Service.Implement.Reply
                                  AND a.IsRead = 0
                                 ";
             count += await connection.ExecuteScalarAsync<int>(sql);
+            //小组话题
             sql = $@"  SELECT 
                                 count(1)
                                 FROM