server/aspnetapp/Controllers/WebApi/GetOtherUserInfoController.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using aspnetapp.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace aspnetapp.Controllers.WebApi
{
[Route("api/[controller]")]
[ApiController]
public class GetOtherUserInfoController : ControllerBase
{
private readonly CounterContext _context;
public GetOtherUserInfoController(CounterContext context)
{
_context = context;
}
[HttpGet]
public async Task<ActionResult> GetOtherUserInfoAsync(string wxid)
{
BuyrUserEntity? thisu = await _context.BuyrUsers.FirstOrDefaultAsync(s => s.WeChatOpenid == wxid).ConfigureAwait(false);
DateTime now = DateTime.Now;
DateTime today = new DateTime(now.Year, now.Month, now.Day);
DateTime tomorrow = new DateTime(now.Year, now.Month, now.Day).AddDays(1);
SysSettings? syssettings = await _context.Settings.FirstOrDefaultAsync().ConfigureAwait(false);
List<OrderEntity> hasOrderList = await _context.Orders.Where(s => s.OrderStatus != (int)EnumCode.OrderStatus.已取消 && s.BuyUserWxId == thisu.WeChatOpenid && (s.OrderForDate == today || s.OrderForDate == tomorrow)).ToListAsync().ConfigureAwait(false);
List<bool> canbookCategories = new List<bool>();
List<bool> hasorderCategories = new List<bool>();
canbookCategories.Clear();
List<CategoryEntity>? cagList = await _context.Categories.Where(s => s.IsDeleted == (int)EnumCode.yesno.否).ToListAsync().ConfigureAwait(false);
#region 订餐页面
foreach (CategoryEntity category in cagList)
{
switch (category.Nameshow)
{
case "早餐":
// 早餐
if (syssettings != null)
{
// 现在{0}界于{1}和{2}之间
if (now.Date.AddDays(category.Dir.GetValueOrDefault() - 1).Add(now.TimeOfDay) >= now.Date.Add(syssettings.MCBookOPTime.ToTimeSpan()) && now.Date.AddDays(category.Dir.GetValueOrDefault() - 1).Add(now.TimeOfDay) <= now.Date.Add(syssettings.MCBookEDTime.ToTimeSpan()))
{
canbookCategories.Add(true);
}
else
{
canbookCategories.Add(false);
}
}
else
{
canbookCategories.Add(true);
}
hasorderCategories.Add(hasOrderList.Any(s => s.OrderForDate == today.AddDays(category.Dir.GetValueOrDefault()) && s.OrderType == (int)EnumCode.OrderType.早餐));
break;
case "午餐":
// 午餐
后面还有 65 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。