You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

108 lines
3.6 KiB

using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Yitter.IdGenerator;
using Znyc.Cloudcar.Admin.AspNetCore.Controllers;
using Znyc.Cloudcar.Admin.AspNetCore.Entitys;
using Znyc.Cloudcar.Admin.AspNetCore.Mvc;
using Znyc.Cloudcar.Admin.Commons.Entitys;
using Znyc.Cloudcar.Admin.Commons.Pages;
using Znyc.Cloudcar.Admin.Security.Dtos;
using Znyc.Cloudcar.Admin.Security.Entitys;
using Znyc.Cloudcar.Admin.Security.IServices;
namespace Znyc.Cloudcar.Admin.WebApi.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
[Route("api/Security/[controller]")]
public class
CallFeedbackController : AreaApiController<CallFeedbackEntity, CallFeedbackOutputDto, CallFeedbackInput, ICallFeedbackService, long>
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="_service"></param>
public CallFeedbackController(ICallFeedbackService _service) : base(_service)
{
}
/// <summary>
/// 新增前处理数据
/// </summary>
/// <param name="info"></param>
protected override void OnBeforeInsert(CallFeedbackEntity info)
{
info.Id = YitIdHelper.NextId();
info.CreatedTime = DateTime.Now;
info.CreatedUserId = CurrentUser.UserId;
info.IsDeleted = false;
}
/// <summary>
/// 在更新数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeUpdate(CallFeedbackEntity info)
{
info.ModifiedUserId = CurrentUser.UserId;
info.ModifiedTime = DateTime.Now;
}
/// <summary>
/// 在软删除数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeSoftDelete(CallFeedbackEntity info)
{
info.IsDeleted = true;
}
/// <summary>
/// 通话评价分页查询
/// </summary>
/// <param name="search">status:-1全部/1真实有效/2已经找到/3联系不上/4虚假信息</param>
/// <returns></returns>
[HttpPost("FindWithPagerSearchAsync")]
[FunctionAuthorize("List")]
public async Task<IActionResult> FindWithPagerSearchAsync(SearchCallFeedbackModel search)
{
CommonResult<PageResult<CallFeedbackOutputDto>> result = new CommonResult<PageResult<CallFeedbackOutputDto>>
{
ResData = await _service.FindWithPagerSearchAsync(search),
ErrCode = ErrCode.successCode
};
return ToJsonContent(result);
}
/// <summary>
/// 修改通话反馈已读
/// </summary>
/// <param name="id"></param>
/// <param name="productType"></param>
/// <returns></returns>
[HttpPut("UpdateIsReadAsync")]
[FunctionAuthorize("Edit")]
public async Task<IActionResult> UpdateIsReadAsync(long id, int productType)
{
CommonResult result = new CommonResult();
result = await _service.UpdateIsReadAsync(CurrentUser.UserId, id, productType);
if (result.Success)
{
result.ErrCode = ErrCode.successCode;
result.ErrMsg = ErrCode.err0;
}
else
{
result.ErrMsg = ErrCode.err43001;
result.ErrCode = "43001";
}
return ToJsonContent(result);
}
}
}