98 lines
3.3 KiB
C#
98 lines
3.3 KiB
C#
using Infrastructure;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Enums;
|
|
using Infrastructure.Model;
|
|
using Mapster;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ARW.Admin.WebApi.Extensions;
|
|
using ARW.Admin.WebApi.Filters;
|
|
using ARW.Common;
|
|
using ARW.Model.Dto.Business.CustomerServices;
|
|
using ARW.Service.Business.IBusinessService.CustomerServices;
|
|
using ARW.Admin.WebApi.Controllers;
|
|
using ARW.Model.Models.Business.CustomerServices;
|
|
using ARW.Model.Vo.Business.CustomerServices;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using ARW.Admin.WebApi.Framework;
|
|
|
|
|
|
namespace ARW.WebApi.Controllers.Business.CustomerServices
|
|
{
|
|
/// <summary>
|
|
/// 客服控制器
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-21
|
|
/// </summary>
|
|
[Verify]
|
|
[Route("business/[controller]")]
|
|
public class CustomerServiceController : BaseController
|
|
{
|
|
private readonly ICustomerServiceService _CustomerServiceService;
|
|
|
|
/// <summary>
|
|
/// 依赖注入
|
|
/// </summary>
|
|
/// <param name="CustomerServiceService">客服服务</param>
|
|
public CustomerServiceController(ICustomerServiceService CustomerServiceService)
|
|
{
|
|
_CustomerServiceService = CustomerServiceService;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取客服列表
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>
|
|
[HttpGet("getCustomerServiceList")]
|
|
[ActionPermissionFilter(Permission = "business:customerservice:list")]
|
|
public async Task<IActionResult> GetCustomerServiceList([FromQuery] CustomerServiceQueryDto parm)
|
|
{
|
|
var res = await _CustomerServiceService.GetCustomerServiceList(parm);
|
|
return SUCCESS(res);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改客服
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("addOrUpdateCustomerService")]
|
|
[ActionPermissionFilter(Permission = "business:customerservice:addOrUpdate")]
|
|
[Log(Title = "添加或修改客服", BusinessType = BusinessType.ADDORUPDATE)]
|
|
public async Task<IActionResult> AddOrUpdateCustomerService([FromBody] CustomerServiceDto parm)
|
|
{
|
|
if (parm == null) { throw new CustomException("请求参数错误"); }
|
|
var modal = new CustomerService();
|
|
if (parm.CustomerServiceId != 0) modal = parm.Adapt<CustomerService>().ToUpdate(HttpContext);
|
|
else modal = parm.Adapt<CustomerService>().ToCreate(HttpContext);
|
|
|
|
var res = await _CustomerServiceService.AddOrUpdateCustomerService(modal);
|
|
return SUCCESS(res);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除客服
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpDelete("{ids}")]
|
|
[ActionPermissionFilter(Permission = "business:customerservice:delete")]
|
|
[Log(Title = "客服删除", BusinessType = BusinessType.DELETE)]
|
|
public IActionResult Delete(string ids)
|
|
{
|
|
long[] idsArr = Tools.SpitLongArrary(ids);
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
var response = _CustomerServiceService.Delete(idsArr);
|
|
return SUCCESS("删除成功!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|