From 0724612d607c3f5167e2bdcf34da611c4963d8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Fri, 1 Dec 2023 15:37:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Front/LibraryController.cs | 39 ++++++++++++++++--- New_College.Api/New_College.xml | 4 +- New_College.Api/Startup.cs | 17 +++++++- New_College.IServices/ID_LongIdMapServices.cs | 2 +- .../ViewModels/Query/UniversityQuery.cs | 6 +++ .../Result/EnrollmentinproductionResult.cs | 33 ++++++++++++++++ .../ViewModels/Result/uniMajorSecond.cs | 28 ++++++++++++- New_College.Services/D_LongIdMapServices.cs | 29 +++++++------- .../D_PlanMajorDescServices.cs | 3 +- 9 files changed, 136 insertions(+), 25 deletions(-) diff --git a/New_College.Api/Controllers/Front/LibraryController.cs b/New_College.Api/Controllers/Front/LibraryController.cs index 87ffe19..92884b2 100644 --- a/New_College.Api/Controllers/Front/LibraryController.cs +++ b/New_College.Api/Controllers/Front/LibraryController.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using New_College.Common.HttpRestSharp; using New_College.IServices; using New_College.Model; using New_College.Model.Models; @@ -210,10 +211,19 @@ namespace New_College.Api.Controllers.Front /// [HttpGet] - public async Task>> PcGetOccupationInfo() + public async Task> PcGetOccupationInfo() { + ////http://192.168.104.104:3000/youzy.dms.basiclib.api.v1.career2.level.tree.get + //var info = HttpHelper.GetApi("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.v1.career2.level.tree.get"); + //return new MessageModel() + //{ + // msg = "获取成功", + // response = info, + // status = 200, + // success = true, + //}; var result = await iD_LongIdMapServices.pcGetOccupationInfo(); - return new MessageModel>() + return new MessageModel() { success = result.Count <= 0 ? false : true, msg = result.Count <= 0 ? "获取失败" : "获取成功", @@ -357,6 +367,24 @@ namespace New_College.Api.Controllers.Front }; } + + [HttpGet] + public async Task> GetRecommendIntroduceV2([FromQuery] IdQuery query) + { + + var info = HttpHelper.GetApi("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.v1.career2.level.tree.get"); + return new MessageModel() + { + msg = "获取成功", + response = info, + status = 200, + success = true, + }; + + + } + + /// /// 院校相关专业专用 /// @@ -472,15 +500,16 @@ namespace New_College.Api.Controllers.Front return await iD_LongIdMapServices.uniGetSearchMajor(query); } + /// /// 获取招生简章列表 /// - /// + /// /// [HttpGet] - public async Task>> GetRequestEnrollmentinproductionResult([FromQuery] UniversityIdQuery query) + public MessageModel> GetEnrollmentinproductionResult([FromQuery] UniversityGeneralRequest request) { - return await iD_LongIdMapServices.GetRequestEnrollmentinproductionResult(query); + return iD_LongIdMapServices.GetEnrollmentinproductionResult(request); } diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 08d053e..859d863 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -459,11 +459,11 @@ - + 获取招生简章列表 - + diff --git a/New_College.Api/Startup.cs b/New_College.Api/Startup.cs index 5614cba..1739132 100644 --- a/New_College.Api/Startup.cs +++ b/New_College.Api/Startup.cs @@ -28,6 +28,8 @@ using Newtonsoft.Json.Converters; using New_College.Common.Helper; using System.Text.Encodings.Web; using System.Text.Unicode; +using Microsoft.AspNetCore.ResponseCompression; +using System.Linq; namespace New_College { @@ -94,6 +96,10 @@ namespace New_College services.AddAppConfigSetup(); services.AddHttpApi(); + + + + // 授权+认证 (jwt or ids4) services.AddAuthorizationSetup(); if (Permissions.IsUseIds4) @@ -158,6 +164,15 @@ namespace New_College }); //全局配置Json序列化处理 services.AddMvc().AddSessionStateTempDataProvider(); + + services.AddResponseCompression(options => + { + options.Providers.Add(); + options.Providers.Add(); + options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( + new[] { "application/json" }); + }); + services.AddSession(); _services = services; } @@ -182,7 +197,7 @@ namespace New_College app.UseIPLogMildd(); // 查看注入的所有服务 app.UseAllServicesMildd(_services); - + app.UseResponseCompression(); if (env.IsDevelopment()) { // 在开发环境中,使用异常页面,这样可以暴露错误堆栈信息,所以不要放在生产环境。 diff --git a/New_College.IServices/ID_LongIdMapServices.cs b/New_College.IServices/ID_LongIdMapServices.cs index 6d925b3..69bd14a 100644 --- a/New_College.IServices/ID_LongIdMapServices.cs +++ b/New_College.IServices/ID_LongIdMapServices.cs @@ -91,7 +91,7 @@ namespace New_College.IServices /// /// /// - Task>> GetRequestEnrollmentinproductionResult(UniversityIdQuery query); + MessageModel> GetEnrollmentinproductionResult(UniversityGeneralRequest query); /// /// 获取招生简介详情 diff --git a/New_College.Model/ViewModels/Query/UniversityQuery.cs b/New_College.Model/ViewModels/Query/UniversityQuery.cs index 7816272..31662aa 100644 --- a/New_College.Model/ViewModels/Query/UniversityQuery.cs +++ b/New_College.Model/ViewModels/Query/UniversityQuery.cs @@ -78,4 +78,10 @@ namespace New_College.Model.ViewModels { public string Id { get; set; } } + + public class UniversityGeneralRequest + { + public string collegeCode { get; set; } + + } } diff --git a/New_College.Model/ViewModels/Result/EnrollmentinproductionResult.cs b/New_College.Model/ViewModels/Result/EnrollmentinproductionResult.cs index 1aadfd6..898e994 100644 --- a/New_College.Model/ViewModels/Result/EnrollmentinproductionResult.cs +++ b/New_College.Model/ViewModels/Result/EnrollmentinproductionResult.cs @@ -16,6 +16,39 @@ namespace New_College.Model.ViewModels public string Title { get; set; } } + + + public class GenBycollegeobject + { + public GenBycollegeResult result { get; set; } + public string code { get; set; } + public string message { get; set; } + public string fullMessage { get; set; } + public DateTime timestamp { get; set; } + public bool isSuccess { get; set; } + } + + public class GenBycollegeResult + { + public int totalCount { get; set; } + public GenBycollegeItem[] items { get; set; } + } + + public class GenBycollegeItem + { + public string title { get; set; } + public int rank { get; set; } + public int year { get; set; } + public int hits { get; set; } + public int type { get; set; } + public bool isArt { get; set; } + public string editor { get; set; } + public DateTime updatedAt { get; set; } + public DateTime createdAt { get; set; } + public string id { get; set; } + } + + public class RequestBaseResponse { public string Code { get; set; } = "0"; diff --git a/New_College.Model/ViewModels/Result/uniMajorSecond.cs b/New_College.Model/ViewModels/Result/uniMajorSecond.cs index a5f7392..ae0d7bf 100644 --- a/New_College.Model/ViewModels/Result/uniMajorSecond.cs +++ b/New_College.Model/ViewModels/Result/uniMajorSecond.cs @@ -20,7 +20,7 @@ namespace New_College.Model.ViewModels public int Id { get; set; } public string Name { get; set; } - public string Code { get; set; } + public string Code { get; set; } } /// @@ -70,5 +70,31 @@ namespace New_College.Model.ViewModels public List MajorsInfo { get; set; } } + public class pcOccupationobject + { + public List result { get; set; } + public string code { get; set; } + public string message { get; set; } + public string fullMessage { get; set; } + public DateTime timestamp { get; set; } + public bool isSuccess { get; set; } + } + + public class pcOccupationResult + { + public string code { get; set; } + public string name { get; set; } + public List children { get; set; } + } + + public class pcOccupationChild + { + public string code { get; set; } + public string name { get; set; } + public List children { get; set; } + } + + + } diff --git a/New_College.Services/D_LongIdMapServices.cs b/New_College.Services/D_LongIdMapServices.cs index 8ed9465..8339b90 100644 --- a/New_College.Services/D_LongIdMapServices.cs +++ b/New_College.Services/D_LongIdMapServices.cs @@ -967,30 +967,31 @@ namespace New_College.Services } #endregion + + /// /// 获取招生简章列表 /// /// /// - public async Task>> GetRequestEnrollmentinproductionResult(UniversityIdQuery query) + public MessageModel> GetEnrollmentinproductionResult(UniversityGeneralRequest query) { - var longinfo = (await _dal.Query(x => x.IsDelete == false && x.table == "D_University" && x.newid == query.Id)).FirstOrDefault(); - if (longinfo == null) - return new MessageModel>() { success = false, msg = "未找到数据" }; - RequestQuery request = new RequestQuery() { Id = longinfo.longid, PageIndex = query.PageIndex, PageSize = query.PageSize }; - var stringBuilder = new StringBuilder(); - stringBuilder.AppendFormat("Id={0}&PageIndex={1}&PageSize={2}", longinfo.longid, query.PageIndex, query.PageSize); - var info = HttpHelper.GetApi("https://hbs.yrtsedu.cn/", "api/University/GetEnrollmentinproductions", stringBuilder.ToString()); - if (info.Success == false) + //http://192.168.104.104:3000/youzy.dms.basiclib.api.college.news.bycollege.get + var info = HttpHelper.PostApi("http://192.168.104.104:3000/youzy.dms.basiclib.api.college.news.bycollege.get",query); + if (info.isSuccess == true) { - return new MessageModel>() { success = false, msg = "请求失败" }; + return new MessageModel>() + { + success = true, + msg = "获取成功", + response = info.result.items.ToList() + }; } - return new MessageModel>() + return new MessageModel>() { - success = info.Success, - msg = "获取成功", - response = info.Data + success = info.isSuccess, + msg = "获取失败", }; } diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index 33693da..675249d 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -39,6 +39,7 @@ namespace New_College.Services /// public async Task> GetAIGoList(OneSubmitGoRequest request) { + request.PageSize = request.PageSize > 20 ? 20 : request.PageSize; var claim = request.SubjectClaim.Split(",", StringSplitOptions.RemoveEmptyEntries).ToList(); var pagemodel = new AIGOPageModel(); @@ -124,7 +125,7 @@ namespace New_College.Services { PlanCount = k.PlanCount, RankLine = k.LowScoreRank, - Scoreline = k.LowScoreRank, + Scoreline = k.LowScore, Year = k.Years.ToString(), Count = "--" }).ToList()