From 7f5b7f46d92d38fe538fd33aa2418e8ceef5188d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Mon, 28 Oct 2024 14:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeVolunteerInitializationController.cs | 82 +++++-------------- 1 file changed, 21 insertions(+), 61 deletions(-) diff --git a/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs b/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs index 53a6d71..9cb2330 100644 --- a/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs +++ b/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs @@ -53,74 +53,34 @@ namespace New_College.Api.Controllers Code = sysregion.Where(e => e.RegionName == c.ProvinceName).FirstOrDefault().RegionCode }).ToList(); - - - int nowyear = DateTime.Now.Year; - int month = DateTime.Now.Month; + DateTime dt = DateTime.Now; + DateTime fixedDate = new DateTime(dt.Year, 9, 1); // 创建当前年份的9月10日 + int nowyear = dt > fixedDate ? dt.Year + 1 : dt.Year; // 比较当前日期与固定日期 sevolunterlist.ForEach(a => { + var list = new List(); - if (month < 8)//大于8月份则高考时间已过,为往届高考生 + + list.Add(new LizationDto() { - //list.Add(new LizationDto() - //{ - // name = (nowyear - 1).ToString(), - // code = nowyear - 1, - // Policy = nowyear - 1 < a.Years ? 0 : a.Policy + name = nowyear.ToString() + "(现高三)", + code = nowyear, + Policy = nowyear < a.Years ? 0 : a.Policy - //}); - list.Add(new LizationDto() - { - name = nowyear.ToString() + "(现高三)", - code = nowyear, - Policy = nowyear < a.Years ? 0 : a.Policy - - }); - list.Add(new LizationDto() - { - name = (nowyear + 1).ToString() + "(现高二)", - code = nowyear + 1, - Policy = nowyear + 1 < a.Years ? 0 : a.Policy - - }); - list.Add(new LizationDto() - { - name = (nowyear + 2).ToString() + "(现高一)", - code = nowyear + 2, - Policy = nowyear + 2 < a.Years ? 0 : a.Policy - }); - - } - else + }); + list.Add(new LizationDto() { - list.Add(new LizationDto() - { - name = (nowyear).ToString(), - code = nowyear, - Policy = nowyear < a.Years ? 0 : a.Policy + name = (nowyear - 1).ToString() + "(现高二)", + code = nowyear - 1, + Policy = nowyear - 1 < a.Years ? 0 : a.Policy - }); - list.Add(new LizationDto() - { - name = (nowyear + 1).ToString() + "(现高三)", - code = nowyear + 1, - Policy = nowyear + 1 < a.Years ? 0 : a.Policy - - }); - list.Add(new LizationDto() - { - name = (nowyear + 2).ToString() + "(现高二)", - code = nowyear + 2, - Policy = nowyear + 2 < a.Years ? 0 : a.Policy - - }); - list.Add(new LizationDto() - { - name = (nowyear + 3).ToString() + "(现高一)", - code = nowyear + 3, - Policy = nowyear + 3 < a.Years ? 0 : a.Policy - }); - } + }); + list.Add(new LizationDto() + { + name = (nowyear - 2).ToString() + "(现高一)", + code = nowyear - 2, + Policy = nowyear - 2 < a.Years ? 0 : a.Policy + }); a.lizations = list; });