public JsonResult AddOrderComplaint(OrderComplaintInfo model) { model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.ComplaintDate = DateTime.Now; model.Status = OrderComplaintInfo.ComplaintStatus.WaitDeal; var shop = _iShopService.GetShop(model.ShopId); var order = _iOrderService.GetOrder(model.OrderId, CurrentUser.Id); if (model.ComplaintReason.Length < 5) { throw new HimallException("投诉内容不能小于5个字符!"); } if (string.IsNullOrWhiteSpace(model.UserPhone)) { throw new HimallException("投诉电话不能为空!"); } if (order == null || order.ShopId != model.ShopId) { throw new HimallException("该订单不属于当前用户!"); } model.ShopName = shop == null ? "" : shop.ShopName; model.ShopPhone = shop == null ? "" : shop.CompanyPhone; model.ShopPhone = model.ShopPhone == null ? "" : model.ShopPhone; model.ShopName = model.ShopName == null ? "" : model.ShopName; _iComplaintService.AddComplaint(model); return(Json(new { success = true, msg = "提交成功" }, JsonRequestBehavior.AllowGet)); }
public IActionResult AddComplaint([FromBody] ComplaintDataModel complaintModel) { var complaintEntity = ComplaintEntity.MapToEntity(complaintModel); var complaint = _complaintService.AddComplaint(complaintEntity); return(Ok(complaint)); }
public async Task <IActionResult> AddComplaint([FromRoute] string feedId, [FromBody] AddComplaintDTO model) { var result = await _complaintsServices.AddComplaint(feedId, model); if (result.Success) { return(Created("", result)); } return(BadRequest(result)); }
public IActionResult Post([FromBody] ComplaintsModel complaintsModel) { try { var response = _complaintService.AddComplaint(complaintsModel); return(Ok(new { compaintId = response })); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(BadRequest()); } }
public JsonResult AddOrderComplaint(Mall.Entities.OrderComplaintInfo model) { model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.ComplaintDate = DateTime.Now; model.Status = Mall.Entities.OrderComplaintInfo.ComplaintStatus.WaitDeal; var shop = _iShopService.GetShop(model.ShopId); var order = _iOrderService.GetOrder(model.OrderId, CurrentUser.Id); if (model.ComplaintReason.Length < 5) { throw new MallException("投诉内容不能小于5个字符!"); } if (model.ComplaintReason.Length > 500) { throw new MallException("字数过长,限制500个字!"); } if (string.IsNullOrWhiteSpace(model.UserPhone)) { throw new MallException("投诉电话不能为空!"); } if (order == null || order.ShopId != model.ShopId) { throw new MallException("该订单不属于当前用户!"); } model.ShopName = shop == null ? "" : shop.ShopName; model.ShopPhone = shop == null ? "" : shop.CompanyPhone; if (model.ShopPhone == null) { //管理员信息 long uid = Mall.Application.ShopApplication.GetShopManagers(shop.Id); Mall.DTO.MemberAccountSafety mMemberAccountSafety = Mall.Application.MemberApplication.GetMemberAccountSafety(uid); model.ShopPhone = mMemberAccountSafety.Phone; } model.ShopName = model.ShopName == null ? "" : model.ShopName; _iComplaintService.AddComplaint(model); return(Json(new { success = true, msg = "提交成功" })); }