lingling
2025-03-19 1f511d33262c2f06a425afc2651760a6777827d2
Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi
9个文件已修改
104 ■■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/AccountService.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/UserRoleService.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
@@ -80,6 +80,16 @@
        public string Remark { get; set; }
    }
    /// <summary>
    /// 重置密码基础输入参数
    /// </summary>
    public class ResetPasswordBaseInput
    {
        public Guid UserId { get; set; }
        public string? Password { get; set; }
    }
    public class UpdateBackClientUserInput : CreateBackClientUserInput
    {
        /// <summary>
LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
@@ -23,7 +23,7 @@
        Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp);
        Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false, string password = null);
        Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false);
        #endregion
    }
}
LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs
@@ -11,6 +11,13 @@
        Task<int> UpdateBackClientUser(UpdateBackClientUserInput input);
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task ResetPassword(ResetPasswordBaseInput input);
        Task<int> DeleteBackClientUser(Guid id);
        Task<Guid> CreateRole(CreateOrUpdateRoleInput input);
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -50,6 +50,11 @@
        public string Name { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [RegularExpression(LifePaymentConstant.RegularExpression.UserNameEx, ErrorMessage = "账号格式不正确")]
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -134,7 +134,7 @@
            return result;
        }
        public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false, string password = null)
        public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false)
        {
            if (input.ClientId == LifePaymentConstant.ClientId.Back)
            {
@@ -146,8 +146,10 @@
            CheckExtensions.IfTrueThrowUserFriendlyException(any,
                                                             CustomeErrorMessage.PhoneNumberRepeatSaveFail);
            password ??= GlobalRandom.GetRandomPassword();
            /// input.Password ??= GlobalRandom.GetRandomPassword();
            CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password),
                                                             "请输入密码");
            var res = await _identityUserService.CreateAsync(new IdentityUserCreateDto
            {
                Name = input.Name,
@@ -155,7 +157,7 @@
                UserName = input.UserName,
                RoleNames = input.RoleNames,
                ClientId = input.ClientId,
                Password = password,
                Password = input.Password,
            });
            var user = await _userRepository.InsertAsync(new User
            {
LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -1,6 +1,7 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.Models;
using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@@ -9,8 +10,10 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Z.EntityFramework.Plus;
using ZeroD.Util;
using static LifePayment.Domain.Shared.LifePaymentConstant;
namespace HumanResourcesServices.Application
{
@@ -21,19 +24,22 @@
        private readonly IRepository<LifePayChannles, Guid> _channleRepository;
        private readonly IRepository<UserRole, Guid> _userRoleRep;
        private readonly IRepository<UserChannle, Guid> _userChannleRep;
        private readonly IIdentityUserAppService _identityUserService;
        public UserRoleService(
               IRepository<User, Guid> userRepository,
               IRepository<Role, Guid> roleRepository,
               IRepository<LifePayChannles, Guid> channleRepository,
               IRepository<UserRole, Guid> userRoleRep,
               IRepository<UserChannle, Guid> userChannleRep)
               IRepository<UserChannle, Guid> userChannleRep,
               IIdentityUserAppService identityUserService)
        {
            _userRepository = userRepository;
            _roleRepository = roleRepository;
            _channleRepository = channleRepository;
            _userRoleRep = userRoleRep;
            _userChannleRep = userChannleRep;
            _identityUserService = identityUserService;
        }
        public async Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input)
@@ -110,6 +116,28 @@
            return Constant.SUCCESS;
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task ResetPassword(ResetPasswordBaseInput input)
        {
            var user = await _userRepository.FirstOrDefaultAsync(x => x.Id == input.UserId);
            CheckExtensions.IfTrueThrowUserFriendlyException(user == null, CustomeErrorMessage.IsNoExistUser);
            CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password), "请输入密码");
            var identiResetInput = new ResetPassWordInput
            {
                UserId = input.UserId,
                Name = user.Name,
                UserName = user.UserName,
                Password = input.Password,
                PhoneNumber = user.PhoneNumber
            };
            var result = await _identityUserService.ResetPassword(identiResetInput);
            CheckExtensions.IfTrueThrowUserFriendlyException(result != Constant.SUCCESS,
                                                             CustomeErrorMessage.ResetPasswordFail);
        }
        public async Task<int> DeleteBackClientUser(Guid id)
        {
            var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == id && s.ClientId == Constant.ClientType.Back);
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -350,6 +350,13 @@
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.ResetUserPassword(LifePayment.Application.Contracts.ResetPasswordBaseInput)">
            <summary>
            重置密码
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.UserRoleController.DeleteBackClientUser(System.Guid)">
            <summary>
            删除后台管理账户
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1526,6 +1526,11 @@
            备注
            </summary>
        </member>
        <member name="T:LifePayment.Application.Contracts.ResetPasswordBaseInput">
            <summary>
            重置密码基础输入参数
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.UpdateBackClientUserInput.Id">
            <summary>
            用户Id
@@ -1675,6 +1680,13 @@
            <returns></returns>
            <exception cref="T:Volo.Abp.UserFriendlyException"></exception>
        </member>
        <member name="M:LifePayment.Application.Contracts.IUserRoleService.ResetPassword(LifePayment.Application.Contracts.ResetPasswordBaseInput)">
            <summary>
            重置密码
            </summary>
            <param name="input"></param>
            <returns></returns>
        </member>
        <member name="P:LifePayment.Application.Contracts.LifePayPhoneMesssageCodeLoginInput.PhoneNumber">
            <summary>
            手机号
@@ -1705,6 +1717,11 @@
            名称
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.Password">
            <summary>
            密码
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.CreateAccountInput.UserName">
            <summary>
            用户名
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -62,6 +62,11 @@
        [HttpPost]
        public async Task<int> UpdateBackClientUser(UpdateBackClientUserInput input)
        {
            var identityUser = await _identityUserService.GetAsync(input.Id);
            CheckExtensions.IfTrueThrowUserFriendlyException(identityUser == null,
                                                             "用户不存在");
            await _identityUserService.UpdateAsync(input.Id, new IdentityUserUpdateDto
            {
                Name = input.Name,
@@ -73,6 +78,19 @@
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public virtual async Task<int> ResetUserPassword(ResetPasswordBaseInput input)
        {
            await _userRoleService.ResetPassword(input);
            return Constant.SUCCESS;
        }
        /// <summary>
        /// 删除后台管理账户
        /// </summary>
        /// <param name="id">用户Id</param>