Commit 30530b7f authored by 吴春's avatar 吴春

提交代码

parent a6f0e473
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.User
{
/// <summary>
/// 供应商
/// </summary>
public class RB_SupplierRepository:RepositoryBase<RB_Supplier>
{
public string TableName { get { return nameof(RB_Supplier); } }
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Supplier_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Supplier_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Supplier.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Supplier.MallBaseId)}={dmodel.MallBaseId}";
}
string sql = $@"select * from {TableName} where {where} order by Id desc";
return GetPage<RB_Supplier_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Supplier_Extend> GetList(RB_Supplier_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and a.{nameof(RB_Supplier.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and a.{nameof(RB_Supplier.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.ID > 0)
{
where += $@" and a.{nameof(RB_Supplier.ID)}={dmodel.ID}";
}
string sql = $@"select * from {TableName} where {where} order by Id desc";
return Get<RB_Supplier_Extend>(sql).ToList();
}
}
}
......@@ -680,9 +680,10 @@ namespace Mall.WebApi.Controllers.User
x.IndateType,
StartDate = x.StartDate.HasValue ? x.StartDate.Value.ToString("yyyy-MM-dd HH:ss:mm") : "",
EndDate = x.EndDate.HasValue ? x.EndDate.Value.ToString("yyyy-MM-dd HH:ss:mm") : "",
IsReceive = x.MemberNum > 0,
UseType = ((int)x.UseType == 1 || (int)x.UseType == 4) ? x.UseType.GetEnumName() : (x.ProductList != null && x.ProductList.Any() ? string.Join("、", x.ProductList.Select(x => x.Relevance)) : "")
IsReceive = x.MemberNum > 0 ? 1 : 0,
UseTypeStr = ((int)x.UseType == 3 || (int)x.UseType == 4) ? x.UseType.GetEnumName() : (x.ProductList != null && x.ProductList.Any() ? string.Join("、", x.ProductList.Select(x => x.Relevance)) : ""),
x.UseType,
x.ProductList
});
return ApiResult.Success("", pagelist);
}
......@@ -727,6 +728,11 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.Failed("您已领取优惠券");
}
if (oldLogisticsModel.EndDate.Value < System.DateTime.Now)
{
return ApiResult.Failed("优惠券时间已过期");
}
var allMemberInfo = userModule.GetMemberUserInfo(userInfo.UserId);
//判断优惠券是否有等级限制
if (oldLogisticsModel.OnlyMember == 1)
......@@ -804,8 +810,9 @@ namespace Mall.WebApi.Controllers.User
x.MemberCouponId,
StartDate = x.StartDate.HasValue ? x.StartDate.Value.ToString("yyyy-MM-dd HH:ss:mm") : "",
EndDate = x.EndDate.HasValue ? x.EndDate.Value.ToString("yyyy-MM-dd HH:ss:mm") : "",
UseType = ((int)x.UseType == 1 || (int)x.UseType == 4) ? x.UseType.GetEnumName() : (x.ProductList != null && x.ProductList.Any() ? string.Join("、", x.ProductList.Select(x => x.Relevance)) : "")
UseTypeStr = ((int)x.UseType == 3 || (int)x.UseType == 4) ? x.UseType.GetEnumName() : (x.ProductList != null && x.ProductList.Any() ? string.Join("、", x.ProductList.Select(x => x.Relevance)) : ""),
x.UseType,
x.ProductList
});
return ApiResult.Success("", pagelist);
}
......
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