李昊 4 anni fa
parent
commit
fb4ce17219

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

@@ -256,5 +256,16 @@ namespace GxPress.Api.AdminControllers
             var fileName = await _userService.ExcelUserAsync(userIds);
             return File(new FileStream(fileName, FileMode.Open), "application/octet-stream", "员工数据.xls");
         }
+
+        /// <summary>
+        /// vip管理
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("vip")]
+        public async Task<PagedList<UserDetail>> GetUserVipDetail(UserSearchVipRequest request)
+        {
+            return await _userRepository.GetUserVipDetail(request);
+        }
     }
 }

+ 10 - 1
gx_api/GxPress/Model/GxPress.Entity/Admin.cs

@@ -37,7 +37,16 @@ namespace GxPress.Entity
         /// </summary>
         [DataColumn]
         public string Phone { get; set; }
-
+        /// <summary>
+        /// 旧密码
+        /// </summary>
+        /// <value></value>
+        public string OldPassword { get; set; }
+        /// <summary>
+        /// 新密码
+        /// </summary>
+        /// <value></value>
+        public string NewPassword { get; set; }
         /// <summary>
         /// 电子邮箱
         /// </summary>

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

@@ -143,6 +143,12 @@ namespace GxPress.Entity
         [DataColumn]
         public string OpenId { get; set; }
         /// <summary>
+        /// 是否VIP
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsVip { get; set; }
+        /// <summary>
         /// 会员类型 月卡 季卡 年卡
         /// </summary>
         /// <value></value>
@@ -182,7 +188,13 @@ namespace GxPress.Entity
         /// 备注
         /// </summary>
         /// <value></value>
-
         public string Remark { get; set; }
+
+
+        /// <summary>
+        /// 冻结状态 1冻结 2 未冻结 0 全部
+        /// </summary>
+        /// <value></value>
+        public int DisableTypeId { get; set; }
     }
 }

+ 1 - 3
gx_api/GxPress/Model/GxPress.Request/User/UserChangeRoleRequest.cs

@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Collections.Generic;
 
 namespace GxPress.Request.User
 {

+ 0 - 4
gx_api/GxPress/Model/GxPress.Request/User/UserMuteRequest.cs

@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace GxPress.Request.User
 {
     /// <summary>

+ 35 - 0
gx_api/GxPress/Model/GxPress.Request/User/UserRequest.cs

@@ -0,0 +1,35 @@
+using GxPress.Common.Page;
+
+namespace GxPress.Request.User
+{
+    public class UserRequest
+    {
+
+    }
+    /// <summary>
+    /// 会员用户
+    /// </summary>
+    public class UserSearchVipRequest : PageParameter
+    {
+        /// <summary>
+        /// 搜索内容
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
+        /// <summary>
+        /// 月卡  1,季卡 2,年卡 3 ,0全部
+        /// </summary>
+        /// <value></value>
+        public int VipTypeId { get; set; }
+        /// <summary>
+        /// 终端 Pc = 1, Android = 2,Ios = 3,0全部
+        /// </summary>
+        /// <value></value>
+        public int VipPort { get; set; }
+        /// <summary>
+        /// 冻结状态 1冻结 2 未冻结 0 全部
+        /// </summary>
+        /// <value></value>
+        public int DisableTypeId { get; set; }
+    }
+}

+ 57 - 0
gx_api/GxPress/Model/GxPress.Result/User/UserDetail.cs

@@ -119,7 +119,64 @@ namespace GxPress.Result.User
         /// </summary>
         public string QRCoder { get; set; }
 
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+        public bool IsDisable { get; set; }
+        /// <summary>
+        /// 微信唯一标示码
+        /// </summary>
+        /// <value></value>
+
+        public string OpenId { get; set; }
+        /// <summary>
+        /// 是否VIP
+        /// </summary>
+        /// <value></value>
 
+        public bool IsVip { get; set; }
+        /// <summary>
+        /// 会员类型 月卡 季卡 年卡
+        /// </summary>
+        /// <value></value>
+
+        public int TypeId { get; set; }
+        /// <summary>
+        /// 终端 pc android ios
+        /// </summary>
+        /// <value></value>
+
+        public int Port { get; set; }
+        /// <summary>
+        /// 会员开始时间
+        /// </summary>
+        /// <value></value>
+
+        public DateTime BeginTime { get; set; }
+        /// <summary>
+        /// 会员结束时间
+        /// </summary>
+        /// <value></value>
+
+        public DateTime EndTime { get; set; }
+        /// <summary>
+        /// 累计价格
+        /// </summary>
+        /// <value></value>
+
+        public decimal AccumulativePrice { get; set; }
+        /// <summary>
+        /// 是否自动续费
+        /// </summary>
+        /// <value></value>
+
+        public bool IsRenewal { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+        public string Remark { get; set; }
     }
 }
 

+ 8 - 7
gx_api/GxPress/Repository/GxPress.Repository.Implement/AdminRepository.cs

@@ -206,14 +206,15 @@ namespace GxPress.Repository.Implement
         {
             var admin = await GetAsync(id);
             if (admin == null) throw new BusinessException("该用户不存在");
-
-            //var pwd = EncryptProvider.Md5($"{request.OldPassword}{admin.Account}");
-            //if (pwd != admin.Password) throw new BusinessException("旧密码错误");
-
-            //admin.Name = request.Name;
-            //admin.Password = EncryptProvider.Md5($"{request.NewPassword}{admin.Account}");
+            if (!string.IsNullOrEmpty(request.OldPassword) && !string.IsNullOrEmpty(request.NewPassword))
+            {
+                var pwd = EncryptProvider.Md5($"{request.OldPassword}{admin.Account}");
+                if (pwd != admin.Password) throw new BusinessException("旧密码错误");
+                admin.Password = EncryptProvider.Md5($"{request.NewPassword}{admin.Account}");
+                request.Password = admin.Password;
+            }
+            admin.Name = request.Name;
             request.Id = id;
-            request.Password = admin.Password;
             request.CreatedDate = admin.CreatedDate;
             return await UpdateAsync(request);
         }

+ 26 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -166,7 +166,7 @@ namespace GxPress.Repository.Implement
             //用户不存在,自动注册
             if (user == null)
                 throw new BusinessException("用户不存在");
-            
+
             return await _repository.UpdateAsync(Q.Where(nameof(User.Phone), request.Phone).Set(nameof(User.OpenId), request.OpenId)) > 0;
         }
         public async Task<bool> DeleteUsersAsync(IEnumerable<int> userIds)
@@ -388,6 +388,8 @@ namespace GxPress.Repository.Implement
             if (!string.IsNullOrWhiteSpace(request.Phone))
                 user.Phone = request.Phone;
             user.QRCoder = StringUtils.RemoveDomain(user.QRCoder);
+            if (user.DisableTypeId > 0)
+                user.IsDisable = user.DisableTypeId == 1;
             return await UpdateAsync(user);
         }
 
@@ -693,7 +695,7 @@ namespace GxPress.Repository.Implement
                     if (request.SearchType == 2 && !string.IsNullOrWhiteSpace(request.Key) && request.DepartmentId > 0)
                         notInUserIds = "and a.Id not in(";
                     if (request.SearchType == 1 && !string.IsNullOrWhiteSpace(request.Key) && request.DepartmentId > 0)
-                        notInUserIds = "and Id not in("; 
+                        notInUserIds = "and Id not in(";
                     foreach (var userId in request.UserIds)
                     {
                         notInUserIds += $"{userId},";
@@ -880,5 +882,27 @@ namespace GxPress.Repository.Implement
 
         //    return result.ToList()[0];
         //}
+        /// <summary>
+        /// vip用户
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<PagedList<UserDetail>> GetUserVipDetail(UserSearchVipRequest request)
+        {
+            var result = new PagedList<UserDetail>();
+            var query = Q.NewQuery();
+            if (!string.IsNullOrEmpty(request.KeyWord))
+                query.WhereLike(nameof(User.Name), $"%{request.KeyWord}%");
+            if (request.VipPort > 0)
+                query.Where(nameof(User.Port), request.VipPort);
+            if (request.VipTypeId > 0)
+                query.Where(nameof(User.TypeId), request.VipTypeId);
+            if (request.DisableTypeId > 0)
+                query.Where(nameof(User.IsDisable), request.VipTypeId == 1);
+            result.Total = await _repository.CountAsync(query);
+            var items = await _repository.GetAllAsync(query);
+            result.Items = items.Select(n => _mapper.Map<UserDetail>(n));
+            return result;
+        }
     }
 }

+ 6 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/IUserRepository.cs

@@ -2,7 +2,6 @@ using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Common.Page;
 using GxPress.Entity;
-using GxPress.Request.App.User;
 using GxPress.Request.User;
 using GxPress.Result.User;
 using Datory;
@@ -227,5 +226,11 @@ namespace GxPress.Repository.Interface
         /// <param name="request"></param>
         /// <returns></returns>
         Task<bool> UpdateByOpendIdAsync(UserSignInRequest request);
+        /// <summary>
+        /// vip用户
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        Task<PagedList<UserDetail>> GetUserVipDetail(UserSearchVipRequest request);
     }
 }