3.修改:将活动日期分开,
4.将线路分开,分成3个页面,每个线路一个页面 5.调整报名后查看页面可直接获取报名信息 6.增加手机号码验证页面 7.后台管理页面增加姓名,手机号码,线路,日期 查询检索
This commit is contained in:
@@ -14,6 +14,7 @@ using Furion.DataEncryption;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Furion.RemoteRequest.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
@@ -131,7 +132,7 @@ namespace Vote.Services.ApiController
|
||||
return new { success = true, token };
|
||||
}
|
||||
/// <summary>
|
||||
/// 提交
|
||||
/// 获取我的报名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
@@ -145,9 +146,16 @@ namespace Vote.Services.ApiController
|
||||
if (!string.IsNullOrEmpty(args.token))
|
||||
{
|
||||
var tokenData = JWTEncryption.ReadJwtToken(args.token);
|
||||
_ = (tokenData == null) ? throw Oops.Oh("您还没有提交过或者手机号码填写错误") : 1;
|
||||
var userId = tokenData.Claims.Where(a => a.Type == "UserId").FirstOrDefault().Value;
|
||||
entity = await repPerson.DetachedEntities.Where(a => a.Id == userId).FirstOrDefaultAsync();
|
||||
//_ = (tokenData == null) ? throw Oops.Oh("您还没有提交过或者手机号码填写错误") : 1;
|
||||
if (tokenData == null)
|
||||
{
|
||||
newToken = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var userId = tokenData.Claims.Where(a => a.Type == "UserId").FirstOrDefault().Value;
|
||||
entity = await repPerson.DetachedEntities.Where(a => a.Id == userId).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,11 +163,12 @@ namespace Vote.Services.ApiController
|
||||
var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync();
|
||||
_ = (lastSend == null || lastSend.code != args.code || lastSend.expire_time < DateTime.Now) ? throw Oops.Oh("验证码错误或已失效") : 1;
|
||||
entity = await repPerson.DetachedEntities.Where(a => a.phone == args.phone && !a.IsDeleted).FirstOrDefaultAsync();
|
||||
newToken = JWTEncryption.Encrypt(new Dictionary<string, object>()
|
||||
{
|
||||
{ "UserId", entity.Id },
|
||||
{ "Account",entity.phone }
|
||||
});
|
||||
if (entity != null)
|
||||
newToken = JWTEncryption.Encrypt(new Dictionary<string, object>()
|
||||
{
|
||||
{ "UserId", entity.Id },
|
||||
{ "Account",entity.phone }
|
||||
});
|
||||
}
|
||||
return new { success = true, entity, token = newToken };
|
||||
}
|
||||
@@ -204,5 +213,33 @@ namespace Vote.Services.ApiController
|
||||
var filepath = Tools.ExcelHelper.WriteExcelNingBoZhiChun(list);
|
||||
return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
[Route("query")]
|
||||
public async Task<dynamic> Query(NbzcQueryInput args)
|
||||
{
|
||||
List<nbzc_person> result = null;
|
||||
var iquery = repPerson.DetachedEntities.Where(a => !a.IsDeleted);
|
||||
if (args == null)
|
||||
result = await iquery.ToListAsync();
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(args.date))
|
||||
iquery = iquery.Where(a => a.date == args.date);
|
||||
if (!string.IsNullOrEmpty(args.name))
|
||||
iquery = iquery.Where(a => a.name.Contains(args.name));
|
||||
if (!string.IsNullOrEmpty(args.phone))
|
||||
iquery = iquery.Where(a => a.phone.Contains(args.phone));
|
||||
if (!string.IsNullOrEmpty(args.line))
|
||||
iquery = iquery.Where(a => a.line == args.line);
|
||||
result = await iquery.ToListAsync();
|
||||
}
|
||||
return new { success = true, result };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user