Commit aaafd0d6 authored by liudong1993's avatar liudong1993

订单评价+批量发货

parent 3769945d
......@@ -187,6 +187,7 @@ namespace Mall.CacheManager.User
Name = umodel.Name,
OpenId = umodel.OpenId,
Photo = umodel.Photo,
Source = umodel.Source,
SecretKey = umodel.SecretKey,
SuperiorId = umodel.SuperiorId ?? 0,
Token = token
......
using System;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -71,6 +72,15 @@ namespace Mall.Common
/// </summary>
public string Photo { get; set; }
/// <summary>
/// 来源 1微信 2支付宝
/// </summary>
public UserSourceEnum? Source
{
get;
set;
}
/// <summary>
/// 商城名称
/// </summary>
......
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.Goods
{
/// <summary>
/// 商品评论类型枚举
/// </summary>
public enum GoodsCommentTypeEnum
{
/// <summary>
/// 好评
/// </summary>
[EnumField("好评")]
Praise = 1,
/// <summary>
/// 中评
/// </summary>
[EnumField("中评")]
Medium = 2,
/// <summary>
/// 差评
/// </summary>
[EnumField("差评")]
Negative = 3
}
}

using Mall.Model.Extend.Product;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Mall.DataHelper
{
public class SendGoodsBetchDataHelper
{
/// <summary>
/// 导入模板
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static List<RB_Goods_OrderExpress_Extend> ImportClaimData(string fileName)
{
List<RB_Goods_OrderExpress_Extend> list = new List<RB_Goods_OrderExpress_Extend>();
var dt = Mall.Common.Plugin.NPOIHelper.ImportExceltoDt(fileName, 0, 0, true);
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
list.Add(DataRowToModel(dr));
}
}
return list;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
public static RB_Goods_OrderExpress_Extend DataRowToModel(DataRow dr)
{
RB_Goods_OrderExpress_Extend model = new RB_Goods_OrderExpress_Extend();
if (dr != null)
{
if (dr.Table.Columns.Contains("订单号") && !string.IsNullOrEmpty(dr["订单号"].ToString().Trim()))
{
model.OrderNo = dr["订单号"].ToString().Trim();
}
if (dr.Table.Columns.Contains("快递单号") && !string.IsNullOrEmpty(dr["快递单号"].ToString().Trim()))
{
model.ExpressNumber = dr["快递单号"].ToString().Trim();
}
}
return model;
}
}
}
\ No newline at end of file
......@@ -4,12 +4,6 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Import\**" />
<EmbeddedResource Remove="Import\**" />
<None Remove="Import\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.4" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
......
using Mall.Common.AOP;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品订评论表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Comment
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId
{
get;
set;
}
/// <summary>
/// 客人名称
/// </summary>
public string UserName
{
get;
set;
}
/// <summary>
/// 用户头像
/// </summary>
public int? UserPhoto
{
get;
set;
}
/// <summary>
/// 评论类型 1 好评 2中评 3差评
/// </summary>
public GoodsCommentTypeEnum? CommentGrade
{
get;
set;
}
/// <summary>
/// 评论内容
/// </summary>
public string Content
{
get;
set;
}
/// <summary>
/// 评论图片
/// </summary>
public string CommentImage
{
get;
set;
}
/// <summary>
/// 回复
/// </summary>
public string Reply
{
get;
set;
}
/// <summary>
/// 来源
/// </summary>
public UserSourceEnum? PlatformSource
{
get;
set;
}
/// <summary>
/// 是否置顶 1是 2否
/// </summary>
public int? Is_Top
{
get;
set;
}
/// <summary>
/// 是否显示 1是 2否
/// </summary>
public int? Is_Show
{
get;
set;
}
/// <summary>
/// 是否匿名 1是 2否
/// </summary>
public int? Is_Anonymity
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品订评论模板表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_CommentTemplate
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 模板名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 模板内容
/// </summary>
public string Content
{
get;
set;
}
/// <summary>
/// 评论类型 1好评 2中评 3差评
/// </summary>
public GoodsCommentTypeEnum? CommentGrade
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品评论模板表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_CommentTemplate_Extend : RB_Goods_CommentTemplate
{
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品评论表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Comment_Extend : RB_Goods_Comment
{
/// <summary>
/// 商品图片
/// </summary>
public string CarouselImage { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImage { get; set; }
/// <summary>
/// 评论图片列表
/// </summary>
public List<string> CommentImgList { get; set; }
/// <summary>
/// 头像路径
/// </summary>
public string UserPhotoPath { get; set; }
/// <summary>
/// 评论数量
/// </summary>
public int CommentNum { get; set; }
}
}
......@@ -22,6 +22,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int? OrderId { get;set;}
/// <summary>
/// 订单号
/// </summary>
public string OrderNo { get; set; }
/// <summary>
/// 订单快递ids
/// </summary>
public string OrderExpressIds { get; set; }
......
......@@ -18,6 +18,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public string OrderIds { get; set; }
/// <summary>
/// 订单号s
/// </summary>
public string orderNos { get; set; }
/// <summary>
/// 是否来自购物车 1是 2否
/// </summary>
public int? IsFormShoppingCart { get; set; }
......
This diff is collapsed.
......@@ -2034,7 +2034,6 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.SeparateDistribution),demodel.SeparateDistribution},
{ nameof(RB_Goods.SeparateDistributionType),demodel.SeparateDistributionType},
{ nameof(RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType},
{ nameof(RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType},
{ nameof(RB_Goods.SeparateSetMember),demodel.SeparateSetMember},
{ nameof(RB_Goods.IsQuickBuy),demodel.IsQuickBuy}
};
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品评论仓储层
/// </summary>
public class RB_Goods_CommentRepository : RepositoryBase<RB_Goods_Comment>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetPageList(int pageIndex, int pageSize, out long count, RB_Goods_Comment_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Id)}={dmodel.Id}";
}
if (dmodel.CommentGrade > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.CommentGrade)}={(int)dmodel.CommentGrade}";
}
if (dmodel.PlatformSource > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.PlatformSource)}={(int)dmodel.PlatformSource}";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and c.{nameof(RB_Goods_Comment.UserName)} like '%{dmodel.UserName}%'";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and g.{nameof(RB_Goods.Name)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content))
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"SELECT c.*,g.Name as GoodsName,g.CarouselImage FROM RB_Goods_Comment c
left join rb_goods g on c.GoodsId = g.Id
where {where} order by c.Id desc";
return GetPage<RB_Goods_Comment_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetAppletPageList(int pageIndex, int pageSize, out long count, RB_Goods_Comment_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Id)}={dmodel.Id}";
}
if (dmodel.CommentGrade > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.CommentGrade)}={(int)dmodel.CommentGrade}";
}
if (dmodel.GoodsId > 0) {
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={dmodel.GoodsId}";
}
if (dmodel.PlatformSource > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.PlatformSource)}={(int)dmodel.PlatformSource}";
}
if (dmodel.Is_Show > 0) {
where += $@" and c.{nameof(RB_Goods_Comment.Is_Show)}={dmodel.Is_Show}";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and c.{nameof(RB_Goods_Comment.UserName)} like '%{dmodel.UserName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content))
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"SELECT c.* FROM RB_Goods_Comment c where {where} order by c.Is_Top asc,c.Id desc";
return GetPage<RB_Goods_Comment_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取评论数量统计
/// </summary>
/// <param name="goodsId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetAppletGoodsCommentStatistics(int goodsId, int tenantId, int mallBaseId)
{
string where = $" 1=1 and c.{nameof(RB_Goods_Comment.Is_Show)}=1";
if (tenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={tenantId}";
}
if (mallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={mallBaseId}";
}
if (goodsId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={goodsId}";
}
string sql = $@"SELECT c.CommentGrade,COUNT(0) as CommentNum FROM RB_Goods_Comment c where {where} GROUP BY c.CommentGrade";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品评论模板仓储层
/// </summary>
public class RB_Goods_CommentTemplateRepository : RepositoryBase<RB_Goods_CommentTemplate>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_CommentTemplate_Extend> GetPageList(int pageIndex, int pageSize, out long count, RB_Goods_CommentTemplate_Extend dmodel)
{
string where = $" 1=1 and Status =0 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_CommentTemplate.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_CommentTemplate.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Goods_CommentTemplate.Id)}={dmodel.Id}";
}
if (dmodel.CommentGrade > 0)
{
where += $@" and {nameof(RB_Goods_CommentTemplate.CommentGrade)}={(int)dmodel.CommentGrade}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Goods_CommentTemplate.Name)} like '%{dmodel.Name}%'";
}
string sql = $@"SELECT * FROM RB_Goods_CommentTemplate where {where} order by Id desc";
return GetPage<RB_Goods_CommentTemplate_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
......@@ -133,6 +133,9 @@ where {where} group by o.OrderId order by o.CreateDate desc";
if (!string.IsNullOrEmpty(dmodel.OrderIds)) {
where += $@" and o.{nameof(RB_Goods_Order.OrderId)} in({dmodel.OrderIds})";
}
if (!string.IsNullOrEmpty(dmodel.orderNos)) {
where += $@" and o.{nameof(RB_Goods_Order.OrderNo)} in({dmodel.orderNos})";
}
string sql = $@"SELECT o.* FROM rb_goods_order o
where {where} group by o.OrderId asc";
......

using Microsoft.AspNetCore.Mvc;
using System;
using System.IO;
using Microsoft.AspNetCore.Cors;
using System.Collections.Generic;
using System.Linq;
using Mall.WebApi.Filter;
using Mall.Common.API;
using Mall.Common.Plugin;
namespace Mall.WebApi.Controllers.File
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class FileController : ControllerBase
{
/// <summary>
/// 上传文件到本地临时文件
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult LocalFileUploadImport()
{
try
{
var files = Request.Form.Files;
if (files.Count == 0)
{
return new ApiResult { resultCode = (int)ResultCode.Fail, message = "未选择文件", data = "" };
}
string filename = files[0].FileName;
string fileExtention = System.IO.Path.GetExtension(files[0].FileName);
//验证文件格式
List<string> ExtList = new List<string>() {
".xls",
".xlsx"
};
if (!ExtList.Contains(fileExtention)) {
return new ApiResult { resultCode = (int)ResultCode.Fail, message = "文件格式有误", data = "" };
}
string path = Guid.NewGuid().ToString() + fileExtention;
string basepath = AppContext.BaseDirectory;
string path_server = basepath + "\\upfile\\temporary\\" + path;
if (!Directory.Exists(basepath + "\\upfile\\temporary"))
{
Directory.CreateDirectory(basepath + "\\upfile\\temporary");
}
using (FileStream fstream = new FileStream(path_server, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
files[0].CopyTo(fstream);
}
return ApiResult.Success("", path_server);
}
catch (Exception ex)
{
LogHelper.Write(ex, "LocalFileUploadImport");
return ApiResult.Failed();
}
}
}
}
......@@ -402,6 +402,10 @@ namespace Mall.WebApi.Controllers.MallBase
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
#endregion
#region 订单售后
/// <summary>
/// 获取我的订单商品售后申请页面 订单信息
/// </summary>
......@@ -567,5 +571,104 @@ namespace Mall.WebApi.Controllers.MallBase
}
#endregion
#region 订单评价
/// <summary>
/// 获取商品评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsCommentPageList()
{
var parms = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(parms.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.Is_Show = 1;
var list = orderModule.GetAppletGoodsCommentPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.UserId,
UserName =x.Is_Anonymity==1?"匿名用户": x.UserName,
UserPhotoPath = x.UserPhotoPath??"",
x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(),
x.CommentImgList,
x.Content,
x.Reply,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取商品评论统计
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsCommentStatistics() {
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
return orderModule.GetAppletGoodsCommentStatistics(GoodsId, userInfo.TenantId, userInfo.MallBaseId);
}
/// <summary>
/// 用户新增评论
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsCommentInfo()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(req.msg.ToString());
if ((demodel.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品");
}
if (string.IsNullOrEmpty(demodel.Content))
{
return ApiResult.ParamIsNull("请输入评价内容");
}
if (!demodel.CommentGrade.HasValue)
{
return ApiResult.ParamIsNull("请选择评分");
}
demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 2;
demodel.Is_Anonymity ??= 2;
demodel.UserId ??= 0;
demodel.Reply ??= "";
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
demodel.UserName = userInfo.Name;
demodel.PlatformSource = userInfo.Source;
demodel.Status = 0;
demodel.UpdateDate = DateTime.Now;
bool flag = orderModule.SetGoodsCommentInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
#endregion
}
}
\ No newline at end of file
......@@ -1387,6 +1387,235 @@ namespace Mall.WebApi.Controllers.MallBase
}
#endregion
#region 订单评论
/// <summary>
/// 获取评论模板分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsCommentTemplatePageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_CommentTemplate_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_CommentTemplate_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetGoodsCommentTemplatePageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Content,
x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(),
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 新增修改模板
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsCommentTemplateInfo() {
var req = RequestParm;
RB_Goods_CommentTemplate_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_CommentTemplate_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) {
return ApiResult.ParamIsNull("请输入模板名称");
}
if (string.IsNullOrEmpty(demodel.Content)) {
return ApiResult.ParamIsNull("请输入模板内容");
}
if (!demodel.CommentGrade.HasValue) {
return ApiResult.ParamIsNull("请选择模板类型");
}
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.Status = 0;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag = orderModule.SetGoodsCommentTemplateInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 删除评论模板
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelGoodsCommentTemplateInfo() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int TemplateId = parms.GetInt("TemplateId", 0);
if (TemplateId <= 0) {
return ApiResult.ParamIsNull();
}
bool flag = orderModule.DelGoodsCommentTemplateInfo(TemplateId, req.TenantId, req.MallBaseId);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 获取商品评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsCommentPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetGoodsCommentPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.UserId,
x.UserName,
x.GoodsId,
x.GoodsName,
x.CoverImage,
x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(),
x.CommentImgList,
x.Content,
x.Reply,
x.Is_Top,
x.Is_Show,
x.Is_Anonymity,
x.PlatformSource,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 管理新增评论
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsCommentInfo() {
var req = RequestParm;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.UserName)) {
return ApiResult.ParamIsNull("请输入用户名称");
}
if (!demodel.CreateDate.HasValue) {
return ApiResult.ParamIsNull("请输入评论时间");
}
if ((demodel.GoodsId ?? 0) <= 0) {
return ApiResult.ParamIsNull("请选择商品");
}
if (string.IsNullOrEmpty(demodel.Content)) {
return ApiResult.ParamIsNull("请输入评价内容");
}
if (!demodel.CommentGrade.HasValue) {
return ApiResult.ParamIsNull("请选择评分");
}
demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any()) {
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 2;
demodel.Is_Anonymity ??= 2;
demodel.UserId ??= 0;
demodel.Reply ??= "";
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.Status = 0;
demodel.UpdateDate = DateTime.Now;
bool flag = orderModule.SetGoodsCommentInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 批量操作
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsCommentBatch() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string CommentIds = parms.GetStringValue("CommentIds");
int Type = parms.GetInt("Type", 1);//1批量回复 2批量隐藏 3批量显示 4批量置顶 5取消置顶 6批量删除
string Content = parms.GetStringValue("Content");
if (string.IsNullOrEmpty(CommentIds)) {
return ApiResult.ParamIsNull();
}
if (Type == 1) {
if (string.IsNullOrEmpty(Content)) {
return ApiResult.ParamIsNull("回复内容不能为空");
}
}
bool flag = orderModule.SetGoodsCommentBatch(CommentIds, Type, Content, req.TenantId, req.MallBaseId);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 获取商品评价类型枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsCommentTypeEnumList()
{
var list = EnumHelper.GetEnumList(typeof(GoodsCommentTypeEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
#endregion
#region 订单批量发货
/// <summary>
/// 批量发货
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetOrderBatchSendGoods() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string FilePath = parms.GetStringValue("FilePath");
int ExpressId = parms.GetInt("ExpressId", 0);
if (string.IsNullOrEmpty(FilePath)) {
return ApiResult.ParamIsNull("文件路径不存在");
}
if (ExpressId <= 0) {
return ApiResult.ParamIsNull("请选择快递id");
}
string msg = orderModule.SetOrderBatchSendGoods(FilePath, ExpressId, req.TenantId, req.MallBaseId);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
#endregion
}
}
\ No newline at end of file
......@@ -1471,24 +1471,47 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请传递分销佣金列表");
}
//普通设置 直接根据等级验证数量
if (DGradeList.Count() * TotalNum != demodel.DistributionCommissionList.Count())
{
return ApiResult.ParamIsNull("分销佣金列表数量不正确");
//转换
List<RB_Goods_DistributionCommission_Extend> Rlist = new List<RB_Goods_DistributionCommission_Extend>();
foreach (var item in demodel.DistributionCommissionList) {
if (item.GradeCommissionList == null || !item.GradeCommissionList.Any()) {
return ApiResult.ParamIsNull("请传递分销佣金列表");
}
foreach (var qitem in item.GradeCommissionList) {
Rlist.Add(new RB_Goods_DistributionCommission_Extend()
{
DistributorGrade = qitem.DistributorGrade,
Id = 0,
SpecificationSort = item.SpecificationSort,
OneCommission = qitem.OneCommission,
TwoCommission = qitem.TwoCommission,
ThreeCommission = qitem.ThreeCommission
});
}
}
if (Rlist.Any()) {
demodel.DistributionCommissionList = Rlist;
}
foreach (var item in DGradeList)
if (demodel.SeparateDistributionType == 1)
{
var gradeList = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).ToList();
if (!gradeList.Any())
//普通设置 直接根据等级验证数量
if (DGradeList.Count() != demodel.DistributionCommissionList.Count())
{
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表不存在");
return ApiResult.ParamIsNull("分销佣金列表数量不正确");
}
if (gradeList.Count() != TotalNum) {
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表数量不正确");
}
foreach (var qitem in KeyList) {
string keys = qitem[1..];
var gcmodel = gradeList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
foreach (var item in DGradeList)
{
var gradeList = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).ToList();
if (!gradeList.Any())
{
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表不存在");
}
if (gradeList.Count() != TotalNum)
{
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表数量不正确");
}
var gcmodel = gradeList.Where(x => x.SpecificationSort == "").FirstOrDefault();
if (gcmodel == null)
{
return ApiResult.ParamIsNull("分销Key有误");
......@@ -1498,6 +1521,38 @@ namespace Mall.WebApi.Controllers.MallBase
gcmodel.ThreeCommission ??= 0;
}
}
else
{
//普通设置 直接根据等级验证数量
if (DGradeList.Count() * TotalNum != demodel.DistributionCommissionList.Count())
{
return ApiResult.ParamIsNull("分销佣金列表数量不正确");
}
foreach (var item in DGradeList)
{
var gradeList = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).ToList();
if (!gradeList.Any())
{
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表不存在");
}
if (gradeList.Count() != TotalNum)
{
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表数量不正确");
}
foreach (var qitem in KeyList)
{
string keys = qitem[1..];
var gcmodel = gradeList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
if (gcmodel == null)
{
return ApiResult.ParamIsNull("分销Key有误");
}
gcmodel.OneCommission ??= 0;
gcmodel.TwoCommission ??= 0;
gcmodel.ThreeCommission ??= 0;
}
}
}
}
//会员价格
......@@ -1515,6 +1570,30 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请传递会员价格列表");
}
//转换
List<RB_Goods_MemberPrice_Extend> Rlist = new List<RB_Goods_MemberPrice_Extend>();
foreach (var item in demodel.MemberPriceList)
{
if (item.GradePriceList == null || !item.GradePriceList.Any())
{
return ApiResult.ParamIsNull("请传递会员价格列表");
}
foreach (var qitem in item.GradePriceList)
{
Rlist.Add(new RB_Goods_MemberPrice_Extend()
{
MemberGrade = qitem.MemberGrade,
Id = 0,
SpecificationSort = item.SpecificationSort,
MemberPrice = qitem.MemberPrice
});
}
}
if (Rlist.Any())
{
demodel.MemberPriceList = Rlist;
}
//普通设置 直接根据等级验证数量
if (MGradeList.Count() * TotalNum != demodel.MemberPriceList.Count())
{
......
......@@ -123,6 +123,7 @@ namespace Mall.WebApi.Controllers.User
Name = demodel.Name,
OpenId = demodel.OpenId,
Photo = demodel.Photo,
Source = demodel.Source,
SecretKey = demodel.SecretKey,
SuperiorId = demodel.SuperiorId ?? 0,
Token = token
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment