commit f552838306bda129b404dcfd98ae44507c3799ba
Author: zhuxiaojiong <645680426@qq.com>
Date: Sat Jun 28 11:11:19 2025 +0800
init
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9491a2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,363 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
\ No newline at end of file
diff --git a/Cms.Core.Entity/Cms.Core.Entity.csproj b/Cms.Core.Entity/Cms.Core.Entity.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/Cms.Core.Entity/Cms.Core.Entity.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/Cms.Core.Entity/Wework.cs b/Cms.Core.Entity/Wework.cs
new file mode 100644
index 0000000..0e1a1c3
--- /dev/null
+++ b/Cms.Core.Entity/Wework.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Cms.Core.Entity
+{
+ public class Wework
+ {
+ [Key]
+ public int Id { get; set; }
+ public string? Name { get; set; }
+ public string? Appid { get; set; }
+ public int Status { get; set; }
+ public int Autotype { get; set; } //用户功能自动同步
+ public int Companyid { get; set; }
+ public string? Wechatappid { get; set; }
+ }
+}
diff --git a/Cms.Core.Entity/WeworkAgent.cs b/Cms.Core.Entity/WeworkAgent.cs
new file mode 100644
index 0000000..726eeda
--- /dev/null
+++ b/Cms.Core.Entity/WeworkAgent.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Cms.Core.Entity
+{
+ public class WeworkAgent
+ {
+ [Key]
+ public int Id { get; set; }
+ public string? Appid { get; set; }
+ public int Agentid { get; set; }
+ public string? Name { get; set; }
+ public string? Secret { get; set; }
+ public int Close { get; set; }
+ public int Deptid { get; set; }
+ public string? Partyid { get; set; }
+ public int? Isdefault { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Cms.Core.Entity/ZhiboSystemDiscussion.cs b/Cms.Core.Entity/ZhiboSystemDiscussion.cs
new file mode 100644
index 0000000..0231542
--- /dev/null
+++ b/Cms.Core.Entity/ZhiboSystemDiscussion.cs
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Cms.Core.Entity
+{
+ public class ZhiboSystemDiscussion
+ {
+ [Key]
+ public int Id { get; set; }
+ ///
+ /// 0、私聊;1、公开;3、删除;
+ ///
+ public int Type { get; set; }
+ ///
+ /// 违法类型
+ ///
+ public Illegaltype Illegaltype { get; set; }
+ ///
+ /// 消息类型
+ ///
+ public Msgtype Msgtype { get; set; }
+ ///
+ /// 内容
+ ///
+ public string? Msg { get; set; }
+ ///
+ /// 时间
+ ///
+ public DateTime Msgtime { get; set; }
+ ///
+ /// 课程ID
+ ///
+ public int Scheduleid { get; set; }
+ ///
+ /// 平台ID
+ ///
+ public string? Appid { get; set; }
+ ///
+ /// 用户user
+ ///
+ public string? Appuserid { get; set; }
+ ///
+ /// 用户信息
+ ///
+ public string? Userinfo { get; set; }
+ ///
+ /// 用户类型,0、普通用户,1、分析师等管理者
+ ///
+ public Usertype Usertype { get; set; }
+ public string? Ip { get; set; }
+ public int Toid { get; set; }
+ public string? Touserinfo { get; set; }
+ public string? Toappid { get; set; }
+ public string? Toappuserid { get; set; }
+ public int Tomsgtype { get; set; }
+ public string? Tomsg { get; set; }
+ public int Deptid { get; set; }
+ public int Eid { get; set; }
+ public int Roomid { get; set; }
+ }
+
+ public enum Usertype
+ {
+ [Description("机器人")]
+ 机器人 = -1,
+ [Description("普通用户")]
+ 普通用户 = 0,
+ [Description("管理员")]
+ 管理员 = 1,
+ }
+
+ public enum Msgtype
+ {
+ [Description("文字")]
+ 文字 = 0,
+ [Description("图片")]
+ 图片 = 1,
+ [Description("礼物")]
+ 礼物 = 2,
+ [Description("链接")]
+ 链接 = 3,
+ //高级礼物 = 4,
+ [Description("购物车")]
+ 购物车 = 5,
+ }
+
+ public enum MsgtypeMid
+ {
+ 文字 = 0,
+ 图片 = 1,
+ 链接 = 3,
+ }
+
+ public enum Type
+ {
+ 未审核 = 0,
+ 已审核 = 1,
+ 黑名单 = 2,
+ 删除 = 3,
+ }
+
+ public enum TypeMin
+ {
+ 未审核 = 0,
+ 已审核 = 1,
+ }
+
+ public enum Illegaltype
+ {
+ 正常 = 0,
+ 用户黑名单 = 1,
+ IP黑色单 = 2,
+ 敏感词 = 3,
+ }
+}
diff --git a/Cms.Core.Entity/ZhiboSystemRoom.cs b/Cms.Core.Entity/ZhiboSystemRoom.cs
new file mode 100644
index 0000000..81102c7
--- /dev/null
+++ b/Cms.Core.Entity/ZhiboSystemRoom.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Cms.Core.Entity
+{
+ public class ZhiboSystemRoom
+ {
+ [Key]
+ public int Id { get; set; }
+ public string? Title { get; set; }// 标题
+ public string? Cmsmemo { get; set; } //CMS后台专用,备注用,不对外公开
+ public string? Memo { get; set; }//简介
+ public string? Content { get; set; }//详细
+ public string? Img { get; set; }//图片
+ public string? Banner { get; set; }//图片
+ public string? Bannerbig { get; set; }//图片
+ public int Orders { get; set; }// 排序
+ public int Status { get; set; }
+ public int Deptid { get; set; }
+ public string? Sharetxt { get; set; }
+ public string? Sharethumb { get; set; }
+ public int Pcmodelid { get; set; }
+ public int H5modelid { get; set; }
+ public int Checktype { get; set; }//判断是否收集手机号
+ public int Authtype { get; set; }//强制获取头像昵称
+ public string? Authappid { get; set; }//强制获取头像昵称使用的APPid
+ public int Commentcleantype { get; set; } //评论清屏
+ public int Giftid { get; set; }
+ public string? Contact { get; set; }//客服功能
+ public int Contactstatus { get; set; }//开启客服功能
+ public string? Assignremark { get; set; }
+ public int? Assigngroupid { get; set; }
+ }
+}
diff --git a/Cms.Core.Entity/ZhiboSystemSchedules.cs b/Cms.Core.Entity/ZhiboSystemSchedules.cs
new file mode 100644
index 0000000..6707531
--- /dev/null
+++ b/Cms.Core.Entity/ZhiboSystemSchedules.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Cms.Core.Entity
+{
+ public class ZhiboSystemSchedules
+ {
+ [Key]
+ public int Id { get; set; }
+ public int Commenttype { get; set; }//评论审核开关:1、不审,2、审核
+ public string? Title { get; set; }//课堂或标题
+ public string? Cmsmemo { get; set; }//cmsmemo
+ public string? Lecturer { get; set; }//分析师ID
+ public string? Weeks { get; set; }//周几、数字,多个以“,”分开,如:1,2,3
+ public string? Starttime { get; set; }//开课时间 09:00
+ public string? Endtime { get; set; }//结束时间 09:30
+ public int Pretime { get; set; }//预热:单位,分钟,比开课时间提交打开直接流
+ public int Suftime { get; set; }//加时:单位,分钟,比结束时间退后关闭直接流
+ public string? Memo { get; set; }//简介或导读
+ public int Livestreamid { get; set; }//直播流id
+ public RoomType Roomtype { get; set; }//投放方式
+ public string? Newsclassid { get; set; }//回顾栏目id
+ public int Orders { get; set; }// 排序
+ public int Status { get; set; }
+ public string? Img { get; set; }//封面图
+ public string? Annid { get; set; } //公告关联id
+ public int Livesonoff { get; set; } //在线数据开关:在线人数,进出数据
+ public int Playbacktype { get; set; }
+ public MarketingType Marketingtype { get; set; } //营销类型:1、免费营销 10、升级营销 100、付费服务
+ public string? Dept { get; set; } //授权使用
+ }
+
+ public enum RoomType
+ {
+ [Description("直播间")]
+ 直播间 = 1,
+ [Description("工作室")]
+ 工作室 = 2
+ }
+ public enum MarketingType
+ {
+ [Description("免费营销")]
+ 免费营销 = 0,
+ [Description("付费服务")]
+ 付费服务 = 100
+ }
+}
diff --git a/Cms.Core.Entity/vo/WeWorkTagVo.cs b/Cms.Core.Entity/vo/WeWorkTagVo.cs
new file mode 100644
index 0000000..73899c4
--- /dev/null
+++ b/Cms.Core.Entity/vo/WeWorkTagVo.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Cms.Core.Entity.vo
+{
+ ///
+ /// 企业微信打标签
+ ///
+ public class WeWorkTagVo
+ {
+ ///
+ /// 账号类型
+ ///
+ public string appId { get; set; }
+ ///
+ /// 账号
+ ///
+ public string appUserid { get; set; }
+ ///
+ ///
+ ///
+ public string tagName { get; set; }
+
+ ///
+ /// 指定企业微信,如果指定了,那么只能按照指定的企业微信进行打标签,不会去查找所有关联的企微进行标签
+ ///
+ public string targAppId { get; set; }
+ }
+}
diff --git a/Cms.Core.EntityFramework/Cms.Core.EntityFramework.csproj b/Cms.Core.EntityFramework/Cms.Core.EntityFramework.csproj
new file mode 100644
index 0000000..f7d3e0e
--- /dev/null
+++ b/Cms.Core.EntityFramework/Cms.Core.EntityFramework.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Cms.Core.EntityFramework/DncmsbaseDbContext.cs b/Cms.Core.EntityFramework/DncmsbaseDbContext.cs
new file mode 100644
index 0000000..ae1046b
--- /dev/null
+++ b/Cms.Core.EntityFramework/DncmsbaseDbContext.cs
@@ -0,0 +1,41 @@
+using Cms.Core.Entity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Diagnostics;
+using Microsoft.Extensions.Logging;
+
+namespace Cms.Core.EntityFramework
+{
+ public class DncmsbaseDbContext : DbContext
+ {
+ public DncmsbaseDbContext(DbContextOptions options) : base(options)
+ {
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
+ {
+ var loggerFactory = new LoggerFactory();
+ loggerFactory.AddProvider(new EFLoggerProvider());
+ optionsBuilder.UseLoggerFactory(loggerFactory);
+ }
+ optionsBuilder.ConfigureWarnings(b => b.Ignore(CoreEventId.ContextInitialized));
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ }
+
+ public DbSet WeworkAgent { get; set; }
+
+ public DbSet Wework { get; set; }
+
+ public DbSet ZhiboSystemDiscussion { get; set; }
+
+ public DbSet ZhiboSystemSchedules { get; set; }
+
+ public DbSet ZhiboSystemRoom { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Cms.Core.WebApi/Cms.Core.WebApi.csproj b/Cms.Core.WebApi/Cms.Core.WebApi.csproj
new file mode 100644
index 0000000..c3d63e0
--- /dev/null
+++ b/Cms.Core.WebApi/Cms.Core.WebApi.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net6.0
+ enable
+ enable
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Cms.Core.WebApi/Config/CacheKeys.cs b/Cms.Core.WebApi/Config/CacheKeys.cs
new file mode 100644
index 0000000..9f7f326
--- /dev/null
+++ b/Cms.Core.WebApi/Config/CacheKeys.cs
@@ -0,0 +1,7 @@
+namespace Cms.Core.WebApi.Config
+{
+ internal static class CacheKeys
+ {
+ public const string DeptList = "dept_list";
+ }
+}
diff --git a/Cms.Core.WebApi/Config/SystemConfig.cs b/Cms.Core.WebApi/Config/SystemConfig.cs
new file mode 100644
index 0000000..01fa1d9
--- /dev/null
+++ b/Cms.Core.WebApi/Config/SystemConfig.cs
@@ -0,0 +1,12 @@
+namespace Cms.Core.WebApi.Config
+{
+ internal class SystemConfig
+ {
+ public string? ZxdCoreUrl { get; set; }
+
+ public string GetDepts()
+ {
+ return $"{ZxdCoreUrl}/Api/Deptment/Depts";
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/Controllers/BaseController.cs b/Cms.Core.WebApi/Controllers/BaseController.cs
new file mode 100644
index 0000000..ec42b40
--- /dev/null
+++ b/Cms.Core.WebApi/Controllers/BaseController.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Cms.Core.WebApi.Controllers
+{
+ [ApiController]
+ [Route("Api/[controller]")]
+ [Produces("application/json")]
+ public class BaseController : ControllerBase
+ {
+ }
+}
diff --git a/Cms.Core.WebApi/Controllers/LiveController.cs b/Cms.Core.WebApi/Controllers/LiveController.cs
new file mode 100644
index 0000000..a022d7a
--- /dev/null
+++ b/Cms.Core.WebApi/Controllers/LiveController.cs
@@ -0,0 +1,43 @@
+using Cms.Core.WebApi.Dtos;
+using Cms.Core.WebApi.Services.Impl;
+using DG.Core;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Cms.Core.WebApi.Controllers
+{
+ public class LiveController : BaseController
+ {
+ private readonly ILiveService _liveService;
+ public LiveController(ILiveService liveService)
+ {
+ _liveService = liveService;
+ }
+
+ ///
+ /// 直播间数据
+ ///
+ ///
+ ///
+ [HttpGet("Details")]
+ public async Task> GetLiveDetails([FromQuery] LiveDetailSearchDto dto)
+ {
+ return await _liveService.GetLiveDetails(dto);
+ }
+
+ ///
+ /// 获取直播间下拉
+ ///
+ ///
+ [HttpGet("Rooms")]
+ public async Task> GetRooms()
+ => await _liveService.GetRooms();
+
+ ///
+ /// 获取课程下拉
+ ///
+ ///
+ [HttpGet("Schedules")]
+ public async Task> GetSchedules()
+ => await _liveService.GetSchedules();
+ }
+}
diff --git a/Cms.Core.WebApi/Controllers/QueueController.cs b/Cms.Core.WebApi/Controllers/QueueController.cs
new file mode 100644
index 0000000..b5c8b73
--- /dev/null
+++ b/Cms.Core.WebApi/Controllers/QueueController.cs
@@ -0,0 +1,34 @@
+using Cms.Core.Entity.vo;
+using DG.Kafka;
+using Microsoft.AspNetCore.Mvc;
+using Serilog;
+
+namespace Cms.Core.WebApi.Controllers
+{
+ public class QueueController : BaseController
+ {
+ public QueueController()
+ {
+ }
+ [HttpPost("Send")]
+ public async Task Send([FromBody] dynamic data)
+ {
+ var consumers = KafkaClient.GetConsumers();
+ //await _kafkaProducer.ProduceAsync("crm-topic-2", data);
+ KafkaClient.SendMessage(consumers[0], data);
+ }
+
+ ///
+ /// 企业微信打标签接口
+ ///
+ ///
+ ///
+ [HttpPost("WeworkTag")]
+ public async Task WeworkTag([FromBody] WeWorkTagVo data)
+ {
+ var consumers = KafkaClient.GetConsumers();
+ //await _kafkaProducer.ProduceAsync("crm-topic-2", data);
+ KafkaClient.SendMessage(consumers[1], data);
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/Domain/CacheDomain.cs b/Cms.Core.WebApi/Domain/CacheDomain.cs
new file mode 100644
index 0000000..e9b39e9
--- /dev/null
+++ b/Cms.Core.WebApi/Domain/CacheDomain.cs
@@ -0,0 +1,51 @@
+using Cms.Core.WebApi.Config;
+using Cms.Core.WebApi.Domain.Impl;
+using DG.Core;
+using DG.Redis;
+using Zxd.Core.Shared.Dto;
+
+namespace Cms.Core.WebApi.Domain
+{
+ internal class CacheDomain : ICacheDomain
+ {
+ private readonly IHttpClient _httpClient;
+ private readonly IRedisManager _redisManager;
+ private readonly IMapper _mapper;
+ private readonly IConfiguration _configuration;
+ private readonly IHttpContextAccessor _httpContext;
+ private readonly SystemConfig _systemConfig;
+
+ public CacheDomain(IRedisManager redisManager,
+ IMapper mapper,
+ IConfiguration configuration,
+ IHttpContextAccessor httpContext,
+ IHttpClient httpClient)
+ {
+ _redisManager = redisManager;
+ _mapper = mapper;
+ _configuration = configuration;
+ _httpContext = httpContext;
+ _httpClient = httpClient;
+ _systemConfig = _configuration.GetSection("SystemConfig").Get();
+ }
+
+ public async Task> GetDeptments()
+ {
+ var key = $"{CacheKeys.DeptList}";
+ if (!await _redisManager.ExistsAsync(key))
+ {
+ var response = await _httpClient.GetAsync>>(_systemConfig.GetDepts());
+ if (response.Code == 0)
+ {
+ await _redisManager.SetAsync(key, response.Data, TimeSpan.FromDays(1));
+ return response.Data;
+ }
+ }
+ else
+ {
+ return await _redisManager.GetListAsync(key);
+ }
+ return new List();
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/Domain/Impl/ICacheDomain.cs b/Cms.Core.WebApi/Domain/Impl/ICacheDomain.cs
new file mode 100644
index 0000000..2ec4d2c
--- /dev/null
+++ b/Cms.Core.WebApi/Domain/Impl/ICacheDomain.cs
@@ -0,0 +1,10 @@
+using DG.Core;
+using Zxd.Core.Shared.Dto;
+
+namespace Cms.Core.WebApi.Domain.Impl
+{
+ internal interface ICacheDomain : IScopedDependency
+ {
+ Task> GetDeptments();
+ }
+}
diff --git a/Cms.Core.WebApi/Dtos/LiveDetailDto.cs b/Cms.Core.WebApi/Dtos/LiveDetailDto.cs
new file mode 100644
index 0000000..965b95f
--- /dev/null
+++ b/Cms.Core.WebApi/Dtos/LiveDetailDto.cs
@@ -0,0 +1,76 @@
+using Cms.Core.Entity;
+using DG.Tool;
+using System.Text.Json.Serialization;
+
+namespace Cms.Core.WebApi.Dtos
+{
+ public class LiveDetailDto
+ {
+ public int Id { get; set; }
+
+ ///
+ /// 违法类型
+ ///
+ [JsonIgnore]
+ public Illegaltype Illegaltype { get; set; }
+
+ ///
+ /// 违法类型
+ ///
+ public string? IllegaltypeStr { get { return Illegaltype.GetDescription(); } }
+
+ ///
+ /// 消息类型
+ ///
+ [JsonIgnore]
+ public Msgtype Msgtype { get; set; }
+
+ ///
+ /// 消息类型
+ ///
+ public string? MsgtypeStr { get { return Msgtype.GetDescription(); } }
+
+ ///
+ /// 内容
+ ///
+ public string? Msg { get; set; }
+
+ ///
+ /// 时间
+ ///
+ public DateTime Msgtime { get; set; }
+
+ ///
+ /// 营销类型
+ ///
+ [JsonIgnore]
+ public MarketingType? Marketingtype { get; set; }
+
+ ///
+ /// 营销类型
+ ///
+ public string? MarketingtypeStr { get { return Marketingtype?.GetDescription(); } }
+
+ ///
+ /// 课程
+ ///
+ public string? SchedulesTitle { get; set; }
+
+ ///
+ /// 直播间名称
+ ///
+ public string? LiveTitle { get; set; }
+
+ ///
+ /// 课程id
+ ///
+ [JsonIgnore]
+ public int? Scheduleid { get; set; }
+
+ ///
+ /// 直播间id
+ ///
+ [JsonIgnore]
+ public int? Roomid { get; set; }
+ }
+}
diff --git a/Cms.Core.WebApi/Dtos/LiveDetailSearchDto.cs b/Cms.Core.WebApi/Dtos/LiveDetailSearchDto.cs
new file mode 100644
index 0000000..c0a73ca
--- /dev/null
+++ b/Cms.Core.WebApi/Dtos/LiveDetailSearchDto.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Cms.Core.WebApi.Dtos
+{
+ public class LiveDetailSearchDto
+ {
+ [Required(ErrorMessage = "请输入Appid")]
+ public string? Appid { get; set; }
+
+ [Required(ErrorMessage = "请输入Appuserid")]
+ public string? Appuserid { get; set; }
+
+ public int? Scheduleid { get; set; }
+
+ public int? Roomid { get; set; }
+
+ public string? Msg { get; set; }
+ }
+}
diff --git a/Cms.Core.WebApi/InitConfiguration.cs b/Cms.Core.WebApi/InitConfiguration.cs
new file mode 100644
index 0000000..69d4849
--- /dev/null
+++ b/Cms.Core.WebApi/InitConfiguration.cs
@@ -0,0 +1,67 @@
+using Microsoft.Extensions.Configuration.Json;
+
+namespace Cms.Core.WebApi
+{
+ public class InitConfiguration
+ {
+
+ static IConfiguration Configuration { get; set; }
+
+
+
+ static InitConfiguration()
+ {
+ var appsettings = "appsettings.json";
+
+ if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != null
+ && Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Production")
+ {
+ var envAppsettings = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json";
+ Configuration = new ConfigurationBuilder()
+ .Add(new JsonConfigurationSource { Path = appsettings, Optional = false, ReloadOnChange = true })
+ .Add(new JsonConfigurationSource { Path = envAppsettings, Optional = false, ReloadOnChange = true })
+ .Build();
+ return;
+ }
+ Configuration = new ConfigurationBuilder()
+ .Add(new JsonConfigurationSource { Path = appsettings, Optional = false, ReloadOnChange = true })
+ .Build();
+ }
+ public InitConfiguration(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ ///
+ /// 封装要操作的字符
+ ///
+ /// 节点配置
+ ///
+ public static string app(params string[] sections)
+ {
+ try
+ {
+
+ if (sections.Any())
+ {
+ return Configuration[string.Join(":", sections)];
+ }
+ }
+ catch (Exception)
+ {
+
+ }
+
+ return "";
+ }
+
+ public static string GetConnectionString(string key)
+ {
+ return Configuration.GetConnectionString(key);
+ }
+ public static IConfigurationSection GetSection(string key)
+ {
+ return Configuration.GetSection(key);
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/Program.cs b/Cms.Core.WebApi/Program.cs
new file mode 100644
index 0000000..fffb419
--- /dev/null
+++ b/Cms.Core.WebApi/Program.cs
@@ -0,0 +1,114 @@
+using Cms.Core.EntityFramework;
+using Cms.Core.WebApi;
+using DG.Core;
+using DG.EntityFramework;
+using Microsoft.AspNetCore.ResponseCompression;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using Serilog;
+try
+{
+ var configuration = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("appsettings.json")
+ .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
+ .AddJsonFile("Serilog.json")
+ .AddJsonFile($"Serilog.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
+ .Build();
+
+ var logger = new LoggerConfiguration()
+ .ReadFrom.Configuration(configuration)
+ .CreateLogger();
+
+ Log.Logger = logger;
+ var builder = WebApplication.CreateBuilder(args);
+
+ builder.Services.AddLogging(logging =>
+ {
+ logging.ClearProviders();
+ logging.AddSerilog(logger);
+ });
+
+ Log.Information("Starting Cms Core WebApi");
+ var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
+ // Add services to the container.
+ builder.Services.AddSingleton(new InitConfiguration(builder.Configuration));
+ builder.Services.AddSwaggerGen(options =>
+ {
+ options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
+ {
+ Version = "v1",
+ Title = "Cms Core WebApi",
+ Description = "CMSϵͳapiӿ"
+ });
+ var xmlFilename = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
+ });
+ builder.Services.AddKafka(configuration);
+ builder.Services.AddCors(option =>
+ {
+ option.AddPolicy(MyAllowSpecificOrigins,
+ policy =>
+ {
+ policy.AllowAnyOrigin()
+ .AllowAnyHeader()
+ .AllowAnyMethod();
+ });
+ });
+ builder.Services.AddDGHttpClient();
+ builder.Services.AddResponseCompression(opts => //ѹм
+ {
+ opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
+ new[] { "application/octet-stream" });
+ })
+ .AddControllers()
+ .AddApiResult()
+ .AddJsonOptions(options =>
+ {
+ options.JsonSerializerOptions.Converters.Add(new JsonOptionsExtensions());
+ });
+ builder.Services.AddDGEntityFramework(options =>
+ {
+ options.UseMySql(builder.Configuration.GetConnectionString("dncmsbase"), ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("dncmsbase")));
+ });
+ builder.Services.AddRedis(builder.Configuration);
+ builder.Services.AddSingleton();
+ builder.Services.AddMapper();
+ builder.Services.AddResponseCompression(options =>
+ {
+ options.EnableForHttps = true;
+ //options.Providers.Add();
+ options.Providers.Add();
+ });
+
+ builder.Services.AddAutoIoc(typeof(IScopedDependency), LifeCycle.Scoped)
+ .AddAutoIoc(typeof(ISingletonDependency), LifeCycle.Singleton)
+ .AddAutoIoc(typeof(ITransientDependency), LifeCycle.Transient)
+ .AddMapper();
+ var app = builder.Build();
+
+ // Configure the HTTP request pipeline.
+ if (app.Environment.IsDevelopment() || Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "PreProduction")
+ {
+ app.UseSwagger();
+ app.UseSwaggerUI();
+ }
+ app.UseCors(MyAllowSpecificOrigins);
+ app.UseHttpsRedirection();
+
+ app.UseResponseCompression();
+
+ app.UseAuthorization();
+
+ app.MapControllers();
+
+ app.Run();
+}
+catch (Exception ex)
+{
+ Log.Fatal(ex, "Host terminated unexpectedly");
+}
+finally
+{
+ Log.CloseAndFlush();
+}
\ No newline at end of file
diff --git a/Cms.Core.WebApi/Properties/launchSettings.json b/Cms.Core.WebApi/Properties/launchSettings.json
new file mode 100644
index 0000000..c42dfa9
--- /dev/null
+++ b/Cms.Core.WebApi/Properties/launchSettings.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:4730",
+ "sslPort": 44327
+ }
+ },
+ "profiles": {
+ "Cms.Core.WebApi": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7163;http://localhost:5052",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/Serilog.Production.json b/Cms.Core.WebApi/Serilog.Production.json
new file mode 100644
index 0000000..f0856ca
--- /dev/null
+++ b/Cms.Core.WebApi/Serilog.Production.json
@@ -0,0 +1,33 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.AspNetCore" ],
+ "MinimumLevel": {
+ "Default": "Information",
+ "Override": {
+ "Microsoft": "Information",
+ "System": "Information",
+ "Microsoft.EntityFrameworkCore": "Information",
+ "System.Net.Http.HttpClient": "Warning"
+ }
+ },
+ "WriteTo": [
+ {
+ "Name": "Console",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "File",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "path": "logs/log.log",
+ "rollingInterval": "3",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ }
+ ],
+ "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
+ }
+}
diff --git a/Cms.Core.WebApi/Serilog.json b/Cms.Core.WebApi/Serilog.json
new file mode 100644
index 0000000..ab8d2ca
--- /dev/null
+++ b/Cms.Core.WebApi/Serilog.json
@@ -0,0 +1,33 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.AspNetCore" ],
+ "MinimumLevel": {
+ "Default": "Information",
+ "Override": {
+ "Microsoft": "Information",
+ "System": "Information",
+ "Microsoft.EntityFrameworkCore": "Information",
+ "System.Net.Http.HttpClient": "Warning"
+ }
+ },
+ "WriteTo": [
+ {
+ "Name": "Console",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "File",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "path": "logs/log.log",
+ "rollingInterval": "3",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}",
+ }
+ }
+ ],
+ "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
+ }
+}
diff --git a/Cms.Core.WebApi/Services/Impl/ILiveService.cs b/Cms.Core.WebApi/Services/Impl/ILiveService.cs
new file mode 100644
index 0000000..1737b56
--- /dev/null
+++ b/Cms.Core.WebApi/Services/Impl/ILiveService.cs
@@ -0,0 +1,14 @@
+using Cms.Core.WebApi.Dtos;
+using DG.Core;
+
+namespace Cms.Core.WebApi.Services.Impl
+{
+ public interface ILiveService : IScopedDependency
+ {
+ Task> GetSchedules();
+
+ Task> GetRooms();
+
+ Task> GetLiveDetails(LiveDetailSearchDto dto);
+ }
+}
diff --git a/Cms.Core.WebApi/Services/LiveService.cs b/Cms.Core.WebApi/Services/LiveService.cs
new file mode 100644
index 0000000..6d77e29
--- /dev/null
+++ b/Cms.Core.WebApi/Services/LiveService.cs
@@ -0,0 +1,73 @@
+using Cms.Core.Entity;
+using Cms.Core.EntityFramework;
+using Cms.Core.WebApi.Domain.Impl;
+using Cms.Core.WebApi.Dtos;
+using Cms.Core.WebApi.Services.Impl;
+using DG.Core;
+using DG.EntityFramework;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+
+namespace Cms.Core.WebApi.Services
+{
+ internal class LiveService : ILiveService
+ {
+ private readonly IBaseRepository _dncmsbaseRepository;
+ private readonly ICacheDomain _cacheDomain;
+ public LiveService(IBaseRepository dncmsbaseRepository,
+ ICacheDomain cacheDomain)
+ {
+ _dncmsbaseRepository = dncmsbaseRepository;
+ _cacheDomain = cacheDomain;
+ }
+
+ public async Task> GetLiveDetails(LiveDetailSearchDto dto)
+ {
+ var query = from a in _dncmsbaseRepository.GetRepository().Query()
+ join b in _dncmsbaseRepository.GetRepository().Query() on a.Scheduleid equals b.Id
+ join c in _dncmsbaseRepository.GetRepository().Query() on a.Roomid equals c.Id
+ where a.Appid == dto.Appid && a.Appuserid == dto.Appuserid
+ select new LiveDetailDto
+ {
+ Id = a.Id,
+ Illegaltype = a.Illegaltype,
+ LiveTitle = c.Title,
+ Marketingtype = b.Marketingtype,
+ Msg = a.Msg,
+ Msgtime = a.Msgtime,
+ Msgtype = a.Msgtype,
+ SchedulesTitle = b.Title,
+ Roomid = a.Roomid,
+ Scheduleid = a.Scheduleid,
+ };
+ var data = await query.If(!string.IsNullOrEmpty(dto.Msg), x => x.Where(x => x.Msg.Contains(dto.Msg)))
+ .If(dto.Scheduleid.HasValue, x => x.Where(x => x.Scheduleid == dto.Scheduleid))
+ .If(dto.Roomid.HasValue, x => x.Where(x => x.Roomid == dto.Roomid))
+ .OrderByDescending(x => x.Msgtime)
+ .ToListAsync();
+
+ return data;
+ }
+
+ public async Task> GetSchedules()
+ {
+ return await _dncmsbaseRepository.GetRepository().Query().Where(x => x.Status == 0)
+ .Select(x=>new SelectItem(x.Id, x.Title))
+ .ToListAsync();
+ }
+
+ public async Task> GetRooms()
+ {
+ var deptments = await _cacheDomain.GetDeptments();
+ var data = await _dncmsbaseRepository.GetRepository().Query().Where(x => x.Status == 0)
+ .ToListAsync();
+ var result = new List();
+ foreach (var item in data)
+ {
+ var deptment = deptments.FirstOrDefault(x => x.Id == item.Deptid);
+ result.Add(new SelectItem(item.Id, !string.IsNullOrEmpty(deptment?.Title) ? $"{item.Title}({deptment?.Title} ID: {item.Id})" : item.Title));
+ }
+ return result;
+ }
+ }
+}
diff --git a/Cms.Core.WebApi/appsettings.Production.json b/Cms.Core.WebApi/appsettings.Production.json
new file mode 100644
index 0000000..9626836
--- /dev/null
+++ b/Cms.Core.WebApi/appsettings.Production.json
@@ -0,0 +1,41 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*",
+ "ConnectionStrings": {
+ "dncmsbase": "Data Source=pc-wz927dkkv6y71jao7.rwlb.rds.aliyuncs.com;Port=3306;Initial Catalog=dncmsbase;user id=hguser;password=nH5L$&Hxxco;SslMode=None"
+ },
+ "WeworkSendUrl": "http://post.hc.dn8188.com/Wework/sendmsg.html",
+ "SignConfig": {
+ "AppId": "cms_core",
+ "Secret": "h9yO2WXR+pO2gk9RLk/EJaUrHAUu4ovcS3Ok2LFn9hA="
+ },
+ "Consumers": [
+ {
+ "Host": "172.18.11.77:9092,172.18.11.76:9092",
+ "GroupId": "crm",
+ "Topic": "crm-topic-2"
+ },
+ {
+ "Host": "172.18.11.77:9092,172.18.11.76:9092",
+ "GroupId": "crm",
+ "Topic": "crm-wework-tag"
+ }
+ ],
+ "SystemConfig": {
+ "ZxdCoreUrl": "http://120.77.165.155:8089"
+ },
+ "Redis": [
+ {
+ "Name": "Cms",
+ "HostName": "172.18.11.63",
+ "Port": "6379",
+ "Password": "sa123456.",
+ "Defaultdatabase": "3"
+ }
+ ]
+}
diff --git a/Cms.Core.WebApi/appsettings.json b/Cms.Core.WebApi/appsettings.json
new file mode 100644
index 0000000..e2ce45e
--- /dev/null
+++ b/Cms.Core.WebApi/appsettings.json
@@ -0,0 +1,36 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*",
+ "ConnectionStrings": {
+ "dncmsbase": "Server=192.168.11.41;Database=dncmsbase;UserId=root;Password=sa123456.;port=3306;"
+ },
+ "WeworkSendUrl": "http://post.hc.dn8188.com/Wework/sendmsg.html",
+ "SignConfig": {
+ "AppId": "cms_core_test",
+ "Secret": "1Xn2x1HNV3PzC1vJ/we62YJnwkBzBLIhutbB/uWqp1o="
+ },
+ "Consumers": [
+ {
+ "Host": "192.168.11.101:9092,192.168.11.104:9092",
+ "GroupId": "crm",
+ "Topic": "crm-topic-2"
+ }
+ ],
+ "SystemConfig": {
+ "ZxdCoreUrl": "http://120.77.165.155:8089"
+ },
+ "Redis": [
+ {
+ "Name": "Cms",
+ "HostName": "192.168.11.81",
+ "Port": "6379",
+ "Password": "Abc@123456",
+ "Defaultdatabase": "3"
+ }
+ ]
+}
diff --git a/Cms.Core.sln b/Cms.Core.sln
new file mode 100644
index 0000000..5811a52
--- /dev/null
+++ b/Cms.Core.sln
@@ -0,0 +1,43 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34009.444
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cms.External.WebApi", "Cms.External.WebApi\Cms.External.WebApi.csproj", "{162A734E-FE47-4DF1-9AF0-73FB248C07C7}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cms.Core.Entity", "Cms.Core.Entity\Cms.Core.Entity.csproj", "{49F943DC-E6F4-4FDF-B19F-992B95E47419}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cms.Core.EntityFramework", "Cms.Core.EntityFramework\Cms.Core.EntityFramework.csproj", "{7D3356B4-A743-43F3-ABC5-DD854AB329BE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cms.Core.WebApi", "Cms.Core.WebApi\Cms.Core.WebApi.csproj", "{7A0978BC-B7C1-4137-8BE4-6DE8520D5242}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {162A734E-FE47-4DF1-9AF0-73FB248C07C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {162A734E-FE47-4DF1-9AF0-73FB248C07C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {162A734E-FE47-4DF1-9AF0-73FB248C07C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {162A734E-FE47-4DF1-9AF0-73FB248C07C7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {49F943DC-E6F4-4FDF-B19F-992B95E47419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {49F943DC-E6F4-4FDF-B19F-992B95E47419}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {49F943DC-E6F4-4FDF-B19F-992B95E47419}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {49F943DC-E6F4-4FDF-B19F-992B95E47419}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D3356B4-A743-43F3-ABC5-DD854AB329BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D3356B4-A743-43F3-ABC5-DD854AB329BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D3356B4-A743-43F3-ABC5-DD854AB329BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D3356B4-A743-43F3-ABC5-DD854AB329BE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7A0978BC-B7C1-4137-8BE4-6DE8520D5242}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7A0978BC-B7C1-4137-8BE4-6DE8520D5242}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7A0978BC-B7C1-4137-8BE4-6DE8520D5242}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7A0978BC-B7C1-4137-8BE4-6DE8520D5242}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A2F31EBA-F116-4494-A04E-A90354584646}
+ EndGlobalSection
+EndGlobal
diff --git a/Cms.External.WebApi/.dockerignore b/Cms.External.WebApi/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/Cms.External.WebApi/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/Cms.External.WebApi/Cms.External.WebApi.csproj b/Cms.External.WebApi/Cms.External.WebApi.csproj
new file mode 100644
index 0000000..c7a7b02
--- /dev/null
+++ b/Cms.External.WebApi/Cms.External.WebApi.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0
+ enable
+ enable
+ True
+ 3448d091-0b5e-41c8-a341-305746469209
+ Linux
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Cms.External.WebApi/Controllers/BaseController.cs b/Cms.External.WebApi/Controllers/BaseController.cs
new file mode 100644
index 0000000..793f88d
--- /dev/null
+++ b/Cms.External.WebApi/Controllers/BaseController.cs
@@ -0,0 +1,80 @@
+using DG.Tool;
+using Microsoft.AspNetCore.Mvc;
+using System.ComponentModel.DataAnnotations;
+using System.Security.Cryptography;
+using System.Text;
+using System.Text.Json;
+
+namespace Cms.External.WebApi.Controllers
+{
+ [ApiController]
+ [Route("Api/[controller]")]
+ [Produces("application/json")]
+ public class BaseController : ControllerBase
+ {
+ protected void CheckSign(object? obj = null)
+ {
+ if (obj == null)
+ {
+ obj = new Dictionary();
+ }
+ var bodyJson = JsonHelper.ToJson(obj);
+ var appId = InitConfiguration.GetSection("SignConfig:AppId").Value;
+ Dictionary res = new Dictionary();
+ var secret = InitConfiguration.GetSection("SignConfig:Secret").Value;
+ if (string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(secret))
+ {
+ throw new Exception("appId或secret没有配置");
+ }
+ var authorization = Request.Headers["authorization"].ToString();
+ var timestamps = Request.Headers["timestamps"].ToString();
+ var enStrList = new string[] { appId, bodyJson, secret, timestamps };
+ Array.Sort(enStrList, string.CompareOrdinal);
+
+ //拼接
+ var enStr = string.Join("", enStrList);
+ var md = _md5(enStr);
+ if (authorization != $"{appId}:{md}")
+ {
+ throw new Exception("签名不合法");
+ }
+ else
+ {
+ var nowTime = GetTimeStamp();
+ var diff = Convert.ToInt32(nowTime) - Convert.ToInt32(timestamps);
+ if (diff > 1800)
+ {
+ throw new Exception("签名已过期");
+ }
+ }
+ }
+
+ ///
+ /// 计算 md5
+ ///
+ ///
+ ///
+ private string _md5(string enCode)
+ {
+ string res = "";
+ byte[] data = Encoding.GetEncoding("utf-8").GetBytes(enCode);
+ MD5 md5 = new MD5CryptoServiceProvider();
+ byte[] bytes = md5.ComputeHash(data);
+ for (int i = 0; i < bytes.Length; i++)
+ {
+ res += bytes[i].ToString("x2");
+ }
+ return res;
+ }
+
+ ///
+ /// 获取时间戳
+ ///
+ ///
+ private string GetTimeStamp()
+ {
+ TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(ts.TotalSeconds).ToString();
+ }
+ }
+}
diff --git a/Cms.External.WebApi/Controllers/WeworkController.cs b/Cms.External.WebApi/Controllers/WeworkController.cs
new file mode 100644
index 0000000..f5bbf29
--- /dev/null
+++ b/Cms.External.WebApi/Controllers/WeworkController.cs
@@ -0,0 +1,122 @@
+using Cms.External.WebApi.Dtos;
+using Cms.External.WebApi.Services.Impl;
+using DG.Core;
+using DG.Tool;
+using Microsoft.AspNetCore.Mvc;
+using Serilog;
+using System.ComponentModel.DataAnnotations;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.Web;
+using static Cms.External.WebApi.Controllers.WeworkController;
+
+namespace Cms.External.WebApi.Controllers
+{
+ public class WeworkController : BaseController
+ {
+ private readonly IHttpClient _httpClient;
+ private readonly IHttpContextAccessor _httpContextAccessor;
+ private readonly IWeworkAgentService _weworkAgentService;
+
+ public WeworkController(IHttpClient httpClient,
+ IHttpContextAccessor httpContextAccessor,
+ IWeworkAgentService weworkAgentService)
+ {
+ _httpClient = httpClient;
+ _httpContextAccessor = httpContextAccessor;
+ _weworkAgentService = weworkAgentService;
+ }
+
+ ///
+ /// 发送企微消息
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("SendMessage")]
+ public async Task SendMessage([FromBody] WeworkSendeMsg weworkSendeMsg)
+ {
+ //CheckSign(weworkSendeMsg);
+ var clientid = "UPWEBSITE";
+ var key = "1622a92d";
+ var param = new
+ {
+ Account = "dn.uc",
+ Password = "dn.uc.password",
+ Time = SignHelper.GetTimeStamp()
+ };
+ var weworkSendUrl = InitConfiguration.GetSection("WeworkSendUrl").Value;
+ var response = await _httpClient.PostSecurityAsync>(weworkSendUrl, param, weworkSendeMsg, clientid, key);
+ if (response.ErrCode != 0)
+ {
+ var msg = $"请求企微推送消息接口报错:{response.RrrMessage}, ex:{JsonSerializer.Serialize(response)}";
+ Log.Error(msg);
+ throw new ApiException(msg);
+ }
+ return "发送成功!";
+ }
+
+ [HttpGet("AgentConfig")]
+ public async Task GetAgentConfig([FromQuery] WorkReports model)
+ {
+ var request = _httpContextAccessor.HttpContext.Request;
+ var url = "http://sys.hc.dn8188.com/Work/GetJsApiSignature2.html?appid=" + model.appid + "&agentid=" + model.agentid + "&url=" + HttpUtility.UrlEncode(model.url);
+ var result = await _httpClient.GetAsync(url);
+ return result;
+ }
+
+ [HttpGet("Agents")]
+ public async Task> GetWeworkAgents()
+ {
+ CheckSign();
+ return await _weworkAgentService.GetWeworkAgents();
+ }
+
+ public class WorkReports
+ {
+ public string appid { get; set; }
+
+ public string userid { get; set; }
+ public int agentid { get; set; }
+ public int deptid { get; set; }
+ public int eid { get; set; }
+ public string url { get; set; }
+ }
+
+ public class WeworkSendeMsg
+ {
+ ///
+ /// Appid
+ ///
+ [Required]
+ [JsonPropertyName("appid")]
+ public string? Appid { get; set; }
+
+ ///
+ /// Agentid
+ ///
+ [Required]
+ [JsonPropertyName("agentid")]
+ public int Agentid { get; set; }
+
+ ///
+ /// 发送数据
+ ///
+ [Required]
+ [JsonPropertyName("data")]
+ public string? Data { get; set; }
+ }
+
+ public class WeworkResponse
+ {
+ [JsonPropertyName("errcode")]
+ public int? ErrCode { get; set; }
+
+ [JsonPropertyName("errmsg")]
+ public string? RrrMessage { get; set; }
+
+ [JsonPropertyName("data")]
+ public T? Data { get; set; }
+ }
+ }
+}
diff --git a/Cms.External.WebApi/Dockerfile b/Cms.External.WebApi/Dockerfile
new file mode 100644
index 0000000..05bf3a9
--- /dev/null
+++ b/Cms.External.WebApi/Dockerfile
@@ -0,0 +1,39 @@
+#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
+WORKDIR /app
+EXPOSE 80
+EXPOSE 443
+
+#ʱΪйϺ
+ENV TZ=Asia/Shanghai
+ENV DEBIAN_FRONTEND noninteractive
+
+# ðԴΪ
+RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
+&& apt-get clean
+
+# װ tzdata
+RUN apt-get update \
+&& apt-get install -y tzdata \
+&& ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \
+&& rm -rf /var/lib/apt/lists/ \
+&& dpkg-reconfigure -f noninteractive tzdata
+
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+WORKDIR /src
+COPY ["Cms.External.WebApi.csproj", "."]
+RUN dotnet restore "./Cms.External.WebApi.csproj"
+COPY . .
+WORKDIR "/src/."
+RUN dotnet build "Cms.External.WebApi.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "Cms.External.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "Cms.External.WebApi.dll"]
\ No newline at end of file
diff --git a/Cms.External.WebApi/Dtos/WeworkAgentDto.cs b/Cms.External.WebApi/Dtos/WeworkAgentDto.cs
new file mode 100644
index 0000000..ad684e0
--- /dev/null
+++ b/Cms.External.WebApi/Dtos/WeworkAgentDto.cs
@@ -0,0 +1,10 @@
+namespace Cms.External.WebApi.Dtos
+{
+ public class WeworkAgentDto
+ {
+ public string? WeworkName { get; set; }
+ public string? Appid { get; set; }
+ public int Agentid { get; set; }
+ public string? Name { get; set; }
+ }
+}
diff --git a/Cms.External.WebApi/InitConfiguration.cs b/Cms.External.WebApi/InitConfiguration.cs
new file mode 100644
index 0000000..e4083cd
--- /dev/null
+++ b/Cms.External.WebApi/InitConfiguration.cs
@@ -0,0 +1,67 @@
+using Microsoft.Extensions.Configuration.Json;
+
+namespace Cms.External.WebApi
+{
+ public class InitConfiguration
+ {
+
+ static IConfiguration Configuration { get; set; }
+
+
+
+ static InitConfiguration()
+ {
+ var appsettings = "appsettings.json";
+
+ if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != null
+ && Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Production")
+ {
+ var envAppsettings = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json";
+ Configuration = new ConfigurationBuilder()
+ .Add(new JsonConfigurationSource { Path = appsettings, Optional = false, ReloadOnChange = true })
+ .Add(new JsonConfigurationSource { Path = envAppsettings, Optional = false, ReloadOnChange = true })
+ .Build();
+ return;
+ }
+ Configuration = new ConfigurationBuilder()
+ .Add(new JsonConfigurationSource { Path = appsettings, Optional = false, ReloadOnChange = true })
+ .Build();
+ }
+ public InitConfiguration(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ ///
+ /// 封装要操作的字符
+ ///
+ /// 节点配置
+ ///
+ public static string app(params string[] sections)
+ {
+ try
+ {
+
+ if (sections.Any())
+ {
+ return Configuration[string.Join(":", sections)];
+ }
+ }
+ catch (Exception)
+ {
+
+ }
+
+ return "";
+ }
+
+ public static string GetConnectionString(string key)
+ {
+ return Configuration.GetConnectionString(key);
+ }
+ public static IConfigurationSection GetSection(string key)
+ {
+ return Configuration.GetSection(key);
+ }
+ }
+}
diff --git a/Cms.External.WebApi/Program.cs b/Cms.External.WebApi/Program.cs
new file mode 100644
index 0000000..ab1a71c
--- /dev/null
+++ b/Cms.External.WebApi/Program.cs
@@ -0,0 +1,108 @@
+using Cms.Core.EntityFramework;
+using Cms.External.WebApi;
+using DG.Core;
+using DG.EntityFramework;
+using Microsoft.AspNetCore.ResponseCompression;
+using Microsoft.EntityFrameworkCore;
+using Serilog;
+try
+{
+ var configuration = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("Serilog.json")
+ .AddJsonFile($"Serilog.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
+ .Build();
+
+ var logger = new LoggerConfiguration()
+ .ReadFrom.Configuration(configuration)
+ .CreateLogger();
+
+ Log.Logger = logger;
+ var builder = WebApplication.CreateBuilder(args);
+
+ builder.Services.AddLogging(logging =>
+ {
+ logging.ClearProviders();
+ logging.AddSerilog(logger);
+ });
+
+ Log.Information("Starting Cms External WebApi");
+ var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
+ // Add services to the container.
+ builder.Services.AddSingleton(new InitConfiguration(builder.Configuration));
+ builder.Services.AddSwaggerGen(options =>
+ {
+ options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
+ {
+ Version = "v1",
+ Title = "Cms External WebApi",
+ Description = "CMSϵͳⲿapiӿ"
+ });
+ var xmlFilename = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
+ });
+ builder.Services.AddCors(option =>
+ {
+ option.AddPolicy(MyAllowSpecificOrigins,
+ policy =>
+ {
+ policy.AllowAnyOrigin()
+ .AllowAnyHeader()
+ .AllowAnyMethod();
+ });
+ });
+ builder.Services.AddDGHttpClient();
+ builder.Services.AddResponseCompression(opts => //ѹм
+ {
+ opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
+ new[] { "application/octet-stream" });
+ })
+ .AddControllers()
+ .AddApiResult()
+ .AddJsonOptions(options =>
+ {
+ options.JsonSerializerOptions.Converters.Add(new JsonOptionsExtensions());
+ });
+ builder.Services.AddSingleton();
+ builder.Services.AddMapper();
+ builder.Services.AddResponseCompression(options =>
+ {
+ options.EnableForHttps = true;
+ //options.Providers.Add();
+ options.Providers.Add();
+ });
+ builder.Services.AddDGEntityFramework(options =>
+ {
+ options.UseMySql(builder.Configuration.GetConnectionString("dncmsbase"), ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("dncmsbase")));
+ });
+ builder.Services.AddAutoIoc(typeof(IScopedDependency), LifeCycle.Scoped)
+ .AddAutoIoc(typeof(ISingletonDependency), LifeCycle.Singleton)
+ .AddAutoIoc(typeof(ITransientDependency), LifeCycle.Transient)
+ .AddMapper();
+ var app = builder.Build();
+
+ // Configure the HTTP request pipeline.
+ if (app.Environment.IsDevelopment() || Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "PreProduction")
+ {
+ app.UseSwagger();
+ app.UseSwaggerUI();
+ }
+ app.UseCors(MyAllowSpecificOrigins);
+ app.UseHttpsRedirection();
+
+ app.UseResponseCompression();
+
+ app.UseAuthorization();
+
+ app.MapControllers();
+
+ app.Run();
+}
+catch (Exception ex)
+{
+ Log.Fatal(ex, "Host terminated unexpectedly");
+}
+finally
+{
+ Log.CloseAndFlush();
+}
\ No newline at end of file
diff --git a/Cms.External.WebApi/Properties/launchSettings.json b/Cms.External.WebApi/Properties/launchSettings.json
new file mode 100644
index 0000000..8ae28af
--- /dev/null
+++ b/Cms.External.WebApi/Properties/launchSettings.json
@@ -0,0 +1,41 @@
+{
+ "profiles": {
+ "Cms.External.WebApi": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "https://localhost:7050;http://localhost:5015"
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
+ "environmentVariables": {
+ "ASPNETCORE_URLS": "https://+:443;http://+:80"
+ },
+ "publishAllPorts": true,
+ "useSSL": true
+ }
+ },
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:12203",
+ "sslPort": 44321
+ }
+ }
+}
\ No newline at end of file
diff --git a/Cms.External.WebApi/Serilog.Production.json b/Cms.External.WebApi/Serilog.Production.json
new file mode 100644
index 0000000..f0856ca
--- /dev/null
+++ b/Cms.External.WebApi/Serilog.Production.json
@@ -0,0 +1,33 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.AspNetCore" ],
+ "MinimumLevel": {
+ "Default": "Information",
+ "Override": {
+ "Microsoft": "Information",
+ "System": "Information",
+ "Microsoft.EntityFrameworkCore": "Information",
+ "System.Net.Http.HttpClient": "Warning"
+ }
+ },
+ "WriteTo": [
+ {
+ "Name": "Console",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "File",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "path": "logs/log.log",
+ "rollingInterval": "3",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ }
+ ],
+ "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
+ }
+}
diff --git a/Cms.External.WebApi/Serilog.json b/Cms.External.WebApi/Serilog.json
new file mode 100644
index 0000000..ab8d2ca
--- /dev/null
+++ b/Cms.External.WebApi/Serilog.json
@@ -0,0 +1,33 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.AspNetCore" ],
+ "MinimumLevel": {
+ "Default": "Information",
+ "Override": {
+ "Microsoft": "Information",
+ "System": "Information",
+ "Microsoft.EntityFrameworkCore": "Information",
+ "System.Net.Http.HttpClient": "Warning"
+ }
+ },
+ "WriteTo": [
+ {
+ "Name": "Console",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "File",
+ "Args": {
+ "encoding": "System.Text.Encoding::UTF8",
+ "path": "logs/log.log",
+ "rollingInterval": "3",
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] <{ThreadId}> [{Level:u3}] {Message:lj}{NewLine}{Exception}",
+ }
+ }
+ ],
+ "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
+ }
+}
diff --git a/Cms.External.WebApi/Services/Impl/IWeworkAgentService.cs b/Cms.External.WebApi/Services/Impl/IWeworkAgentService.cs
new file mode 100644
index 0000000..b6a9a2c
--- /dev/null
+++ b/Cms.External.WebApi/Services/Impl/IWeworkAgentService.cs
@@ -0,0 +1,10 @@
+using Cms.External.WebApi.Dtos;
+using DG.Core;
+
+namespace Cms.External.WebApi.Services.Impl
+{
+ public interface IWeworkAgentService : IScopedDependency
+ {
+ Task> GetWeworkAgents();
+ }
+}
diff --git a/Cms.External.WebApi/Services/WeworkAgentService.cs b/Cms.External.WebApi/Services/WeworkAgentService.cs
new file mode 100644
index 0000000..3457de9
--- /dev/null
+++ b/Cms.External.WebApi/Services/WeworkAgentService.cs
@@ -0,0 +1,33 @@
+using Cms.Core.Entity;
+using Cms.Core.EntityFramework;
+using Cms.External.WebApi.Dtos;
+using Cms.External.WebApi.Services.Impl;
+using DG.EntityFramework;
+using Microsoft.EntityFrameworkCore;
+
+namespace Cms.External.WebApi.Services
+{
+ internal class WeworkAgentService : IWeworkAgentService
+ {
+ private readonly IBaseRepository _dncmsbaseRepository;
+ public WeworkAgentService(IBaseRepository dncmsbaseRepository)
+ {
+ _dncmsbaseRepository = dncmsbaseRepository;
+ }
+
+ public async Task> GetWeworkAgents()
+ {
+ return await (from a in _dncmsbaseRepository.GetRepository().Query()
+ join b in _dncmsbaseRepository.GetRepository().Query() on a.Appid equals b.Appid
+ select new { a, b })
+ .Where(x => x.a.Close == 1)
+ .Select(x => new WeworkAgentDto
+ {
+ WeworkName = x.b.Name,
+ Agentid = x.a.Agentid,
+ Appid = x.a.Appid,
+ Name = x.a.Name,
+ }).ToListAsync();
+ }
+ }
+}
diff --git a/Cms.External.WebApi/appsettings.PreProduction.json b/Cms.External.WebApi/appsettings.PreProduction.json
new file mode 100644
index 0000000..d97f233
--- /dev/null
+++ b/Cms.External.WebApi/appsettings.PreProduction.json
@@ -0,0 +1,17 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "ConnectionStrings": {
+ "dncmsbase": "Server=192.168.11.41;Database=dncmsbase;UserId=root;Password=sa123456.;port=3306;"
+ },
+ "AllowedHosts": "*",
+ "WeworkSendUrl": "http://post.hc.dn8188.com/Wework/sendmsg.html",
+ "SignConfig": {
+ "AppId": "cms_core_test",
+ "Secret": "1Xn2x1HNV3PzC1vJ/we62YJnwkBzBLIhutbB/uWqp1o="
+ }
+}
diff --git a/Cms.External.WebApi/appsettings.Production.json b/Cms.External.WebApi/appsettings.Production.json
new file mode 100644
index 0000000..5a4268b
--- /dev/null
+++ b/Cms.External.WebApi/appsettings.Production.json
@@ -0,0 +1,17 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "ConnectionStrings": {
+ "dncmsbase": "Data Source=pc-wz927dkkv6y71jao7.rwlb.rds.aliyuncs.com;Port=3306;Initial Catalog=dncmsbase;user id=hguser;password=nH5L$&Hxxco;SslMode=None"
+ },
+ "AllowedHosts": "*",
+ "WeworkSendUrl": "http://post.hc.dn8188.com/Wework/sendmsg.html",
+ "SignConfig": {
+ "AppId": "cms_core",
+ "Secret": "h9yO2WXR+pO2gk9RLk/EJaUrHAUu4ovcS3Ok2LFn9hA="
+ }
+}
diff --git a/Cms.External.WebApi/appsettings.json b/Cms.External.WebApi/appsettings.json
new file mode 100644
index 0000000..3f0891c
--- /dev/null
+++ b/Cms.External.WebApi/appsettings.json
@@ -0,0 +1,17 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "ConnectionStrings": {
+ "dncmsbase": "Server=192.168.11.41;Database=dncmsbase;UserId=root;Password=sa123456.;port=3306;",
+ },
+ "AllowedHosts": "*",
+ "WeworkSendUrl": "http://post.hc.dn8188.com/Wework/sendmsg.html",
+ "SignConfig": {
+ "AppId": "cms_core_test",
+ "Secret": "1Xn2x1HNV3PzC1vJ/we62YJnwkBzBLIhutbB/uWqp1o="
+ }
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a16e5ee
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Cms.Core
+
+cms项目
\ No newline at end of file