zuoxiang 4 年 前
コミット
6e71c1b22b

+ 17 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUserController.cs

@@ -127,6 +127,23 @@ namespace GxPress.Api.AdminControllers
             var result = await _userService.GetPagedListAsync(request);
             return result;
         }
+        [HttpPost("list")]
+        public async Task<PagedList<User>> GetListAsync([FromBody] UserPageSearchRequest request)
+        {
+
+            var result = await _userService.GetPageListAsync(request);
+            foreach (var item in result.Items)
+            {
+
+                if (item.IsRenewal)
+                    item.Remark = "自动续费";
+                else if (item.EndTime < DateTime.Now)
+                    item.Remark = "已过期";
+                else
+                    item.Remark = "在费";
+            }
+            return result;
+        }
 
         /// <summary>
         /// 分页列表

+ 20 - 2
gx_api/GxPress/Model/GxPress.Entity/Navigations/Navigation.cs

@@ -25,14 +25,32 @@ namespace GxPress.Entity.Navigations
         /// 父级ID
         /// </summary>
         /// <value></value>
-         [DataColumn]
+        [DataColumn]
         public int ParentId { get; set; }
 
         /// <summary>
         /// 排序
         /// </summary>
         /// <value></value>
-         [DataColumn]
+        [DataColumn]
         public int Sort { get; set; }
+        /// <summary>
+        /// 路径
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string ControllerUrl { get; set; }
+        /// <summary>
+        /// 路径
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string ActionUrl { get; set; }
+        /// <summary>
+        /// 是否可以操作
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool Isoperate { get; set; }
     }
 }

+ 13 - 1
gx_api/GxPress/Model/GxPress.Entity/User.cs

@@ -142,7 +142,7 @@ namespace GxPress.Entity
         /// <value></value>
         [DataColumn]
         public string OpenId { get; set; }
-         /// <summary>
+        /// <summary>
         /// 会员类型 月卡 季卡 年卡
         /// </summary>
         /// <value></value>
@@ -172,5 +172,17 @@ namespace GxPress.Entity
         /// <value></value>
         [DataColumn]
         public decimal AccumulativePrice { get; set; }
+        /// <summary>
+        /// 是否自动续费
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsRenewal { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+
+        public string Remark { get; set; }
     }
 }

+ 27 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/UserService.cs

@@ -272,10 +272,36 @@ namespace GxPress.Service.Implement
                         .OrWhereLike(nameof(User.Phone), keyword)
                 );
             }
-
             return await _userRepository.GetAllAsync(query);
         }
 
+        public async Task<PagedList<User>> GetPageListAsync(UserPageSearchRequest request)
+        {
+            var result = new PagedList<User>();
+            var query = Q.ForPage(request.Page, request.PerPage);
+            if (request.DepartmentId > 0)
+            {
+                query.Where(nameof(User.DepartmentId), request.DepartmentId);
+            }
+
+            if (request.RoleId > 0)
+            {
+                query.Where(nameof(User.RoleId), request.RoleId);
+            }
+
+            if (!string.IsNullOrEmpty(request.Keyword))
+            {
+                request.Keyword = "%" + request.Keyword + "%";
+                query.Where(q =>
+                    q.WhereLike(nameof(User.Name), request.Keyword)
+                        .OrWhereLike(nameof(User.Email), request.Keyword)
+                        .OrWhereLike(nameof(User.Phone), request.Keyword)
+                );
+            }
+            result.Items = await _userRepository.GetAllAsync(query);
+            result.Total = await _userRepository.CountAsync(query);
+            return result;
+        }
         /// <summary>
         /// 删除用户
         /// </summary>

+ 3 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/IUserService.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using GxPress.Common.Page;
+using GxPress.Entity;
 using GxPress.Request.App.User;
 using GxPress.Request.User;
 using GxPress.Result.App.User;
@@ -47,5 +48,7 @@ namespace GxPress.Service.Interface
         /// <param name="userId"></param>
         /// <returns></returns>
         Task<UserCountResult> GetUserCountAsync(int userId);
+
+       Task<PagedList<User>> GetPageListAsync(UserPageSearchRequest request);
     }
 }