Commit f655cc0e authored by liudong1993's avatar liudong1993

小程序榜单

parent c687a920
......@@ -47,13 +47,18 @@ namespace Mall.Model.Entity.TradePavilion
/// <summary>
/// 报名截止日期
/// </summary>
public DateTime DeadlineDate { get; set; }
public DateTime EndDate { get; set; }
/// <summary>
/// 公示日期
/// 报名开始日期
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// 放榜日期
/// </summary>
public DateTime FinishDate { get; set; }
/// <summary>
/// 详细内容
/// </summary>
......
......@@ -19,6 +19,11 @@ namespace Mall.Model.Entity.TradePavilion
/// </summary>
public int Id { get; set; }
/// <summary>
/// 榜单Id
/// </summary>
public int ListId { get; set; }
/// <summary>
/// 用户id
/// </summary>
......@@ -29,6 +34,11 @@ namespace Mall.Model.Entity.TradePavilion
/// </summary>
public ListObjectTypeEnum ObjectType { get; set; }
/// <summary>
/// 品牌/载体id
/// </summary>
public int ObjectId { get; set; }
/// <summary>
/// 表单内容
/// </summary>
......@@ -79,18 +89,13 @@ namespace Mall.Model.Entity.TradePavilion
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 修改人
/// 操作人 - 后台empId
/// </summary>
public int UpdateBy { get; set; }
......
......@@ -12,6 +12,11 @@ namespace Mall.Model.Extend.TradePavilion
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 品牌ids查询
/// </summary>
public string BrandIds { get; set; }
public List<string> BannerList { get; set; }
......
......@@ -13,6 +13,11 @@ namespace Mall.Model.Extend.TradePavilion
/// </summary>
public List<RB_CarrierMetro_Extend> CarrierMetroList { get; set; }
/// <summary>
/// 载体ids查询
/// </summary>
public string CarrierIds { get; set; }
/// <summary>
/// 介绍图
/// </summary>
......
......@@ -17,5 +17,15 @@ namespace Mall.Model.Extend.TradePavilion
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 品牌/载体名称
/// </summary>
public string ObjectName { get; set; }
/// <summary>
/// 品牌/载体图标
/// </summary>
public string ObjectIcon { get; set; }
}
}
......@@ -22,5 +22,30 @@ namespace Mall.Model.Extend.TradePavilion
/// 面向群里id
/// </summary>
public int ObjectTypeId { get; set; }
/// <summary>
/// 小程序端状态 1进行中 , 2报名已截止 , 3已放榜
/// </summary>
public int State { get; set; }
/// <summary>
/// 排序 1根据报名截止日期
/// </summary>
public int OrderBy { get; set; }
/// <summary>
/// 是否查询正常的 1是
/// </summary>
public int IsAppletSelectNor { get; set; }
/// <summary>
/// 报名
/// </summary>
public List<RB_FirstShop_ListEnroll_Extend> EnrollList { get; set; }
/// <summary>
/// 上榜列表
/// </summary>
public List<RB_FirstShop_ListEnroll_Extend> RankList { get; set; }
}
}
......@@ -75,13 +75,17 @@ where {where} order by w.Id desc
{
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.ListId > 0)
{
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.ListId)}={dmodel.ListId}";
}
if (dmodel.UserId > 0)
{
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.UserId)}={dmodel.UserId}";
}
if (dmodel.ObjectType > 0)
{
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.ObjectType)}={dmodel.ObjectType}";
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.ObjectType)}={(int)dmodel.ObjectType}";
}
if (dmodel.CandidateState > 0)
{
......
......@@ -47,12 +47,13 @@ namespace Mall.Repository.TradePavilion
if (dmodel.ListState == Common.Enum.TradePavilion.ListStateEnum.Enroll)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)}={(int)Common.Enum.TradePavilion.ListStateEnum.Enroll}";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.DeadlineDate)} >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.StartDate)} <='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.EndDate)} >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
}
else if (dmodel.ListState == Common.Enum.TradePavilion.ListStateEnum.Rating)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)}={(int)Common.Enum.TradePavilion.ListStateEnum.Enroll}";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.DeadlineDate)} <'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.EndDate)} <'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
}
else {
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)}={(int)dmodel.ListState}";
......@@ -68,10 +69,19 @@ namespace Mall.Repository.TradePavilion
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListName)} @ListName";
parameters.Add("ListName", "%" + dmodel.ListName + "%");
}
if (dmodel.IsAppletSelectNor == 1) {
//小程序端查询
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)} <>{(int)Common.Enum.TradePavilion.ListStateEnum.Cancel}";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.StartDate)} <='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
}
string orderBy = " order by w.Id desc";
if (dmodel.OrderBy == 1) {
orderBy = " order by w.EndDate desc";//根据报名截止日期
}
string sql = $@"select w.* from RB_FirstShop_List w
where {where} order by w.Id desc
where {where} {orderBy}
";
return GetPage<RB_FirstShop_List_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
......@@ -106,12 +116,13 @@ where {where} order by w.Id desc
if (dmodel.ListState == Common.Enum.TradePavilion.ListStateEnum.Enroll)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)}={(int)Common.Enum.TradePavilion.ListStateEnum.Enroll}";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.DeadlineDate)} >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.StartDate)} >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.EndDate)} <='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
}
else if (dmodel.ListState == Common.Enum.TradePavilion.ListStateEnum.Rating)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.ListState)}={(int)Common.Enum.TradePavilion.ListStateEnum.Enroll}";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.DeadlineDate)} <'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
where += $@" and w.{nameof(RB_FirstShop_List_Extend.EndDate)} <'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
}
else
{
......@@ -136,5 +147,36 @@ where {where} order by w.Id desc
return Get<RB_FirstShop_List_Extend>(sql, parameters).ToList();
}
/// <summary>
/// 获取小程序 我的报名榜单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_FirstShop_List_Extend> GetAppletMyEnrollFistShopListPageList(int pageIndex, int pageSize, out long count, RB_FirstShop_List_Extend dmodel)
{
var parameters = new DynamicParameters();
string where = $" 1=1 and w.Status =0 and e.Status =0 and w.ListState <>{(int)Common.Enum.TradePavilion.ListStateEnum.Cancel}";
if (dmodel.TenantId > 0)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and w.{nameof(RB_FirstShop_List_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.CreateBy > 0)
{
where += $@" and w.{nameof(RB_FirstShop_ListEnroll_Extend.UserId)}={dmodel.CreateBy}";
}
string sql = $@"select w.* from RB_FirstShop_List w
left join rb_firstshop_listenroll e on w.Id = e.ListId
where {where} group by w.Id order by w.EndDate desc
";
return GetPage<RB_FirstShop_List_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
}
}
\ No newline at end of file
......@@ -84,6 +84,10 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </summary>
private readonly Module.User.MiniProgramModule programModule = new Module.User.MiniProgramModule();
/// <summary>
/// 榜单
/// </summary>
private readonly FirstShopListModule firstShopListModule = new FirstShopListModule();
/// <summary>
/// 心愿单
/// </summary>
private readonly FirstShopWishModule firstShopWishModule = new FirstShopWishModule();
......@@ -1793,6 +1797,230 @@ namespace Mall.WebApi.Controllers.TradePavilion
}
#endregion
#region 榜单管理
/// <summary>
/// 获取榜单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletFirstShopListPageList()
{
var userInfo = base.AppletUserInfo;
var req = base.RequestParm;
ResultPageModel pageModel = JsonHelper.DeserializeObject<ResultPageModel>(req.msg.ToString());
RB_FirstShop_List_Extend demodel = JsonHelper.DeserializeObject<RB_FirstShop_List_Extend>(req.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.IsAppletSelectNor = 1;
demodel.OrderBy = 1;
var list = firstShopListModule.GetAppletFirstShopListPageList(pageModel.pageIndex, pageModel.pageSize, out long count, demodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.ListType,
ListTypeName = x.ListType.GetEnumName(),
x.ObjectTypeList,
x.Sponsor,
x.ListName,
x.CoverImage,
EndDate = x.EndDate.ToString("yyyy-MM-dd"),
StartDate = x.StartDate.ToString("yyyy-MM-dd"),
FinishDate = x.FinishDate.ToString("yyyy-MM-dd HH:mm"),
x.PrizeNum,
x.State
}));
}
/// <summary>
/// 获取榜单详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletFistShopListInfo()
{
var userInfo = base.AppletUserInfo;
var req = base.RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int ListId = parms.GetInt("ListId", 0);//榜单id
if (ListId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = firstShopListModule.GetAppletFirstShopListInfo(ListId, userInfo);
if (model == null) { return ApiResult.Failed("榜单不存在"); }
return ApiResult.Success("", new
{
model.Id,
model.ListType,
model.ObjectTypeIds,
model.Sponsor,
model.ListName,
model.CoverImage,
EndDate = model.EndDate.ToString("yyyy-MM-dd"),
StartDate = model.StartDate.ToString("yyyy-MM-dd"),
FinishDate = model.FinishDate.ToString("yyyy-MM-dd HH:mm"),
model.Content,
model.EnableRank,
model.PrizeNum,
model.ListState,
EnrollList = model.EnrollList?.Select(x=>new {
x.Id,
x.UserId,
x.UserName,
x.ObjectType,
ObjectTypeName = x.ObjectType.GetEnumName(),
x.ObjectId,
x.ObjectName,
x.ObjectIcon,
x.Content
}),
RankList = model.RankList?.Select(x=>new {
x.Id,
x.UserId,
x.UserName,
x.ObjectId,
x.ObjectType,
ObjectTypeName = x.ObjectType.GetEnumName(),
x.ObjectName,
x.ObjectIcon,
x.Reviews,
x.Rank,
x.MedalImage,
x.MedalImageBig
})
});
}
/// <summary>
/// 获取我的可报名的品牌载体
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletMyBrandCarrierList() {
var userInfo = base.AppletUserInfo;
JObject parms = JObject.Parse(base.RequestParm.msg.ToString());
int ListId = parms.GetInt("ListId", 0);//榜单id
int EnrollId = parms.GetInt("EnrollId", 0);//报名Id
if (ListId <= 0) {
return ApiResult.ParamIsNull();
}
var list = firstShopListModule.GetAppletMyBrandCarrierList(ListId, EnrollId, userInfo);
return ApiResult.Success("", list);
}
/// <summary>
/// 榜单报名
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetAppletFirstShopListInfo() {
var userInfo = base.AppletUserInfo;
RB_FirstShop_ListEnroll_Extend demodel = JsonHelper.DeserializeObject<RB_FirstShop_ListEnroll_Extend>(base.RequestParm.msg.ToString());
if (demodel.ListId <= 0) {
return ApiResult.ParamIsNull("请传递榜单id");
}
if (demodel.ObjectType <= 0) {
return ApiResult.ParamIsNull("请传递类型");
}
if (demodel.ObjectId <= 0) {
return ApiResult.ParamIsNull("请传递品牌载体id");
}
if (string.IsNullOrEmpty(demodel.Content)) {
return ApiResult.ParamIsNull("请传递表单内容");
}
demodel.UserId = userInfo.UserId;
demodel.CandidateState = 1;
demodel.RankListState = 2;
demodel.Status = 0;
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
string msg = firstShopListModule.SetAppletFirstShopListInfo(demodel);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 取消报名
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancelAppletFirstShopListInfo() {
var userInfo = base.AppletUserInfo;
JObject parms = JObject.Parse(base.RequestParm.msg.ToString());
int EnrollId = parms.GetInt("EnrollId", 0);//报名Id
if (EnrollId <= 0)
{
return ApiResult.ParamIsNull();
}
string msg = firstShopListModule.CancelAppletFirstShopListInfo(EnrollId, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 获取榜单类型枚举列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetListTypeEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.TradePavilion.ListTypeEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取我报名的榜单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletMyEnrollFistShopListPageList() {
var userInfo = base.AppletUserInfo;
var req = base.RequestParm;
ResultPageModel pageModel = JsonHelper.DeserializeObject<ResultPageModel>(req.msg.ToString());
RB_FirstShop_List_Extend demodel = JsonHelper.DeserializeObject<RB_FirstShop_List_Extend>(req.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
var list = firstShopListModule.GetAppletMyEnrollFistShopListPageList(pageModel.pageIndex, pageModel.pageSize, out long count, demodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.ListType,
ListTypeName = x.ListType.GetEnumName(),
x.Sponsor,
x.ListName,
x.CoverImage,
EndDate = x.EndDate.ToString("yyyy-MM-dd"),
StartDate = x.StartDate.ToString("yyyy-MM-dd"),
FinishDate = x.FinishDate.ToString("yyyy-MM-dd HH:mm"),
x.PrizeNum
}));
}
#endregion
#region 公司信息(管理端)
/// <summary>
......
......@@ -1817,8 +1817,9 @@ namespace Mall.WebApi.Controllers.TradePavilion
x.Sponsor,
x.ListName,
x.CoverImage,
DeadlineDate = x.DeadlineDate.ToString("yyyy-MM-dd HH:mm"),
StartDate = x.StartDate.ToString("yyyy-MM-dd HH:mm"),
EndDate = x.EndDate.ToString("yyyy-MM-dd"),
StartDate = x.StartDate.ToString("yyyy-MM-dd"),
FinishDate = x.FinishDate.ToString("yyyy-MM-dd HH:mm"),
x.Content,
x.EnableRank,
x.PrizeNum,
......@@ -1851,8 +1852,9 @@ namespace Mall.WebApi.Controllers.TradePavilion
model.Sponsor,
model.ListName,
model.CoverImage,
DeadlineDate = model.DeadlineDate.ToString("yyyy-MM-dd HH:mm"),
StartDate = model.StartDate.ToString("yyyy-MM-dd HH:mm"),
EndDate = model.EndDate.ToString("yyyy-MM-dd"),
StartDate = model.StartDate.ToString("yyyy-MM-dd"),
FinishDate = model.FinishDate.ToString("yyyy-MM-dd HH:mm"),
model.Content,
model.EnableRank,
model.PrizeNum,
......@@ -1887,6 +1889,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
return ApiResult.ParamIsNull("请输入入围名额");
}
demodel.EndDate = Convert.ToDateTime(demodel.EndDate.ToString("yyyy-MM-dd") + " 23:59:59");
demodel.ListState = Common.Enum.TradePavilion.ListStateEnum.Enroll;
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
......
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