diff --git a/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs b/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs new file mode 100644 index 0000000..53ce348 --- /dev/null +++ b/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; + +namespace ARW.Model.Dto.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价输入对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentDto + { + + public int GoodsCommentId { get; set; } + + public long GoodsCommentGuid { get; set; } + + [Required(ErrorMessage = "店铺guid不能为空")] + public long ShopGuid { get; set; } + + [Required(ErrorMessage = "客户guid不能为空")] + public long CustomerGuid { get; set; } + + [Required(ErrorMessage = "订单guid不能为空")] + public long OrderGuid { get; set; } + + [Required(ErrorMessage = "商品guid不能为空")] + public long GoodsGuid { get; set; } + + [Required(ErrorMessage = "订单商品guid不能为空")] + public long OrderGoodsGuid { get; set; } + + [Required(ErrorMessage = "评分分数不能为空")] + public float GoodsCommentRating { get; set; } + + [Required(ErrorMessage = "评分类型不能为空")] + public int GoodsCommentRatingType { get; set; } + + [Required(ErrorMessage = "评价内容不能为空")] + public string GoodsCommentContent { get; set; } + + public string GoodsCommentImages { get; set; } + + [Required(ErrorMessage = "回复状态不能为空")] + public int GoodsCommentRecoverStatus { get; set; } + + public string GoodsCommentRecoverContent { get; set; } + + [Required(ErrorMessage = "显示状态不能为空")] + public int GoodsCommentStatus { get; set; } + + [Required(ErrorMessage = "排序不能为空")] + public int GoodsCommentSort { get; set; } + + + + + + } + + + /// + /// 商品评价查询对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentQueryDto : PagerInfo + { + + public string ShopName { get; set; } + + public string GoodsName { get; set; } + + public long? ShopGuid { get; set; } + public int? GoodsCommentRatingType { get; set; } + + public int? GoodsCommentStatus { get; set; } + + public int? GoodsCommentRecoverStatus { get; set; } + + public string ids { get; set; } + } + + + /// + /// + /// @author admin + /// @date 2023-07-17 + /// 回复对象 + /// + public class GoodsCommentRecoverDto + { + [Required(ErrorMessage = "id不能为空")] + public int GoodsCommentId { get; set; } + + [Required(ErrorMessage = "回复内容不能为空")] + public string GoodsCommentRecoverContent { get; set; } + } + + +} diff --git a/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs b/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs new file mode 100644 index 0000000..7d05c7f --- /dev/null +++ b/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using OfficeOpenXml.Attributes; +using Newtonsoft.Json; + +namespace ARW.Model.Models.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价,数据实体对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + [SugarTable("tb_goods_comment")] + public class GoodsComment : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_comment_id")] + public int GoodsCommentId { get; set; } + + + /// + /// 描述 : + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "goods_comment_guid")] + public long GoodsCommentGuid { get; set; } + + + /// + /// 描述 :店铺guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "shop_guid")] + public long ShopGuid { get; set; } + + + /// + /// 描述 :客户guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "customer_guid")] + public long CustomerGuid { get; set; } + + + /// + /// 描述 :订单guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "order_guid")] + public long OrderGuid { get; set; } + + + /// + /// 描述 :商品guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "goods_guid")] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :订单商品guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "order_goods_guid")] + public long OrderGoodsGuid { get; set; } + + + /// + /// 描述 :评分分数 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_rating")] + public float GoodsCommentRating { get; set; } + + + /// + /// 描述 :评分类型 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_rating_type")] + public int GoodsCommentRatingType { get; set; } + + + /// + /// 描述 :评价内容 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_content")] + public string GoodsCommentContent { get; set; } + + + /// + /// 描述 :评价图片 + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_comment_images")] + public string GoodsCommentImages { get; set; } + + + /// + /// 描述 :回复状态 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_recover_status")] + public int GoodsCommentRecoverStatus { get; set; } + + + /// + /// 描述 :回复内容 + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_comment_recover_content")] + public string GoodsCommentRecoverContent { get; set; } + + + /// + /// 描述 :显示状态 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_status")] + public int GoodsCommentStatus { get; set; } + + + /// + /// 描述 :排序 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_sort")] + public int GoodsCommentSort { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs b/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs new file mode 100644 index 0000000..8165547 --- /dev/null +++ b/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs @@ -0,0 +1,132 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价展示对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentVo + { + + + /// + /// 描述 : + /// + public int GoodsCommentId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsCommentGuid { get; set; } + + + /// + /// 描述 :店铺guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long ShopGuid { get; set; } + + /// + /// 描述 :店铺名称 + /// + public string ShopName { get; set; } + + /// + /// 描述 :客户guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerGuid { get; set; } + + /// + /// 描述 :客户名称 + /// + public string CustomerNickname { get; set; } + + + /// + /// 描述 :订单guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long OrderGuid { get; set; } + + + /// + /// 描述 :商品guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsGuid { get; set; } + + /// + /// 描述 :商品名称 + /// + public string GoodsName { get; set; } + + /// + /// 描述 :商品图片 + /// + public string GoodsPicture { get; set; } + + /// + /// 描述 :订单商品guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long OrderGoodsGuid { get; set; } + + + /// + /// 描述 :评分分数 + /// + public float GoodsCommentRating { get; set; } + + + /// + /// 描述 :评分类型 + /// + public int GoodsCommentRatingType { get; set; } + + + /// + /// 描述 :评价内容 + /// + public string GoodsCommentContent { get; set; } + + + /// + /// 描述 :评价图片 + /// + public string GoodsCommentImages { get; set; } + + + /// + /// 描述 :回复状态 + /// + public int GoodsCommentRecoverStatus { get; set; } + + + /// + /// 描述 :回复内容 + /// + public string GoodsCommentRecoverContent { get; set; } + + + /// + /// 描述 :显示状态 + /// + public int GoodsCommentStatus { get; set; } + + + /// + /// 描述 :排序 + /// + public int GoodsCommentSort { get; set; } + + } +} diff --git a/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs b/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs new file mode 100644 index 0000000..a8a8ed4 --- /dev/null +++ b/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs @@ -0,0 +1,20 @@ +using System; +using Infrastructure.Attribute; +using ARW.Repository.System; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; + +namespace ARW.Repository.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价仓储 + /// + /// @author admin + /// @date 2023-07-15 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class GoodsCommentRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs new file mode 100644 index 0000000..3e45cf2 --- /dev/null +++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs @@ -0,0 +1,144 @@ +using Infrastructure.Attribute; +using Microsoft.AspNetCore.Http; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Infrastructure; +using ARW.Model; +using ARW.Repository; +using ARW.Repository.Business.GoodsManager.GoodsComments; +using ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments; +using ARW.Model.Dto.Business.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.ShopManager.Shops; +using ARW.Model.Models.Business.GoodsManager.Goodss; +using ARW.Model.Models.Business.Custom.Customers; + +namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsComments +{ + /// + /// 商品评价接口实现类 + /// + /// @author admin + /// @date 2023-07-15 + /// + [AppService(ServiceType = typeof(IGoodsCommentService), ServiceLifetime = LifeTime.Transient)] + public class GoodsCommentServiceImpl : BaseService, IGoodsCommentService + { + private readonly GoodsCommentRepository _GoodsCommentRepository; + + public GoodsCommentServiceImpl(GoodsCommentRepository GoodsCommentRepository) + { + this._GoodsCommentRepository = GoodsCommentRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询商品评价分页列表 + /// + public async Task> GetGoodsCommentList(GoodsCommentQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(parm.ShopGuid != null, s => s.ShopGuid == parm.ShopGuid); + predicate = predicate.AndIF(parm.GoodsCommentRecoverStatus != null, s => s.GoodsCommentRecoverStatus == parm.GoodsCommentRecoverStatus); + predicate = predicate.AndIF(parm.GoodsCommentRatingType != null, s => s.GoodsCommentRatingType == parm.GoodsCommentRatingType); + predicate = predicate.AndIF(parm.GoodsCommentStatus != null, s => s.GoodsCommentStatus == parm.GoodsCommentStatus); + var query = _GoodsCommentRepository + .Queryable() + .LeftJoin((s, c) => s.ShopGuid == c.ShopGuid) + .LeftJoin((s, c, d) => s.GoodsGuid == d.GoodsGuid) + .LeftJoin((s, c, d, f) => s.CustomerGuid == f.CustomerGuid) + .WhereIF(!string.IsNullOrEmpty(parm.ShopName), (s, c, d, f) => c.ShopName.Contains(parm.ShopName)) + .WhereIF(!string.IsNullOrEmpty(parm.GoodsName), (s, c, d, f) => d.GoodsName.Contains(parm.GoodsName)) + .Where(predicate.ToExpression()) + .OrderBy(s => s.GoodsCommentSort, OrderByType.Asc) + .Select((s, c, d, f) => new GoodsCommentVo + { + GoodsCommentId = s.GoodsCommentId, + GoodsCommentGuid = s.GoodsCommentGuid, + ShopGuid = s.ShopGuid, + ShopName = c.ShopName, + CustomerGuid = s.CustomerGuid, + CustomerNickname = f.CustomerNickname, + OrderGuid = s.OrderGuid, + GoodsGuid = s.GoodsGuid, + GoodsName = d.GoodsName, + GoodsPicture = d.GoodsPicture, + OrderGoodsGuid = s.OrderGoodsGuid, + GoodsCommentRating = s.GoodsCommentRating, + GoodsCommentRatingType = s.GoodsCommentRatingType, + GoodsCommentContent = s.GoodsCommentContent, + GoodsCommentImages = s.GoodsCommentImages, + GoodsCommentRecoverStatus = s.GoodsCommentRecoverStatus, + GoodsCommentRecoverContent = s.GoodsCommentRecoverContent, + GoodsCommentStatus = s.GoodsCommentStatus, + GoodsCommentSort = s.GoodsCommentSort, + }); + + + return await query.ToPageAsync(parm); + } + + /// + /// 添加或修改商品评价 + /// + public async Task AddOrUpdateGoodsComment(GoodsComment model) + { + if (model.GoodsCommentRating < 3) + { + model.GoodsCommentRatingType = 3; + } + if (model.GoodsCommentRating < 3.5 && model.GoodsCommentRating >= 2.5) + { + model.GoodsCommentRatingType = 2; + } + if (model.GoodsCommentRating >= 3.5) + { + model.GoodsCommentRatingType = 1; + } + + if (model.GoodsCommentId != 0) + { + var response = await _GoodsCommentRepository.UpdateAsync(model); + return "修改成功!"; + } + else + { + model.GoodsCommentRecoverStatus = 1; + var response = await _GoodsCommentRepository.InsertReturnSnowflakeIdAsync(model); + return "添加成功!"; + } + } + + #region Excel处理 + + + #endregion + + + /// + /// 回复 + /// + public async Task Recover(GoodsCommentRecoverDto parm) + { + var response = await _GoodsCommentRepository.UpdateAsync(f => new GoodsComment + { + GoodsCommentRecoverContent = parm.GoodsCommentRecoverContent, + GoodsCommentRecoverStatus = 2 + }, s => s.GoodsCommentId == parm.GoodsCommentId); + if (response) return "回复成功"; + else return "回复失败"; + } + + #endregion + + } +} diff --git a/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs b/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs index 2fed5b7..3d7f92a 100644 --- a/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs +++ b/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs @@ -289,23 +289,36 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.Goodss // 商品类目 // 拆分上级类目和当前类目(手机/xxxx系列) var nameArr = Goods.GoodsCategoryName.Split('/'); - if (nameArr.Length == 0 || nameArr.Length >= 3) throw new CustomException($"商品类目【{Goods.GoodsCategoryName}】格式不正确,参考(手机/xxxx系列)"); + if (nameArr.Length == 0 || nameArr.Length >= 3) throw new CustomException($"商品类目【{Goods.GoodsCategoryName}】格式不正确,参考(手机/xxxx系列 或者 手机)"); - // 找出上级类目 - var parentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( - s => s.ShopGoodsCategoryName == nameArr.First() && - s.ShopGuid == Goods.ShopGuid - ); - if (parentGoodsCategory == null) throw new CustomException($"上级商品类目【{nameArr.First()}】不存在"); + if (nameArr.Length != 1) + { + // 找出上级类目 + var parentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == nameArr.First() && + s.ShopGuid == Goods.ShopGuid + ); + if (parentGoodsCategory == null) throw new CustomException($"上级商品类目【{nameArr.First()}】不存在"); - // 找出当前类目 - var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( - s => s.ShopGoodsCategoryName == nameArr.Last() && - s.ShopGuid == Goods.ShopGuid && - s.ShopGoodsCategoryParentGuid == parentGoodsCategory.ShopGoodsCategoryGuid - ); - if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{nameArr.First()}】不存在"); - Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + // 找出当前类目 + var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == nameArr.Last() && + s.ShopGuid == Goods.ShopGuid && + s.ShopGoodsCategoryParentGuid == parentGoodsCategory.ShopGoodsCategoryGuid + ); + if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{nameArr.First()}】不存在"); + Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + } + else + { + // 找出当前类目 + var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == Goods.GoodsCategoryName && + s.ShopGuid == Goods.ShopGuid + ); + if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{Goods.GoodsCategoryName}】不存在"); + Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + } // 配送模板 diff --git a/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs new file mode 100644 index 0000000..0f80884 --- /dev/null +++ b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ARW.Model; +using ARW.Model.Dto.Business.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; + +namespace ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments +{ + /// + /// 商品评价接口类 + /// + /// @author admin + /// @date 2023-07-15 + /// + public interface IGoodsCommentService : IBaseService + { + /// + /// 获取商品评价分页列表 + /// + /// + /// + Task> GetGoodsCommentList(GoodsCommentQueryDto parm); + + + /// + /// 添加或修改商品评价 + /// + /// + /// + Task AddOrUpdateGoodsComment(GoodsComment parm); + + + + + /// + /// 回复 + /// + Task Recover(GoodsCommentRecoverDto parm); + + } +} diff --git a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs index 5485195..fe14bed 100644 --- a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs +++ b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs @@ -71,6 +71,10 @@ namespace ARW.WebApi.Controllers.Api.Wechat user = await _customerService.GetFirstAsync(s => s.CustomerGuid == response); } + else + { + user.CustomerLastLoginTime = DateTime.Now; + } LoginUser loginUser = new LoginUser { diff --git a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs new file mode 100644 index 0000000..2e229ef --- /dev/null +++ b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs @@ -0,0 +1,120 @@ +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.GoodsManager.GoodsComments; +using ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments; +using ARW.Admin.WebApi.Controllers; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; +using Microsoft.AspNetCore.Authorization; +using ARW.Admin.WebApi.Framework; +using ARW.Service.Business.IBusinessService.ShopManager.Shops; + + +namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价控制器 + /// + /// @author admin + /// @date 2023-07-15 + /// + [Verify] + [Route("business/[controller]")] + public class GoodsCommentController : BaseController + { + private readonly IGoodsCommentService _GoodsCommentService; + private readonly IShopService _ShopService; + + /// + /// 依赖注入 + /// + /// 商品评价服务 + public GoodsCommentController(IGoodsCommentService GoodsCommentService, IShopService shopService) + { + _GoodsCommentService = GoodsCommentService; + _ShopService = shopService; + } + + + /// + /// 获取商品评价列表 + /// + /// 查询参数 + /// + [HttpGet("getGoodsCommentList")] + [ActionPermissionFilter(Permission = "business:goodscomment:list")] + public async Task GetGoodsCommentList([FromQuery] GoodsCommentQueryDto parm) + { + var user = JwtUtil.GetLoginUser(App.HttpContext); + if (user.UserId != 1) + { + var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId); + if (shop == null) throw new Exception("当前用户没有店铺"); + parm.ShopGuid = shop.ShopGuid; + } + + var res = await _GoodsCommentService.GetGoodsCommentList(parm); + return SUCCESS(res); + } + + /// + /// 添加或修改商品评价 + /// + /// + /// + [HttpPost("addOrUpdateGoodsComment")] + [ActionPermissionFilter(Permission = "business:goodscomment:addOrUpdate")] + [Log(Title = "添加或修改商品评价", BusinessType = BusinessType.ADDORUPDATE)] + public async Task AddOrUpdateGoodsComment([FromBody] GoodsCommentDto parm) + { + if (parm == null) { throw new CustomException("请求参数错误"); } + + var modal = new GoodsComment(); + if (parm.GoodsCommentId != 0) modal = parm.Adapt().ToUpdate(HttpContext); + else modal = parm.Adapt().ToCreate(HttpContext); + + var res = await _GoodsCommentService.AddOrUpdateGoodsComment(modal); + return SUCCESS(res); + } + + /// + /// 删除商品评价 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:goodscomment: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 = _GoodsCommentService.Delete(idsArr); + return SUCCESS("删除成功!"); + } + + + + /// + /// 回复商品评价 + /// + /// + [HttpPut("recover")] + [ActionPermissionFilter(Permission = "business:goodscomment:recover")] + public async Task RecoverGoodsComment([FromBody] GoodsCommentRecoverDto param) + { + var res = await _GoodsCommentService.Recover(param); + return SUCCESS(res); + } + + + + } +} diff --git a/ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx b/ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx new file mode 100644 index 0000000..6eec5ae Binary files /dev/null and b/ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx differ