李昊 преди 4 години
родител
ревизия
79d8029d71

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminPlatformDataController.cs

@@ -33,7 +33,7 @@ namespace GxPress.Api.AdminControllers
             result.UserAreaDistributingResults = await platformDataService.GetUserAreaDistributingResults();
             result.UserVipProportionResult = await platformDataService.GetUserVipProportionResult();
             result.OnlineUserResult = await platformDataService.GetOnlineUserResult();
-            result.PlatformContentDataResult = new PlatformContentDataResult();
+            result.PlatformContentDataResult = await platformDataService.GetPlatformContentDataResult();
             result.ContentTypeDistributingResult = new List<ContentTypeDistributingResult>();
             result.ContentOlogyDistributingResult = new List<ContentOlogyDistributingResult>();
             result.PayContentstatisticsResult = new PayContentstatisticsResult();

+ 35 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/PlatformData/PlatformDataService.cs

@@ -135,5 +135,40 @@ namespace GxPress.Service.Implement.PlatformData
             }
             return result;
         }
+        /// <summary>
+        /// 平台内容数据
+        /// </summary>
+        /// <returns></returns>
+        public async Task<PlatformContentDataResult> GetPlatformContentDataResult()
+        {
+            var connectionString = ConfigHelper.GetValue("Database:ConnectionString");
+            var database = new Database(DatabaseType.MySql, connectionString);
+            var connection = database.GetConnection();
+            var nowTime = DateTime.Now.ToString("yyyy-MM-dd");
+            var sql = $@"SELECT 
+                            (SELECT 
+                                    COUNT(1)
+                                FROM
+                                    tede_media) AS SumContentCount,
+                            (SELECT 
+                                    COUNT(1)
+                                FROM
+                                    tede_media
+                                WHERE
+                                    CreatedDate > '{nowTime}') AS NewContentCount,
+                            (SELECT 
+                                    COUNT(1)
+                                FROM
+                                    tede_media
+                                WHERE
+                                IsChecked=1 and IsDelete=0) AS OnlineContentCount,
+                                (SELECT 
+                                    COUNT(1)
+                                FROM
+                                    tede_media
+                                WHERE
+                                FreeProportion>0) AS PayContentCount";
+            return await connection.QueryFirstAsync<PlatformContentDataResult>(sql);
+        }
     }
 }

+ 7 - 2
gx_api/GxPress/Service/GxPress.Service.Interface/PlatformData/IPlatformDataService.cs

@@ -21,7 +21,7 @@ namespace GxPress.Service.Interface.PlatformData
         /// </summary>
         /// <value></value>
         Task<List<UserAreaDistributingResult>> GetUserAreaDistributingResults();
-         /// <summary>
+        /// <summary>
         /// 会员用户占比
         /// </summary>
         /// <returns></returns>
@@ -30,6 +30,11 @@ namespace GxPress.Service.Interface.PlatformData
         /// 实时在线人数
         /// </summary>
         /// <returns></returns>
-       Task<OnlineUserResult> GetOnlineUserResult();
+        Task<OnlineUserResult> GetOnlineUserResult();
+        /// <summary>
+        /// 平台内容数据
+        /// </summary>
+        /// <returns></returns>
+        Task<PlatformContentDataResult> GetPlatformContentDataResult();
     }
 }