zhengyiming
2025-04-10 0846b628ebd2e657a7fb070df41569d38556a476
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -1,8 +1,11 @@
using LifePayment.Application.Contracts;
using LifePayment.Domain.Shared;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Nest;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
@@ -40,6 +43,8 @@
        [HttpPost]
        public async Task<Guid> CreateBackClientUser(CreateBackClientUserInput input)
        {
            return await _accountService.CreateAccount(ObjectMapper.Map<CreateBackClientUserInput, CreateAccountInput>(input), isAdminCreate: true);
        }
@@ -73,9 +78,21 @@
                PhoneNumber = input.PhoneNumber,
                UserName = input.UserName,
                RoleNames = input.RoleNames,
                Password = input.Password,
            });
            return await _userRoleService.UpdateBackClientUser(input);
        }
        /// <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>
@@ -113,8 +130,15 @@
                Sequence = input.Sequence,
                Note = input.Remark,
            });
            var newInput = ObjectMapper.Map<CreateBaseRoleInput, CreateOrUpdateRoleInput>(input);
            newInput.Id = res.Id;
            CreateOrUpdateRoleInput newInput = new CreateOrUpdateRoleInput()
            {
                Id = res.Id,
                Name = input.Name,
                Sequence = input.Sequence,
                DepartmentId = input.DepartmentId,
                DataRange = input.DataRange,
                Remark = input.Remark,
            };
            await _userRoleService.CreateRole(newInput);
            return res.Id;
        }
@@ -185,5 +209,15 @@
            await _identityRoleService.DeleteAsync(id);
            return await _userRoleService.DeleteRole(id);
        }
        /// <summary>
        /// 获取用户账号详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
        {
            return await _accountService.GetBackClientUserInfo();
        }
    }
}