feat:增加压缩功能
parent
cb6d1c387e
commit
0724612d60
|
|
@ -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
|
|||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public async Task<MessageModel<List<pcMajorInfoResult>>> PcGetOccupationInfo()
|
||||
public async Task<MessageModel<dynamic>> PcGetOccupationInfo()
|
||||
{
|
||||
////http://192.168.104.104:3000/youzy.dms.basiclib.api.v1.career2.level.tree.get
|
||||
//var info = HttpHelper.GetApi<pcOccupationobject>("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.v1.career2.level.tree.get");
|
||||
//return new MessageModel<dynamic>()
|
||||
//{
|
||||
// msg = "获取成功",
|
||||
// response = info,
|
||||
// status = 200,
|
||||
// success = true,
|
||||
//};
|
||||
var result = await iD_LongIdMapServices.pcGetOccupationInfo();
|
||||
return new MessageModel<List<pcMajorInfoResult>>()
|
||||
return new MessageModel<dynamic>()
|
||||
{
|
||||
success = result.Count <= 0 ? false : true,
|
||||
msg = result.Count <= 0 ? "获取失败" : "获取成功",
|
||||
|
|
@ -357,6 +367,24 @@ namespace New_College.Api.Controllers.Front
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<MessageModel<dynamic>> GetRecommendIntroduceV2([FromQuery] IdQuery query)
|
||||
{
|
||||
|
||||
var info = HttpHelper.GetApi<pcOccupationobject>("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.v1.career2.level.tree.get");
|
||||
return new MessageModel<dynamic>()
|
||||
{
|
||||
msg = "获取成功",
|
||||
response = info,
|
||||
status = 200,
|
||||
success = true,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 院校相关专业专用
|
||||
/// </summary>
|
||||
|
|
@ -472,15 +500,16 @@ namespace New_College.Api.Controllers.Front
|
|||
return await iD_LongIdMapServices.uniGetSearchMajor(query);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取招生简章列表
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<MessageModel<List<RequestEnrollmentinproductionResult>>> GetRequestEnrollmentinproductionResult([FromQuery] UniversityIdQuery query)
|
||||
public MessageModel<List<GenBycollegeItem>> GetEnrollmentinproductionResult([FromQuery] UniversityGeneralRequest request)
|
||||
{
|
||||
return await iD_LongIdMapServices.GetRequestEnrollmentinproductionResult(query);
|
||||
return iD_LongIdMapServices.GetEnrollmentinproductionResult(request);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -459,11 +459,11 @@
|
|||
<param name="query"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:New_College.Api.Controllers.Front.LibraryController.GetRequestEnrollmentinproductionResult(New_College.Model.ViewModels.UniversityIdQuery)">
|
||||
<member name="M:New_College.Api.Controllers.Front.LibraryController.GetEnrollmentinproductionResult(New_College.Model.ViewModels.UniversityGeneralRequest)">
|
||||
<summary>
|
||||
获取招生简章列表
|
||||
</summary>
|
||||
<param name="query"></param>
|
||||
<param name="request"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:New_College.Api.Controllers.Front.LibraryController.GetRequestEnrollmentinproductionDetailResult(New_College.Model.ViewModels.StringIdQuery)">
|
||||
|
|
|
|||
|
|
@ -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<BrotliCompressionProvider>();
|
||||
options.Providers.Add<GzipCompressionProvider>();
|
||||
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())
|
||||
{
|
||||
// 在开发环境中,使用异常页面,这样可以暴露错误堆栈信息,所以不要放在生产环境。
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace New_College.IServices
|
|||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<MessageModel<List<RequestEnrollmentinproductionResult>>> GetRequestEnrollmentinproductionResult(UniversityIdQuery query);
|
||||
MessageModel<List<GenBycollegeItem>> GetEnrollmentinproductionResult(UniversityGeneralRequest query);
|
||||
|
||||
/// <summary>
|
||||
/// 获取招生简介详情
|
||||
|
|
|
|||
|
|
@ -78,4 +78,10 @@ namespace New_College.Model.ViewModels
|
|||
{
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class UniversityGeneralRequest
|
||||
{
|
||||
public string collegeCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -70,5 +70,31 @@ namespace New_College.Model.ViewModels
|
|||
public List<uniMajorSelect> MajorsInfo { get; set; }
|
||||
}
|
||||
|
||||
public class pcOccupationobject
|
||||
{
|
||||
public List<pcOccupationResult> 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<pcOccupationChild> children { get; set; }
|
||||
}
|
||||
|
||||
public class pcOccupationChild
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public List<pcOccupationChild> children { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -967,30 +967,31 @@ namespace New_College.Services
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取招生简章列表
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<MessageModel<List<RequestEnrollmentinproductionResult>>> GetRequestEnrollmentinproductionResult(UniversityIdQuery query)
|
||||
public MessageModel<List<GenBycollegeItem>> 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<List<RequestEnrollmentinproductionResult>>() { 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<RequestBaseResponse>("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<GenBycollegeobject>("http://192.168.104.104:3000/youzy.dms.basiclib.api.college.news.bycollege.get",query);
|
||||
if (info.isSuccess == true)
|
||||
{
|
||||
return new MessageModel<List<RequestEnrollmentinproductionResult>>() { success = false, msg = "请求失败" };
|
||||
return new MessageModel<List<GenBycollegeItem>>()
|
||||
{
|
||||
success = true,
|
||||
msg = "获取成功",
|
||||
response = info.result.items.ToList()
|
||||
};
|
||||
}
|
||||
return new MessageModel<List<RequestEnrollmentinproductionResult>>()
|
||||
return new MessageModel<List<GenBycollegeItem>>()
|
||||
{
|
||||
success = info.Success,
|
||||
msg = "获取成功",
|
||||
response = info.Data
|
||||
success = info.isSuccess,
|
||||
msg = "获取失败",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace New_College.Services
|
|||
/// <returns></returns>
|
||||
public async Task<AIGOPageModel<AIGOResponse>> GetAIGoList(OneSubmitGoRequest request)
|
||||
{
|
||||
request.PageSize = request.PageSize > 20 ? 20 : request.PageSize;
|
||||
var claim = request.SubjectClaim.Split(",", StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
var pagemodel = new AIGOPageModel<AIGOResponse>();
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue