diff --git a/20220330_Vote/Ewide.Core/Ewide.Core.csproj b/20220330_Vote/Ewide.Core/Ewide.Core.csproj index c82d7e0..1a39c6b 100644 --- a/20220330_Vote/Ewide.Core/Ewide.Core.csproj +++ b/20220330_Vote/Ewide.Core/Ewide.Core.csproj @@ -1,7 +1,7 @@  - net5.0 + net5.0 1701;1702;1591 Ewide.Core.xml @@ -13,12 +13,17 @@ + + + + + @@ -32,7 +37,7 @@ - + @@ -40,11 +45,11 @@ - - - - - + + + + + @@ -62,6 +67,7 @@ + diff --git a/20220330_Vote/Ewide.Core/Ewide.Core.xml b/20220330_Vote/Ewide.Core/Ewide.Core.xml index b25a4a8..a368faa 100644 --- a/20220330_Vote/Ewide.Core/Ewide.Core.xml +++ b/20220330_Vote/Ewide.Core/Ewide.Core.xml @@ -1616,89 +1616,6 @@ 备注 - - - 定时任务 - - - - - 任务名称 - - ewide - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - - 开始时间 - - - - - 结束时间 - - null - - - - Cron表达式 - - - - - - 执行次数(默认无限循环) - - 10 - - - - 执行间隔时间,单位秒(如果有Cron,则IntervalSecond失效) - - 5 - - - - 定时器类型 - - - - - 请求url - - - - - 请求参数(Post,Put请求用) - - - - - Headers(可以包含如:Authorization授权认证) - 格式:{"Authorization":"userpassword.."} - - - - - 请求类型 - - 2 - - - - 备注 - - 用户表 @@ -6461,419 +6378,6 @@ - - - 任务调度参数 - - - - - 任务名称 - - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - 执行类型(并行、列队) - - - - - 执行间隔时间(单位秒) - - 5 - - - - Cron表达式 - - - - - 定时器类型 - - - - - 请求url - - - - - 请求参数(Post,Put请求用) - - - - - Headers(可以包含如:Authorization授权认证) - 格式:{"Authorization":"userpassword.."} - - - - - 请求类型 - - - - - 备注 - - - - - 任务名称 - - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - 执行类型(并行、列队) - - - - - 执行间隔时间(单位秒) - - 5 - - - - Cron表达式 - - - - - 定时器类型 - - - - - 请求url - - - - - 请求参数(Post,Put请求用) - - - - - Headers(可以包含如:Authorization授权认证) - 格式:{"Authorization":"userpassword.."} - - - - - 请求类型 - - - - - 备注 - - - - - 任务名称 - - dilon - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - 执行类型(并行、列队) - - - - - 执行间隔时间(单位秒) - - 5 - - - - Cron表达式 - - - - - - 定时器类型 - - - - - 请求url - - - - - 请求参数(Post,Put请求用) - - - - - Headers(可以包含如:Authorization授权认证) - 格式:{"Authorization":"userpassword.."} - - - - - 请求类型 - - 2 - - - - 备注 - - - - - 任务信息---任务详情 - - - - - Id - - - - - 已执行次数 - - - - - 定时器状态 - - - - - 异常信息 - - - - - 任务名称 - - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - 执行类型(并行、列队) - - - - - 执行间隔时间(单位秒) - - - - - Cron表达式 - - - - - 定时器类型 - - - - - 请求url - - - - - 请求类型 - - 2 - - - - 备注 - - - - - 任务方法信息 - - - - - 方法名 - - - - - 方法所属类的Type对象 - - - - - 任务名称 - - - - - 只执行一次 - - - - - 立即执行(默认等待启动) - - - - - 执行类型(并行、列队) - - - - - 执行间隔时间(单位秒) - - - - - Cron表达式 - - - - - 定时器类型 - - - - - 请求url - - - - - 请求类型 - - 2 - - - - 备注 - - - - - 任务调度服务 - - - - - 分页获取任务列表 - - - - - - - 获取所有本地任务 - - - - - - 增加任务 - - - - - - - 删除任务 - - - - - - - 修改任务 - - - - - - - 查看任务 - - - - - - - 停止任务 - - - - - - - 启动任务 - - - - - - - 新增定时任务 - - - - - - 启动自启动任务 - - - - - 获取所有本地任务 - - - AuthToken参数 diff --git a/20220330_Vote/Ewide.Core/Util/XmlSerializerUtil.cs b/20220330_Vote/Ewide.Core/Util/XmlSerializerUtil.cs index d40573a..a026c42 100644 --- a/20220330_Vote/Ewide.Core/Util/XmlSerializerUtil.cs +++ b/20220330_Vote/Ewide.Core/Util/XmlSerializerUtil.cs @@ -39,6 +39,8 @@ namespace Ewide.Core.Util //除去.xml 后缀 string className = file.Name.Remove(file.Name.Length - 4, 4); object obj = AppInfo(className); + if (obj == null) + continue; string XmlContext = StreamRead(file.FullName); //实例创建 出 类型集合 var modelList = Activator.CreateInstance(typeof(List<>).MakeGenericType(new Type[] { obj.GetType() })); diff --git a/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs b/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs index 9a79cd3..c3e916a 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs +++ b/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs @@ -27,7 +27,7 @@ namespace Ewide.EntityFramework.Core protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - optionsBuilder.UseMySql(GetDatabaseConnectionString(), ServerVersion.FromString("5.5.53")); + optionsBuilder.UseMySql(GetDatabaseConnectionString(), ServerVersion.Parse("5.5.53")); base.OnConfiguring(optionsBuilder); } diff --git a/20220330_Vote/Ewide.EntityFramework.Core/Ewide.EntityFramework.Core.csproj b/20220330_Vote/Ewide.EntityFramework.Core/Ewide.EntityFramework.Core.csproj index ab549de..8465f8a 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/Ewide.EntityFramework.Core.csproj +++ b/20220330_Vote/Ewide.EntityFramework.Core/Ewide.EntityFramework.Core.csproj @@ -23,7 +23,7 @@ - + diff --git a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json index cfe7ace..5fcf835 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json +++ b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json @@ -1,5 +1,5 @@ { - //DefaultConnectionڵ㲻ɾ + //DefaultConnection这个节点不能删 "DefaultConnection": "Data Source=118.178.224.202;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;", "ConnectionStrings": [ /* @@ -12,20 +12,20 @@ Kdbndp = 6 */ { - "Id": 1, // idõݿ - "DBType": 2, // dbͣö٣Ŀϱ - "Enabled": false, // Ƿǰݿdb - "Connection": "WMBlog.db" // ַ + "Id": 1, // 连接id,可以配置到数据库 + "DBType": 2, // db类型,枚举,具体的看上边 + "Enabled": false, // 是否开启当前数据库db + "Connection": "WMBlog.db" // 连接字符串 }, { - //Ŀǰʹõݿ Ewide. + //目前使用的数据库 Ewide. "Id": "118_3310_ewide", "DBType": 0, "Enabled": true, "ConnectionString": ";" }, { - //֪ʲôõ + //不知道干什么用的 "Id": "PgSqlConnection", "DBType": 4, "Enabled": true, diff --git a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Production.json b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Production.json index 7aad0d2..f43e270 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Production.json +++ b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Production.json @@ -1,5 +1,5 @@ { - //DefaultConnectionڵ㲻ɾ + //DefaultConnection这个节点不能删 "DefaultConnection": "Data Source=localhost;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=Ewide.;pooling=true;sslmode=none;CharSet=utf8;", "ConnectionStrings": [ /* @@ -12,20 +12,20 @@ Kdbndp = 6 */ { - "Id": 1, // idõݿ - "DBType": 2, // dbͣö٣Ŀϱ - "Enabled": false, // Ƿǰݿdb - "Connection": "WMBlog.db" // ַ + "Id": 1, // 连接id,可以配置到数据库 + "DBType": 2, // db类型,枚举,具体的看上边 + "Enabled": false, // 是否开启当前数据库db + "Connection": "WMBlog.db" // 连接字符串 }, { - //Ŀǰʹõݿ Ewide. + //目前使用的数据库 Ewide. "Id": "118_3310_ewide", "DBType": 0, "Enabled": true, "ConnectionString": "" }, { - //֪ʲôõ + //不知道干什么用的 "Id": "PgSqlConnection", "DBType": 4, "Enabled": true, diff --git a/20220330_Vote/Ewide.Test/Ewide.Test.csproj b/20220330_Vote/Ewide.Test/Ewide.Test.csproj index 7e1a428..c2ec04b 100644 --- a/20220330_Vote/Ewide.Test/Ewide.Test.csproj +++ b/20220330_Vote/Ewide.Test/Ewide.Test.csproj @@ -9,7 +9,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/20220330_Vote/Ewide.Web.Core/Ewide.Web.Core.csproj b/20220330_Vote/Ewide.Web.Core/Ewide.Web.Core.csproj index 9c47a70..9dacd20 100644 --- a/20220330_Vote/Ewide.Web.Core/Ewide.Web.Core.csproj +++ b/20220330_Vote/Ewide.Web.Core/Ewide.Web.Core.csproj @@ -11,7 +11,7 @@ - + diff --git a/20220330_Vote/Ewide.Web.Core/Startup.cs b/20220330_Vote/Ewide.Web.Core/Startup.cs index d2a9dfc..60fe722 100644 --- a/20220330_Vote/Ewide.Web.Core/Startup.cs +++ b/20220330_Vote/Ewide.Web.Core/Startup.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.Hosting; using OnceMi.AspNetCore.OSS; using Serilog; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace Ewide.Web.Core @@ -53,8 +54,8 @@ namespace Ewide.Web.Core .AddJsonOptions(options => { //options.JsonSerializerOptions.DefaultBufferSize = 10_0000;//返回较大数据数据序列化时会截断,原因:默认缓冲区大小(以字节为单位)为16384。 - options.JsonSerializerOptions.Converters.AddDateFormatString("yyyy-MM-dd HH:mm:ss"); - //options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; // 忽略循环引用 仅.NET 6支持 + //options.JsonSerializerOptions.Converters.AddDateFormatString("yyyy-MM-dd HH:mm:ss"); + options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; // 忽略循环引用 仅.NET 6支持 }); services.AddViewEngine(); diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/HomeController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/HomeController.cs index 1b82ce4..d010b5c 100644 --- a/20220330_Vote/Ewide.Web.Entry/Controllers/HomeController.cs +++ b/20220330_Vote/Ewide.Web.Entry/Controllers/HomeController.cs @@ -1,7 +1,7 @@ //using Ewide.Application; using Furion; using Furion.DataEncryption; -using Furion.TaskScheduler; +//using Furion.TaskScheduler; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; @@ -24,13 +24,13 @@ namespace Ewide.Web.Entry.Controllers } public IActionResult Index2() { - //SpareTime.Do - var workers = SpareTime.GetWorkers().ToList(); - SpareTime.DoOnce(3000, (timer, count) => - { - // 这里发送短信,发送邮件或记录访问记录 - Console.WriteLine("现在时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); - }); + ////SpareTime.Do + //var workers = SpareTime.GetWorkers().ToList(); + //SpareTime.DoOnce(3000, (timer, count) => + // { + // // 这里发送短信,发送邮件或记录访问记录 + // Console.WriteLine("现在时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + // }); return View(); } } diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs index 49f30b7..1092134 100644 --- a/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs +++ b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs @@ -10,7 +10,7 @@ namespace Ewide.Web.Entry.Controllers [AllowAnonymous] public class ManageController : Controller { - public IActionResult Index() + public IActionResult VoteResult() { ViewBag.Title = "宁波市“甬江建设杯”选票"; return View(); @@ -25,5 +25,10 @@ namespace Ewide.Web.Entry.Controllers ViewBag.Title = "宁波市“甬江建设杯”选票"; return View(); } + public IActionResult nbczResult() + { + ViewBag.Title = "共赴宁波之春 报名结果"; + return View(); + } } } diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/NingboZhiChunController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/NingboZhiChunController.cs new file mode 100644 index 0000000..43acecf --- /dev/null +++ b/20220330_Vote/Ewide.Web.Entry/Controllers/NingboZhiChunController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Ewide.Web.Entry.Controllers +{ + public class NingboZhiChunController : Controller + { + [AllowAnonymous] + public IActionResult Index() + { + return View(); + } + } +} diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml index 50b04de..fc73f82 100644 --- a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml +++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml @@ -101,7 +101,8 @@ _this.$alert(response.data.data.descriptions); else { window.sessionStorage.setItem('__TOKEN', response.data.data.token); - location = '/gb/yjb/manage/index' + //location = '/gb/yjb/manage/VoteResult' + location = '/gb/yjb/manage/GfnbczResult' } } _this.loading = false; diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/VoteResult.cshtml similarity index 100% rename from 20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml rename to 20220330_Vote/Ewide.Web.Entry/Views/Manage/VoteResult.cshtml diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/nbczResult.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/nbczResult.cshtml new file mode 100644 index 0000000..665954c --- /dev/null +++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/nbczResult.cshtml @@ -0,0 +1,239 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} + + + + + + + + + + + + + + +
+

共赴宁波之春 报名结果

+ + + + + + + + + + +

+ 刷新数据 + 导出Excel +

+
+ + + + + \ No newline at end of file diff --git a/20220330_Vote/Ewide.Web.Entry/Views/NingboZhiChun/Index.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/NingboZhiChun/Index.cshtml new file mode 100644 index 0000000..b473a2d --- /dev/null +++ b/20220330_Vote/Ewide.Web.Entry/Views/NingboZhiChun/Index.cshtml @@ -0,0 +1,334 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} + + + + + + + + + + + + + + +
+

共赴宁波之春 参与报名

+ +

本地活动共三条线路,分别为:

+

A.“历史之路 文化之路 创新之路 共富之路”的慈溪南部沿山风情共富线。

+

B.“应梦明山入城,剡水桃源归野”的奉化明山剡水共富线。

+

C.“万象山海,逐梦亚运”象山扬帆亚运风情共富线三条体验游览线。

+

每天三条线齐发(奉,宁,慈)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

A.慈溪南部沿山风情共富线。

+

B.奉化明山剡水共富线。

+

C.象山扬帆亚运风情共富线。

+
+ + + + + +
+ @* + + *@ + + 提交 + 我的报名 + +
+
+ + + + + \ No newline at end of file diff --git a/20220330_Vote/Ewide.Web.Entry/appsettings.json b/20220330_Vote/Ewide.Web.Entry/appsettings.json index fce28ee..08cc113 100644 --- a/20220330_Vote/Ewide.Web.Entry/appsettings.json +++ b/20220330_Vote/Ewide.Web.Entry/appsettings.json @@ -42,6 +42,14 @@ "AccessKey": "C4D30C2801D928AAF687", "SecretKey": "ooZVXaB1tqIz7DHTv53RILD7o5cAAAGAAdkoqlR2", "IsEnableCache": true //是否启用缓存,推荐开启 + }, + "NingboZhiChun": { + "OpenSms": 0, + "SmsTokenUrl": "http://10.19.94.16/api/user/login", + "SmsSendUrl": "http://10.19.94.16/api/sms/send", + "SmsAccount": "tempaccount0309", + "SmsPwd": "Aabc!@#20KHL+@+124bjaT(6q", + "TotalCount": 40 } } \ No newline at end of file diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309170959-2022年度甬江杯投票.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309170959-2022年度甬江杯投票.xlsx new file mode 100644 index 0000000..0ec6b55 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309170959-2022年度甬江杯投票.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172334-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172334-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..ebc7e94 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172334-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172352-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172352-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..2446eba Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172352-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172424-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172424-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..d0e2aa1 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172424-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172432-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172432-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..3d9d6ac Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172432-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172440-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172440-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..64061eb Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172440-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172522-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172522-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..fab7ab6 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172522-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172523-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172523-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..fab7ab6 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172523-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172600-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172600-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..bec5bd6 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172600-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172618-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172618-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..73dac6d Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172618-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172659-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172659-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..42d3c3b Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172659-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172703-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172703-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..44f291a Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172703-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172730-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172730-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..767e82b Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172730-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172734-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172734-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..2767b84 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172734-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172736-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172736-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..3848dbf Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172736-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172737-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172737-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..3848dbf Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172737-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172741-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172741-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..63e8d1c Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309172741-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309195404-共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309195404-共赴宁波之春模板.xlsx new file mode 100644 index 0000000..c6fc394 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/OutPut/20230309195404-共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/共赴宁波之春模板.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/共赴宁波之春模板.xlsx new file mode 100644 index 0000000..8e43b99 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/共赴宁波之春模板.xlsx differ diff --git a/20220330_Vote/Vote.Services/ApiController/NbZhiChunService.cs b/20220330_Vote/Vote.Services/ApiController/NbZhiChunService.cs new file mode 100644 index 0000000..ce9e5d0 --- /dev/null +++ b/20220330_Vote/Vote.Services/ApiController/NbZhiChunService.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Ewide.Core; +using Ewide.Core.Util; +using Furion; +using Furion.ClayObject.Extensions; +using Furion.DatabaseAccessor; +using Furion.DataEncryption; +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Furion.RemoteRequest.Extensions; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Memory; +using Newtonsoft.Json.Linq; +using Vote.Services.Dto; +using Vote.Services.Entities; + +namespace Vote.Services.ApiController +{ + /// + /// 共赴宁波之春 + /// + [ApiDescriptionSettings("ningbozhichun", Order = 0)] + [Route("/gb/yjb/api/ningbozhichun")] + public class NbZhiChunService : IDynamicApiController + { + private readonly IRepository repPerson; + private readonly IRepository repSmsCode; + private readonly IMemoryCache _memoryCache; + /// + /// + /// + /// + public NbZhiChunService(IRepository _repNingbo, IRepository _repSmsCode, IMemoryCache memoryCache) + { + repPerson = _repNingbo; + this.repSmsCode = _repSmsCode; + _memoryCache = memoryCache; + } + + /// + /// 提交 + /// + /// + [HttpPost] + [UnitOfWork] + [Microsoft.AspNetCore.Authorization.AllowAnonymous] + [Route("sendcode")] + public async Task SendCode(NbzcSendCodeInput args) + { + //var data = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted && p.expire_time > DateTime.Now) + // .FirstOrDefaultAsync(); + //_ = (data != null) ? throw Oops.Oh("已存在此号码的有效发送记录,不可重复发送") : 1; + var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync(); + _ = lastSend != null && DateTime.Now <= lastSend.CreatedTime.Value.AddMinutes(1) ? throw Oops.Oh("发送过于频繁,请1分钟后再试") : 1; + + //_ = (await repPerson.DetachedEntities.Where(a => !a.IsDeleted && (a.phone == args.phone || a.cardno == args.cardno)).CountAsync() > 0) ? throw Oops.Oh("您已提交,无需再次获取验证码") : 1; + string _timeCacheKey = "sms_token_" + args.phone; + var code = new Random().Next(1001, 9999); + if (App.GetConfig("NingboZhiChun:OpenSms") == 1) + { + var cacheTokenValue = _memoryCache.Get(_timeCacheKey); + if (string.IsNullOrEmpty(cacheTokenValue)) + { + var rslt = await App.GetConfig("NingboZhiChun:SmsTokenUrl").SetBody(new { username = App.GetConfig("NingboZhiChun:SmsAccount"), password = App.GetConfig("NingboZhiChun:SmsPwd") }, "application/json").SetHttpMethod(HttpMethod.Post).SendAsStringAsync(); + cacheTokenValue = Newtonsoft.Json.Linq.JObject.Parse(rslt)["data"]["token"].ToString(); + var cacheEntryOptions = new MemoryCacheEntryOptions() + .SetSlidingExpiration(TimeSpan.FromMinutes(100)); + _memoryCache.Set(_timeCacheKey, cacheTokenValue, cacheEntryOptions); + } + var sendrslt = await App.GetConfig("NingboZhiChun:SmsSendUrl") + .SetHttpMethod(HttpMethod.Post) + .SetHeaders(new Dictionary { { "Authorization", "Bearer " + cacheTokenValue } }) + .SetBody(new { phone_number = args.phone, sms_content = $"您的验证码是:{code},10分钟内有效。" }) + .SendAsStringAsync(); + if (!Newtonsoft.Json.Linq.JObject.Parse(sendrslt)["issuccess"].Value()) + throw Oops.Oh("验证码短信发送失败."); + } + await new Entities.nbzc_sms_code + { + code = code.ToString(), + CreatedTime = DateTime.Now, + expire_time = DateTime.Now.AddMinutes(10), + IsDeleted = false, + phone = args.phone + }.InsertOrUpdate(); + return true; + } + /// + /// 提交 + /// + /// + [HttpPost] + [UnitOfWork] + [Microsoft.AspNetCore.Authorization.AllowAnonymous] + public async Task SubmitSubmit(NbzcSubmitInput args) + { + 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; + //var list = args.projects.Adapt>(); + //删除这个专家上次提交的结果 + //或者提示不能再次提交 + _ = (await repPerson.DetachedEntities.Where(a => !a.IsDeleted && (a.phone == args.phone || a.cardno == args.cardno)).CountAsync() > 0) ? throw Oops.Oh("您已提交,无需再次提交") : 1; + var now = DateTime.Now; + var model = new Entities.nbzc_person + { + address = args.address, + phone = args.phone, + cardno = args.cardno, + CreatedTime = DateTime.Now, + date = args.date, + hangye = args.hangye, + IsDeleted = false, + line = args.line, + name = args.name, + weixin_number = args.weixin_number + }; + model = await model.InsertOrUpdate(); + lastSend.IsDeleted = true; + await repSmsCode.UpdateIncludeAsync(lastSend, new string[] { nameof(lastSend.IsDeleted) }); + var token = JWTEncryption.Encrypt(new Dictionary() // 加密 + { + { "UserId", model.Id }, + { "Account",model.phone } + }); + return new { success = true, token }; + } + /// + /// 提交 + /// + /// + [HttpPost] + [UnitOfWork] + [Microsoft.AspNetCore.Authorization.AllowAnonymous] + [Route("getmyinfo")] + public async Task GetMyInfo(NbzcGetMyInfoInput args) + { + var newToken = args.token; + nbzc_person entity = null; + 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(); + } + else + { + _ = (string.IsNullOrEmpty(args.code)) ? throw Oops.Oh("验证码错误或已失效") : 1; + 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() + { + { "UserId", entity.Id }, + { "Account",entity.phone } + }); + } + return new { success = true, entity, token = newToken }; + } + /// + /// 获取时间线路人数 + /// + /// + [HttpPost] + [UnitOfWork] + [Microsoft.AspNetCore.Authorization.AllowAnonymous] + [Route("getnumber")] + public async Task GetNumber(NbzcGetNumberInput args) + { + var n = await repPerson.DetachedEntities.Where(a => !a.IsDeleted && a.date == args.date).CountAsync(); + return new { success = true, n = App.GetConfig("NingboZhiChun:TotalCount") - n }; + } + /// + /// 获取清单 + /// + /// + [HttpPost] + [UnitOfWork] + [Route("GetPersonList")] + public async Task GetPersonList(NbzcGetListInput args) + { + var list = await repPerson.DetachedEntities.Where(a => !a.IsDeleted).OrderByDescending(a => a.CreatedTime).ToListAsync(); + return list; + } + + + + /// + /// 导出Excel + /// + /// + [HttpPost] + [UnitOfWork] + [Route("export_excel")] + public async Task ExportExcel(NbzcGetListInput args) + { + var list = await repPerson.DetachedEntities.Where(a => !a.IsDeleted).OrderByDescending(a => a.CreatedTime).ToListAsync(); + var filepath = Tools.ExcelHelper.WriteExcelNingBoZhiChun(list); + return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath }; + } + } +} diff --git a/20220330_Vote/Vote.Services/Dto/NbzcInput.cs b/20220330_Vote/Vote.Services/Dto/NbzcInput.cs new file mode 100644 index 0000000..e52f471 --- /dev/null +++ b/20220330_Vote/Vote.Services/Dto/NbzcInput.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Vote.Services.Dto +{ + /// + /// + /// + public class NbzcInput + { + } + /// + /// + /// + public class NbzcGetMyInfoInput + { + /// + /// + /// + //[Required] + public string token { get; set; } + /// + /// + /// + public string phone { get; set; } + /// + /// + /// + //[Required] + public string code { get; set; } + } + /// + /// + /// + public class NbzcGetListInput + { + /// + /// + /// + //[Required] + public string phone { get; set; } + } + /// + /// + /// + public class NbzcSendCodeInput + { + /// + /// + /// + [Required] + public string phone { get; set; } + /// + /// + /// + public string cardno { get; set; } + + } + /// + /// + /// + public class NbzcGetNumberInput + { + /// + /// + /// + [Required] + public string date { get; set; } + /// + /// + /// + //[Required] + public string line { get; set; } + + } + /// + /// + /// + public class NbzcSubmitInput + { + /// + /// + /// + [Required] + public string code { get; set; } + /// + /// + /// + [Required] + public string phone { get; set; } + + /// + /// + /// + public string address { get; set; } + + /// + /// + /// + [Required] + public string cardno { get; set; } + + /// + /// + /// + [Required] + public string date { get; set; } + /// + /// + /// + public string hangye { get; set; } + /// + /// + /// + [Required] + public string line { get; set; } + /// + /// + /// + [Required] + public string weixin_number { get; set; } + /// + /// + /// + [Required] + public string name { get; set; } + + } +} diff --git a/20220330_Vote/Vote.Services/Entities/nbzc_person.cs b/20220330_Vote/Vote.Services/Entities/nbzc_person.cs new file mode 100644 index 0000000..7fd583c --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/nbzc_person.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Ewide.Core; + +namespace Vote.Services.Entities +{ + /// + /// 共赴宁波之春-登记人员表 + /// + [Serializable] + public class nbzc_person : DEntityBase + { + + /// + /// 姓名 + /// + [DisplayName("姓名")] + public string name { get; set; } + + /// + /// 手机号码 + /// + [DisplayName("手机号码")] + public string phone { get; set; } + + /// + /// 微信号码 + /// + [DisplayName("微信号码")] + public string weixin_number { get; set; } + + /// + /// 身份证号码 + /// + [DisplayName("身份证号码")] + public string cardno { get; set; } + + /// + /// 行业 + /// + [DisplayName("行业")] + public string hangye { get; set; } + + /// + /// 所在地,地址 + /// + [DisplayName("所在地,地址")] + public string address { get; set; } + + /// + /// 日期,不固定格式 + /// + [DisplayName("日期,不固定格式")] + public string date { get; set; } + + /// + /// x线路 + /// + [DisplayName("x线路")] + public string line { get; set; } + + + } +} diff --git a/20220330_Vote/Vote.Services/Entities/nbzc_sms_code.cs b/20220330_Vote/Vote.Services/Entities/nbzc_sms_code.cs new file mode 100644 index 0000000..f507f56 --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/nbzc_sms_code.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Ewide.Core; + +namespace Vote.Services.Entities +{ + /// + /// + /// + [Serializable] + public class nbzc_sms_code : DEntityBase + { + /// + /// 手机号码 + /// + [DisplayName("手机号码")] + public string phone { get; set; } + + /// + /// 验证码 + /// + [DisplayName("验证码")] + public string code { get; set; } + + /// + /// 过期时间 + /// + [DisplayName("过期时间")] + public DateTime expire_time { get; set; } + + + } +} diff --git a/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs b/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs index c0d86bb..e6bce77 100644 --- a/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs +++ b/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs @@ -11,6 +11,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Vote.Services.Dto; +using Vote.Services.Entities; namespace Vote.Services.Tools { @@ -208,5 +209,63 @@ namespace Vote.Services.Tools throw Oops.Oh("文件被占用,请检查文件模板"); } } + + + /// + /// + /// + /// + public static string WriteExcelNingBoZhiChun(List data) + { + try + { + string template_name = "共赴宁波之春模板.xlsx"; + string excelFilePath = $"{App.WebHostEnvironment.WebRootPath}\\ExcelTemplate\\{template_name}"; + string outputPath = string.Empty; + if (!string.IsNullOrEmpty(excelFilePath)) + { + using (FileStream excelFileStream = System.IO.File.OpenRead(excelFilePath)) + { + bool isCompatible = ExcelHelper.GetIsCompatible(excelFilePath); + IWorkbook workbook = ExcelHelper.CreateWorkbook(isCompatible, excelFileStream); + ISheet sheet = null; + sheet = workbook.GetSheetAt(0); + //从第几行开始 , 比如 行号是4 , 就写3 + var startRowIndex = 1; + for (int i = 0; i < data.Count; i++) + { + var c_rowindex = startRowIndex + i; + var row = sheet.CreateRow(c_rowindex); + int cell_start_index = 0; + row.CreateCell(cell_start_index).SetCellValue(data[i].CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); + row.CreateCell(cell_start_index + 1).SetCellValue(data[i].name); + row.CreateCell(cell_start_index + 2).SetCellValue(data[i].phone); + row.CreateCell(cell_start_index + 3).SetCellValue(data[i].weixin_number); + row.CreateCell(cell_start_index + 4).SetCellValue(data[i].cardno); + row.CreateCell(cell_start_index + 5).SetCellValue(data[i].hangye); + row.CreateCell(cell_start_index + 6).SetCellValue(data[i].date); + row.CreateCell(cell_start_index + 7).SetCellValue(data[i].line); + row.CreateCell(cell_start_index + 8).SetCellValue(data[i].address); + } + var file = new FileInfo(excelFilePath); + var savePath = file.DirectoryName + "\\OutPut\\"; + if (!Directory.Exists(savePath)) + Directory.CreateDirectory(savePath); + outputPath = savePath + DateTime.Now.ToString("yyyyMMddHHmmsss") + "-" + template_name; + using (var filess = new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read)) + { + workbook.Write(filess); + } + } + } + return outputPath; + } + catch (System.IO.IOException ioex) + { + throw Oops.Oh("文件被占用,请检查文件模板"); + } + } + + } } diff --git a/20220330_Vote/Vote.Services/Vote.Services.csproj b/20220330_Vote/Vote.Services/Vote.Services.csproj index bd52417..bb0d5de 100644 --- a/20220330_Vote/Vote.Services/Vote.Services.csproj +++ b/20220330_Vote/Vote.Services/Vote.Services.csproj @@ -10,7 +10,7 @@ - + diff --git a/20220330_Vote/Vote.Services/Vote.Services.xml b/20220330_Vote/Vote.Services/Vote.Services.xml index a5b71c9..d2d9f1d 100644 --- a/20220330_Vote/Vote.Services/Vote.Services.xml +++ b/20220330_Vote/Vote.Services/Vote.Services.xml @@ -45,6 +45,53 @@
+ + + 共赴宁波之春 + + + + + + + + + + + 提交 + + + + + + 提交 + + + + + + 提交 + + + + + + 获取时间线路人数 + + + + + + 获取清单 + + + + + + 导出Excel + + + 项目 @@ -97,6 +144,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -262,6 +424,71 @@ 登录码 + + + 共赴宁波之春-登记人员表 + + + + + 姓名 + + + + + 手机号码 + + + + + 微信号码 + + + + + 身份证号码 + + + + + 行业 + + + + + 所在地,地址 + + + + + 日期,不固定格式 + + + + + x线路 + + + + + + + + + + 手机号码 + + + + + 验证码 + + + + + 过期时间 + + 项目表 @@ -394,6 +621,12 @@ + + + + + + 方法一:比较推荐 用HttpWebRequest取得网页源码