mirror of
https://gitee.com/yuebon/YuebonNetCore.git
synced 2025-12-06 08:28:58 +08:00
添加容器
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Yuebon.Commons.Log;
|
||||
using Yuebon.Security.Services.IntegrationEvents.Events;
|
||||
|
||||
namespace Yuebon.Extensions.ServiceExtensions;
|
||||
|
||||
@@ -18,11 +18,11 @@ public static class UiFilesZipSetup
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
string wwwrootFolderPath = Path.Combine(_env.ContentRootPath, "wwwroot");
|
||||
string zipUiItemFiles = Path.Combine(wwwrootFolderPath, "ui.zip");
|
||||
if (!File.Exists(Path.Combine(wwwrootFolderPath, "ui", "index.html")))
|
||||
{
|
||||
ZipFile.ExtractToDirectory(zipUiItemFiles, wwwrootFolderPath);
|
||||
}
|
||||
//string wwwrootFolderPath = Path.Combine(_env.ContentRootPath, "wwwroot");
|
||||
//string zipUiItemFiles = Path.Combine(wwwrootFolderPath, "ui.zip");
|
||||
//if (!File.Exists(Path.Combine(wwwrootFolderPath, "ui", "index.html")))
|
||||
//{
|
||||
// ZipFile.ExtractToDirectory(zipUiItemFiles, wwwrootFolderPath);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
53
Yuebon.Gateway/GlobalUsings.cs
Normal file
53
Yuebon.Gateway/GlobalUsings.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
global using Autofac;
|
||||
global using Autofac.Extensions.DependencyInjection;
|
||||
global using AutoMapper;
|
||||
global using log4net;
|
||||
global using log4net.Repository;
|
||||
global using Microsoft.AspNetCore.Authorization;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using Microsoft.AspNetCore.Http;
|
||||
global using Microsoft.AspNetCore.HttpOverrides;
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Microsoft.Extensions.Logging;
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Reflection;
|
||||
global using System.Text.Encodings.Web;
|
||||
global using System.Text.Json;
|
||||
global using System.Text.Unicode;
|
||||
global using System.Threading.Tasks;
|
||||
global using UAParser;
|
||||
global using Yitter.IdGenerator;
|
||||
global using Yuebon.AspNetCore.Common;
|
||||
global using Yuebon.AspNetCore.Controllers;
|
||||
global using Yuebon.AspNetCore.Models;
|
||||
global using Yuebon.AspNetCore.Mvc;
|
||||
global using Yuebon.AspNetCore.Mvc.Filter;
|
||||
global using Yuebon.Commons.Cache;
|
||||
global using Yuebon.Commons.Converter;
|
||||
global using Yuebon.Commons.Core.App;
|
||||
global using Yuebon.Core.Dtos;
|
||||
global using Yuebon.Core.UnitOfWork;
|
||||
global using Yuebon.Commons.Extend;
|
||||
global using Yuebon.Commons.Extensions;
|
||||
global using Yuebon.Commons.Filters;
|
||||
global using Yuebon.Commons.Helpers;
|
||||
global using Yuebon.Commons.Json;
|
||||
global using Yuebon.Commons.Log;
|
||||
global using Yuebon.Commons.Mapping;
|
||||
global using Yuebon.Commons.Result;
|
||||
global using Yuebon.Commons.Net;
|
||||
global using Yuebon.Commons.Options;
|
||||
global using Yuebon.Core.SeedInitData;
|
||||
global using Yuebon.Extensions.ServiceExtensions;
|
||||
global using Yuebon.Security.Dtos;
|
||||
global using Yuebon.Security.IServices;
|
||||
global using Yuebon.Security.Models;
|
||||
global using MediatR;
|
||||
@@ -18,8 +18,20 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CMS\Yuebon.CMS.Services\Yuebon.CMS.Services.csproj" />
|
||||
<ProjectReference Include="..\Security\Yuebon.Security.Dtos\Yuebon.Security.Dtos.csproj" />
|
||||
<ProjectReference Include="..\Security\Yuebon.Security.Services\Yuebon.Security.Services.csproj" />
|
||||
<ProjectReference Include="..\Yuebon.CodeGenerator.Core\Yuebon.CodeGenerator.Core.csproj" />
|
||||
<ProjectReference Include="..\Yuebon.Extensions\Yuebon.Extensions.csproj" />
|
||||
<ProjectReference Include="..\Yuebon.NetCore\Yuebon.AspNetCore\Yuebon.AspNetCore.csproj" />
|
||||
<ProjectReference Include="..\Yuebon.NetCore\Yuebon.Quartz.Jobs\Yuebon.Quartz.Jobs.csproj" />
|
||||
<ProjectReference Include="..\Yuebon.NetCore\Yuebon.SMS.Core\Yuebon.SMS.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,9 +1,116 @@
|
||||
{
|
||||
//"urls": "http://*:5002", //web服务端口,如果用IIS部署,把这个去掉
|
||||
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
},
|
||||
"Console": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"Jwt": {
|
||||
"Secret": "Y2F0Y2yhciUyMHdvbmclMFWfsaZlJTIwLm5ldA==",
|
||||
"Issuer": "YuebonTeach",
|
||||
"Audience": "api",
|
||||
"Expiration": 120, //过期时长,分钟,
|
||||
"refreshJwtTime": 240 //有效刷新时间,分钟
|
||||
},
|
||||
/**
|
||||
[{
|
||||
"ConnId": "LocalDB",
|
||||
"Enabled": true,true //是否可用
|
||||
"MasterDB": { //主库
|
||||
"ConnectionString": "server=localhost;Database=bonwcslocal1;Uid=root;Pwd=123456;Port=3306;CharSet=utf8mb4;Allow User Variables=True;SslMode=none;AllowLoadLocalInfile=true;",
|
||||
"DatabaseType": 0, //数据库类型取值:mysql=0,SqlServer=1,SQLite=2,Oracle=3,PostgreSQL=4,Dm=5,Kdbndp=6
|
||||
"Enabled": true //是否可用
|
||||
},
|
||||
"ReadDB": [//只读库
|
||||
{
|
||||
"ConnectionString": "", //数据库连接字符
|
||||
"HitRate": 10, //从库执行访问权重,越大越先执行
|
||||
"Enabled": true //是否可用
|
||||
},
|
||||
{
|
||||
"ConnectionString": "", //数据库连接字符
|
||||
"HitRate": 20, //从库执行访问权重,越大越先执行
|
||||
"Enabled": true //是否可用
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
||||
*/
|
||||
|
||||
"DbConnections": [
|
||||
{
|
||||
"ConnId": "DefaultDb",
|
||||
"Enabled": true,
|
||||
"MasterDB": {
|
||||
"ConnectionString": "server=150.158.89.129;database=ybnfsaas;user=root;password=Yuebon!23;port=3306;CharSet=utf8mb4;Allow User Variables=True;SslMode=none;AllowLoadLocalInfile=true;", //"server=localhost;database=ybnfsaas;user=root;password=123456;port=3306;CharSet=utf8mb4;Allow User Variables=True;SslMode=none;AllowLoadLocalInfile=true;",
|
||||
"DatabaseType": 0,
|
||||
"Enabled": true
|
||||
},
|
||||
"ReadDB": []
|
||||
}
|
||||
],
|
||||
"AppSetting": {
|
||||
"SoftName": "YueBonCore Framework",
|
||||
"CertificatedCompany": "Yuebon",
|
||||
"ConStringEncrypt": "false",
|
||||
"DefaultDataBase": "DefaultDb",
|
||||
"MutiDBEnabled": true, //是否开启多库模式
|
||||
"IsDBReadWriteSeparate": false, //开启数据库读写分离
|
||||
"QueryDBStrategy": "Random", //定义多个从数据库的访问策略
|
||||
"LoginProvider": "Cookie",
|
||||
"AppId": "system",
|
||||
"AppSecret": "87135AB0160F706D8B47F06BDABA6FC6",
|
||||
"ApiUrl": "https://localhost:44363/api/",
|
||||
"FileUrl": "https://www.yuebon.com/",
|
||||
"AllowOrigins": "http://localhost:9528",
|
||||
"SessionTimeOut": "30", //session过期时长,分钟
|
||||
"SeedDBEnabled": false, //只生成表结构
|
||||
"SeedDBDataEnabled": false, //生成表,并初始化数据
|
||||
"IsTenant": true, //开启多租户
|
||||
"TenantHostDomain": "t.v.yuebon.com", //租户默认子域名
|
||||
"SqlAOP": {
|
||||
"Enabled": true
|
||||
},
|
||||
"OpenGlobal": false
|
||||
},
|
||||
"CacheProvider": {
|
||||
"UseRedis": false,
|
||||
"Redis_ConnectionString": "127.0.0.1:6379,allowAdmin=true,password=123456,defaultdatabase=0",
|
||||
"Redis_InstanceName": "yuebon_redis_"
|
||||
},
|
||||
"RabbitMQ": {
|
||||
"Enabled": false,
|
||||
"Connection": "127.0.0.1",
|
||||
"UserName": "guest",
|
||||
"Password": "guest",
|
||||
"RetryCount": 5
|
||||
},
|
||||
"EventBus": {
|
||||
"Enabled": false,
|
||||
"SubscriptionClientName": "yueboneventbus"
|
||||
},
|
||||
"SwaggerDoc": {
|
||||
"ContactName": "越邦科技",
|
||||
"ContactEmail": "cqinwn@yuebon.com",
|
||||
"ContactUrl": "http://www.yuebon.com",
|
||||
"TermsOfService": "http://docs.v.yuebon.com",
|
||||
"Description": "api接口采用token+签名验证,在使用swagger测试接口时须先获取Token;sign签名验证,必须填写false,api-version接口版本号,默认为1.0,可以不填写,其他版本必须填写。",
|
||||
"Title": "Yuebon 分选系统 API 文档"
|
||||
},
|
||||
"Middleware": {
|
||||
"QuartzNetJob": {
|
||||
"Enabled": true
|
||||
}
|
||||
},
|
||||
"Quartz": {
|
||||
"quartz.scheduler.instanceName": "yuebon_quartz"
|
||||
}
|
||||
}
|
||||
|
||||
85
Yuebon.Gateway/log4net.config
Normal file
85
Yuebon.Gateway/log4net.config
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<log4net xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<root>
|
||||
<!-- 控制级别,由低到高:ALL|DEBUG|INFO|WARN|ERROR|FATAL|OFF -->
|
||||
<level value="ALL"/>
|
||||
<appender-ref ref="ErrorRollingFileAppender"/>
|
||||
<appender-ref ref="WarnRollingFileAppender"/>
|
||||
<appender-ref ref="InfoRollingFileAppender"/>
|
||||
<appender-ref ref="DebugRollingFileAppender"/>
|
||||
</root>
|
||||
|
||||
<!--一般错误日志定义,用于记录已知需处理的与未捕获的异常-->
|
||||
<!--日志输出格式:[时间]:类名 线程号 消息-->
|
||||
<appender name="ErrorRollingFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="ERROR"/>
|
||||
<levelMax value="FATAL"/>
|
||||
</filter>
|
||||
<filter type="log4net.Filter.DenyAllFilter"/>
|
||||
<file value="logs/"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyy-MM-dd//"Error.log""/>
|
||||
<staticLogFileName value="false"/>
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="【%d{HH:mm:ss.fff}】 %c T%t %n%m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!--警告日志定义,用于记录已知不需处理的异常,系统警告信息-->
|
||||
<!--日志输出格式:[时间]:类名 线程号 消息-->
|
||||
<appender name="WarnRollingFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<filter type="log4net.Filter.LevelMatchFilter">
|
||||
<levelToMatch value="WARN"/>
|
||||
</filter>
|
||||
<filter type="log4net.Filter.DenyAllFilter"/>
|
||||
<file value="logs/"/>
|
||||
<appendToFile value="true"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyy-MM-dd//"Warn.log""/>
|
||||
<staticLogFileName value="false"/>
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="[%d{HH:mm:ss.fff}] %c T%t %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!--信息日志定义,用于记录用户相关信息-->
|
||||
<!--日志输出格式:[时间]:消息-->
|
||||
<appender name="InfoRollingFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<filter type="log4net.Filter.LevelMatchFilter">
|
||||
<levelToMatch value="INFO"/>
|
||||
</filter>
|
||||
<filter type="log4net.Filter.DenyAllFilter"/>
|
||||
<file value="logs/"/>
|
||||
<appendToFile value="true"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyy-MM-dd//"Info.log""/>
|
||||
<staticLogFileName value="false"/>
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="[%d{HH:mm:ss}] (%c) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!--信息日志定义,用于收集开发调试信息-->
|
||||
<!--日志输出格式:[时间]:类名 线程号 消息-->
|
||||
<appender name="DebugRollingFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<filter type="log4net.Filter.LevelMatchFilter">
|
||||
<levelToMatch value="DEBUG"/>
|
||||
</filter>
|
||||
<filter type="log4net.Filter.DenyAllFilter"/>
|
||||
<file value="logs/"/>
|
||||
<appendToFile value="true"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyy-MM-dd//"Debug.log""/>
|
||||
<staticLogFileName value="false"/>
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="[%d{HH:mm:ss.fff}] %c T%t: %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
</log4net>
|
||||
1
Yuebon.Gateway/xmlconfig/sys.config
Normal file
1
Yuebon.Gateway/xmlconfig/sys.config
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><SysSetting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SoftName>yueboncore演示租户</SoftName><SoftSummary>net &Vue前后端分离</SoftSummary><WebUrl>http://localhost:9528</WebUrl><SysLogo>https://localhost:44328/upload/20220223/20220223131624804046757.png</SysLogo><CompanyName>越邦科技</CompanyName><Address>上海市青浦区诸陆东路558号2楼(国家会展中心旁)</Address><Telphone>13524343287</Telphone><Email>DzTgXXxaXxCpfLcm0xWO7ti9dJRQQ4e+</Email><ICPCode>沪ICP备12045457号</ICPCode><PublicSecurityCode>沪公网安备 31011202004690号</PublicSecurityCode><Webstatus>0</Webstatus><Webclosereason>系统维护中,请联系管理员</Webclosereason><Webcountcode /><Smsapiurl>https://api.mix2.zthysms.com/v2/sendSms</Smsapiurl><Smsusername>BI4C58T7/eSjRxt+3NtIH0nihfh8nBq0xR1TS9WPrY0=</Smsusername><Smspassword>BI4C58T7/eSjRxt+3NtIH0nihfh8nBq0xR1TS9WPrY0=</Smspassword><Emailsmtp>WdE3ykjXk2TP0YrZl0nJeyYB4hCSG76j</Emailsmtp><Emailssl>true</Emailssl><Emailport>465</Emailport><Emailfrom>cqinwn@yuebon.com</Emailfrom><Emailusername>cqinwn@yuebon.com</Emailusername><Emailpassword>6nWEbxBJdQbFHVNL1Y+tjQ==</Emailpassword><Emailnickname>客服</Emailnickname><Fileserver>localhost</Fileserver><LocalPath>D:\NetSource\YuebonAdmin\Yuebon.WebApi\wwwroot</LocalPath><Filepath>upload</Filepath><Filesave>1</Filesave><Fileextension>gif,jpg,jpeg,png,bmp,rar,zip,doc,xls,txt,cer</Fileextension><Thumbnailheight>100</Thumbnailheight><Thumbnailwidth>100</Thumbnailwidth></SysSetting>
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
|
||||
<PackageReference Include="DotNetCore.NPOI" Version="1.2.3" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="MediatR" Version="10.0.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="10.0.1" />
|
||||
@@ -202,11 +202,11 @@
|
||||
<PackageReference Include="QRCoder" Version="1.4.3" />
|
||||
<PackageReference Include="Quartz" Version="3.4.0" />
|
||||
<PackageReference Include="SgmlReader.NetCore" Version="1.0.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.5" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="System.Management" Version="6.0.0" />
|
||||
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
using Yuebon.CMS.Dtos;
|
||||
using Yuebon.CMS.IServices;
|
||||
using Yuebon.CMS.Models;
|
||||
using Yuebon.Commons.Attributes;
|
||||
|
||||
namespace Yuebon.WebApi.Areas.CMS.Controllers.V1;
|
||||
|
||||
/// <summary>
|
||||
/// 文章,通知公告接口
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[ApiVersion("1.1")]
|
||||
[SwaggerControllerView("文章", "2.0.0")]
|
||||
[Route("api/CMS/[controller]")]
|
||||
public class ArticlenewsController : AreaApiController<Articlenews, ArticlenewsOutputDto,ArticlenewsInputDto,IArticlenewsService>
|
||||
{
|
||||
private IArticlecategoryService articlecategoryService;
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="_iService"></param>
|
||||
/// <param name="_articlecategoryService"></param>
|
||||
public ArticlenewsController(IArticlenewsService _iService,IArticlecategoryService _articlecategoryService) : base(_iService)
|
||||
{
|
||||
iService = _iService;
|
||||
articlecategoryService = _articlecategoryService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增前处理数据
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected override void OnBeforeInsert(Articlenews info)
|
||||
{
|
||||
info.Id = IdGeneratorHelper.IdSnowflake();
|
||||
info.CategoryName = articlecategoryService.GetById(info.CategoryId)?.Title;
|
||||
info.CreatorTime = DateTime.Now;
|
||||
info.CreatorUserId = CurrentUser.UserId;
|
||||
info.CompanyId = CurrentUser.OrganizeId;
|
||||
info.DeptId = CurrentUser.DeptId;
|
||||
info.DeleteMark = false;
|
||||
if (info.SortCode == null)
|
||||
{
|
||||
info.SortCode = 99;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在更新数据前对数据的修改操作
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
protected override void OnBeforeUpdate(Articlenews info)
|
||||
{
|
||||
info.CategoryName = articlecategoryService.GetById(info.CategoryId).Title;
|
||||
info.LastModifyUserId = CurrentUser.UserId;
|
||||
info.LastModifyTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在软删除数据前对数据的修改操作
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
protected override void OnBeforeSoftDelete(Articlenews info)
|
||||
{
|
||||
info.DeleteMark = true;
|
||||
info.DeleteTime = DateTime.Now;
|
||||
info.DeleteUserId = CurrentUser.UserId;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 异步更新数据
|
||||
/// </summary>
|
||||
/// <param name="tinfo"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Update")]
|
||||
[YuebonAuthorize("Edit")]
|
||||
public override async Task<IActionResult> UpdateAsync(ArticlenewsInputDto tinfo)
|
||||
{
|
||||
CommonResult result = new CommonResult();
|
||||
|
||||
Articlenews info = iService.GetById(tinfo.Id);
|
||||
info.CategoryId = tinfo.CategoryId;
|
||||
info.Title = tinfo.Title;
|
||||
info.EnabledMark = tinfo.EnabledMark;
|
||||
info.SortCode = tinfo.SortCode;
|
||||
info.Description = tinfo.Description;
|
||||
info.SubTitle = tinfo.SubTitle;
|
||||
info.LinkUrl = tinfo.LinkUrl;
|
||||
info.IsHot = tinfo.IsHot;
|
||||
info.IsNew = tinfo.IsNew;
|
||||
info.IsRed = tinfo.IsRed;
|
||||
info.IsTop = tinfo.IsTop;
|
||||
|
||||
OnBeforeUpdate(info);
|
||||
bool bl = await iService.UpdateAsync(info);
|
||||
if (bl)
|
||||
{
|
||||
result.ErrCode = ErrCode.successCode;
|
||||
result.ErrMsg = ErrCode.err0;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.ErrMsg = ErrCode.err43002;
|
||||
result.ErrCode = "43002";
|
||||
}
|
||||
return ToJsonContent(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取分类及该分类文章标题
|
||||
/// </summary>
|
||||
[HttpGet("GetCategoryArticle")]
|
||||
[AllowAnonymous]
|
||||
public virtual async Task<IActionResult> GetCategoryArticle()
|
||||
{
|
||||
CommonResult result = new CommonResult();
|
||||
result.ResData = await iService.GetCategoryArticleList();
|
||||
result.ErrCode = ErrCode.successCode;
|
||||
result.ErrMsg = ErrCode.err0;
|
||||
return ToJsonContent(result);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class CaptchaController : ApiController
|
||||
public async Task<CommonResult<AuthGetVerifyCodeOutputDto>> CaptchaAsync()
|
||||
{
|
||||
Captcha captcha = new Captcha();
|
||||
var code =await captcha.GenerateRandomCaptchaAsync().ConfigureAwait(false);
|
||||
var code =await captcha.GenerateRandomCaptchaAsync();
|
||||
var result =await captcha.GenerateCaptchaImageAsync(code);
|
||||
YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
|
||||
TimeSpan expiresSliding = DateTime.Now.AddMinutes(5) - DateTime.Now;
|
||||
|
||||
@@ -39,6 +39,7 @@ RUN dotnet build "Yuebon.WebApi.csproj" -c Release -o /app/build
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "Yuebon.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
@@ -18,11 +18,6 @@ builder.Host
|
||||
builder.AddFilter("Microsoft", LogLevel.Error);
|
||||
builder.SetMinimumLevel(LogLevel.Error);
|
||||
builder.AddLog4Net(Path.Combine(Directory.GetCurrentDirectory(), "log4net.config"));
|
||||
})
|
||||
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||
{
|
||||
config.Sources.Clear();
|
||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
|
||||
});
|
||||
|
||||
ILoggerRepository loggerRepository = LogManager.CreateRepository("NETCoreRepository");
|
||||
@@ -142,7 +137,7 @@ app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
options.DocumentTitle = Appsettings.Configuration.GetSection("SwaggerDoc:Title").Value;
|
||||
typeof(ApiVersions).GetEnumNames().OrderByDescending(e => e).ToList().ForEach(version =>
|
||||
typeof(ApiVersions).GetEnumNames().OrderBy(e => e).ToList().ForEach(version =>
|
||||
{
|
||||
options.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{Appsettings.Configuration.GetSection("SwaggerDoc:Title").Value + version.ToUpperInvariant()}");
|
||||
options.RoutePrefix = string.Empty;//这里主要是不需要再输入swagger这个默认前缀
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
"FileUrl": "https://www.yuebon.com/",
|
||||
"AllowOrigins": "http://localhost:9528",
|
||||
"SessionTimeOut": "30", //session过期时长,分钟
|
||||
"SeedDBEnabled": true, //只生成表结构
|
||||
"SeedDBDataEnabled": true, //生成表,并初始化数据
|
||||
"SeedDBEnabled": false, //只生成表结构
|
||||
"SeedDBDataEnabled": false, //生成表,并初始化数据
|
||||
"IsTenant": true, //开启多租户
|
||||
"TenantHostDomain": "t.v.yuebon.com", //租户默认子域名
|
||||
"SqlAOP": {
|
||||
|
||||
@@ -51,8 +51,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yuebon.Security.Services",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yuebon.VisualDev", "Yuebon.VisualDev\Yuebon.VisualDev.csproj", "{7FE0B499-CAA9-4EC9-9605-F57852DDA99D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProductServiceApi", "ProductServiceApi\ProductServiceApi.csproj", "{C01F8B89-81B3-460B-9CF6-2D623BAB4A41}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01 核心", "01 核心", "{DCCDC288-E8B0-4841-8F48-1E9B3C701E67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yuebon.EventBus", "Yuebon.EventBus\Yuebon.EventBus.csproj", "{67953E77-2C05-4D98-A75B-7BDAB24F5C31}"
|
||||
@@ -169,10 +167,6 @@ Global
|
||||
{7FE0B499-CAA9-4EC9-9605-F57852DDA99D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FE0B499-CAA9-4EC9-9605-F57852DDA99D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FE0B499-CAA9-4EC9-9605-F57852DDA99D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C01F8B89-81B3-460B-9CF6-2D623BAB4A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C01F8B89-81B3-460B-9CF6-2D623BAB4A41}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C01F8B89-81B3-460B-9CF6-2D623BAB4A41}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C01F8B89-81B3-460B-9CF6-2D623BAB4A41}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{67953E77-2C05-4D98-A75B-7BDAB24F5C31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67953E77-2C05-4D98-A75B-7BDAB24F5C31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67953E77-2C05-4D98-A75B-7BDAB24F5C31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
18
docker-compose.dcproj
Normal file
18
docker-compose.dcproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>7073b756-5ee6-45bd-91ff-043e75b3f75c</ProjectGuid>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
|
||||
<DockerServiceName>yuebon.gateway</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="docker-compose.override.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.yml" />
|
||||
<None Include=".dockerignore" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
23
docker-compose.override.yml
Normal file
23
docker-compose.override.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
yuebon.webapi:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:443;http://+:80
|
||||
ports:
|
||||
- "80"
|
||||
- "443"
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
yuebon.gateway:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:443;http://+:80
|
||||
ports:
|
||||
- "80"
|
||||
- "443"
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
yuebon.webapi:
|
||||
image: ${DOCKER_REGISTRY-}yuebonwebapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Yuebon.WebApi/Dockerfile
|
||||
|
||||
yuebon.gateway:
|
||||
image: ${DOCKER_REGISTRY-}yuebongateway
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Yuebon.Gateway/Dockerfile
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user