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