diff --git a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs index 4cbfea7..3b94117 100644 --- a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs +++ b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs @@ -66,8 +66,8 @@ namespace New_College.Api.Controllers return new MessageModel() { response = query, - success = query != null ? true : false, - msg = query != null ? "获取成功" : "获取失败" + success = query != null&&query.itemViews!=null ? true : false, + msg = query != null && query.itemViews != null ? "获取成功" : "获取失败" }; } /// diff --git a/New_College.Api/Dockerfile b/New_College.Api/Dockerfile index a11cb72..f2efb7e 100644 --- a/New_College.Api/Dockerfile +++ b/New_College.Api/Dockerfile @@ -32,5 +32,5 @@ RUN echo 'Asia/Shanghai' >/etc/timezone #&& supervisord -c /etc/supervisord.conf WORKDIR /app COPY . . -EXPOSE 8083 +EXPOSE 8082 ENTRYPOINT ["dotnet", "New_College.Api.dll","-b","0.0.0.0"] \ No newline at end of file diff --git a/New_College.Api/appsettings.Development.json b/New_College.Api/appsettings.Development.json index e203e94..5a43355 100644 --- a/New_College.Api/appsettings.Development.json +++ b/New_College.Api/appsettings.Development.json @@ -1,9 +1,220 @@ { + "Weixin": { + "Appid": "wx05e75004e657527c", + "Secret": "9383aa5517e1d6bf23404dce9c86b0f1", + //MCHID + "MCHID": "1614987630", + //MCHKey + "KEY": "brapuk6fon0wachiMlth2t3lb4a0h7ji", + //NotifyUrl + "NotifyUrl": "https://zytb.ycymedu.com/api/front/WeixinPay/PayNotify" + }, "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" + "IncludeScopes": false, + "Debug": { + "LogLevel": { + "Default": "Warning" + } + }, + "Console": { + "LogLevel": { + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Debug" + } + }, + "Log4Net": { + "Name": "New_College" } + }, + "urls": "http://*:8082", // IIS 部署,注释掉 + "AllowedHosts": "*", + "AppSettings": { + "RedisCachingAOP": { + "Enabled": true, + "ConnectionString": "127.0.0.1:6379", + "Password": "Vs_.127134" + }, + "MemoryCachingAOP": { + "Enabled": true + }, + "LogAOP": { + "Enabled": false + }, + "TranAOP": { + "Enabled": false + }, + "SqlAOP": { + "Enabled": false + }, + "Date": "2018-08-28", + "SeedDBEnabled": true, //只生成表结构 + "SeedDBDataEnabled": false, //生成表,并初始化数据 + "Author": "New_College" + }, + + // 请配置MainDB为你想要的主库的ConnId值,并设置对应的Enabled为true; + // *** 单库操作,把 MutiDBEnabled 设为false ***; + // *** 多库操作,把 MutiDBEnabled 设为true,其他的从库Enabled也为true **; + // 具体配置看视频:https://www.bilibili.com/video/BV1BJ411B7mn?p=6 + + "MainDB": "WMBLOG_MYSQL", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "MutiDBEnabled": false, //是否开启多库模式 + "CQRSEnabled": false, //是否开启读写分离模式,必须是单库模式,且数据库类型一致,比如都是SqlServer + "DBS": [ + /* + 对应下边的 DBType + MySql = 0, + SqlServer = 1, + Sqlite = 2, + Oracle = 3, + PostgreSQL = 4 + */ + { + "ConnId": "WMBLOG_SQLITE", + "DBType": 2, + "Enabled": false, + "HitRate": 50, // 值越大,优先级越高 + "Connection": "WMBlog.db" //sqlite只写数据库名就行 + }, + { + "ConnId": "WMBLOG_MSSQL_1", + "DBType": 1, + "Enabled": false, + "HitRate": 40, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMBLOG_MSSQL_1;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMBLOG_MSSQL_2", + "DBType": 1, + "Enabled": false, + "HitRate": 30, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMBLOG_MSSQL_2;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMBLOG_MYSQL", + "DBType": 0, + "Enabled": true, + "HitRate": 20, + "Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4" + }, + { + "ConnId": "WMBLOG_ORACLE", + "DBType": 3, + "Enabled": false, + "HitRate": 10, + "Connection": "Provider=OraOLEDB.Oracle; Data Source=WMBlogDB; User Id=sss; Password=789;", + "OracleConnection_other1": "User ID=sss;Password=789;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.8.65)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME = orcl)))" + } + ], + "Audience": { + "Secret": "sdfsdfsrty25634kkhllghtdgdfss345t678fs", //不要太短,16位+ + "SecretFile": "C:\\my-file\\new_college.audience.secret.txt", //安全。内容就是Secret + "Issuer": "New_College", + "Audience": "wr" + }, + "Startup": { + "Cors": { + "PolicyName": "CorsIpAccess", //策略名称 + "EnableAllIPs": true, //是否应用所有的IP + // 支持多个域名端口,注意端口号后不要带/斜杆:比如localhost:8000/,是错的 + // 注意,http://127.0.0.1:1818 和 http://localhost:1818 是不一样的 + "IPs": "http://192.168.100.129:8081" + }, + "AppConfigAlert": { + "Enabled": true + }, + "ApiName": "New_College", + "IdentityServer4": { + "Enabled": false, // 这里默认是false,表示使用jwt,如果设置为true,则表示系统使用Ids4模式 + "AuthorizationUrl": "https://ids.neters.club", // 认证中心域名 + "ApiName": "new_college.api" // 资源服务器 + } + }, + "Middleware": { + "RequestResponseLog": { + "Enabled": false + }, + "IPLog": { + "Enabled": true + }, + "RecordAccessLogs": { + "Enabled": true + }, + "SignalR": { + "Enabled": false + }, + "QuartzNetJob": { + "Enabled": true + }, + "Consul": { + "Enabled": false + }, + "IpRateLimit": { + "Enabled": true + } + }, + "IpRateLimiting": { + "EnableEndpointRateLimiting": true, //False: globally executed, true: executed for each + "StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter + "RealIpHeader": "X-Real-IP", + "ClientIdHeader": "X-ClientId", + "IpWhitelist": [], //ip访问白名单 + "EndpointWhitelist": [ "get:/api/xxx", "*:/api/yyy" ], + "ClientWhitelist": [ "dev-client-1", "dev-client-2" ], + "HttpStatusCode": 429, //返回状态码 + "GeneralRules": [ //api规则,结尾一定要带* + { + "Endpoint": "*:/api/blog*", + "Period": "1m", + "Limit": 200000 + }, + { + "Endpoint": "*/api/*", + "Period": "1s", + "Limit": 300000 + }, + { + "Endpoint": "*/api/*", + "Period": "1m", + "Limit": 3000000 + }, + { + "Endpoint": "*/api/*", + "Period": "12h", + "Limit": 50000000000 + } + ] + + }, + "ConsulSetting": { + "ServiceName": "BlogCoreService", + "ServiceIP": "localhost", + "ServicePort": "8081", + "ServiceHealthCheck": "/healthcheck", + "ConsulAddress": "http://localhost:8500" + }, + "AliyunSmsSenderConfig": { + "accessKeyId": "LTAI4GK6SGUmMX3J9Wyzyt6C", + "accessKeySecret": "vTUjL4so42kiuctWEb6WoaxtXs3MLS" + }, + + "AliYunOss": { + "wendpoint": "https://static-data.ycymedu.com", + "accessKeyId": "LTAI5tKs3TXSbt7E4WMDcxwR", + "accessKeySecret": "EvC8MjRaQC1kHubgU4MtecZnofOb0v", + "bucket": "static-data-ycymedu", + "endpoint": "https://oss-cn-shanghai.aliyuncs.com" + }, + "Casdoor": { + "Endpoint": "http://192.168.103.119:8000", + "OrganizationName": "六纬生涯", + "ApplicationName": "六纬生涯", + "ApplicationType": "webapi", + "ClientId": "4c6d761417dbbdd665be", + "ClientSecret": "cc385a5d0efd5f7bf693d8c4574126158f7b0a8f", + "CallbackPath": "http://test.sso.ycymedu.com/login/oauth/authorize?client_id=4c6d761417dbbdd665be&response_type=code&redirect_uri=http://192.168.100.129:8081/Home/FirstPage&scope=read&state=casdoor", + "RequireHttpsMetadata": false } } diff --git a/New_College.Api/start.sh b/New_College.Api/start.sh index 4b3a9ed..c8a99a1 100644 --- a/New_College.Api/start.sh +++ b/New_College.Api/start.sh @@ -1,23 +1,23 @@ #! /bin/bash -echo "newcollage-api..." +echo "pcnewcollage-api..." sleep 3 -docker stop newcollage-api +docker stop pcnewcollage-api sleep 2 -docker rm newcollage-api +docker rm pcnewcollage-api -docker rmi newcollage-api +docker rmi pcnewcollage-api echo "" -echo "newcollage-api packing..." +echo "pcnewcollage-api packing..." sleep 3 -docker build -t newcollage-api . +docker build -t pcnewcollage-api . echo "" -echo "newcollage-api running..." +echo "pcnewcollage-api running..." sleep 3 docker run \ - -p 8083:8083 \ - --name newcollage-api \ - -d newcollage-api + -p 8082:8082 \ + --name pcnewcollage-api \ + -d pcnewcollage-api diff --git a/New_College.Services/D_PlanMajorDescProServices.cs b/New_College.Services/D_PlanMajorDescProServices.cs index 48ad5d1..2c42078 100644 --- a/New_College.Services/D_PlanMajorDescProServices.cs +++ b/New_College.Services/D_PlanMajorDescProServices.cs @@ -45,26 +45,30 @@ namespace New_College.Services .And(c => c.Years == request.Year) .ToExpression(); var query = await _dal.Query(expression); - var view = query.First(); - majorview.UId = view.UId; - majorview.UniversityName = view.Location; - majorview.UniversityCode = view.EnrollmentCode; - majorview.itemViews = query.Select(c => new MajorPlanProItemView() + if (query.Any()) { - BatchName = c.BatchName, - fee = c.Free, - Major = c.Major, - MajorCode = c.MajorCode, - MajorGroup = c.MajorGroup, - MajorRemark = c.Remark, - planCount = c.PlanCount, - NewCount = c.NewCount, - OldPlanCount = c.PlanCount + c.NewCount, - SubjectClam = c.SelectSubject, - Years = c.Years, - OldYears = c.Years - 1, - AcademicYear = c.AcademicYear - }).ToList(); + var view = query.FirstOrDefault(); + majorview.UId = view.UId; + majorview.UniversityName = view.Location; + majorview.UniversityCode = view.EnrollmentCode; + + majorview.itemViews = query.Select(c => new MajorPlanProItemView() + { + BatchName = c.BatchName, + fee = c.Free, + Major = c.Major, + MajorCode = c.MajorCode, + MajorGroup = c.MajorGroup, + MajorRemark = c.Remark, + planCount = c.PlanCount, + NewCount = c.NewCount, + OldPlanCount = c.PlanCount + c.NewCount, + SubjectClam = c.SelectSubject, + Years = c.Years, + OldYears = c.Years - 1, + AcademicYear = c.AcademicYear + }).ToList(); + } return majorview; }