init
This commit is contained in:
commit
f552838306
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
/// <summary>
|
||||||
|
/// 0、私聊;1、公开;3、删除;
|
||||||
|
/// </summary>
|
||||||
|
public int Type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 违法类型
|
||||||
|
/// </summary>
|
||||||
|
public Illegaltype Illegaltype { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 消息类型
|
||||||
|
/// </summary>
|
||||||
|
public Msgtype Msgtype { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 内容
|
||||||
|
/// </summary>
|
||||||
|
public string? Msg { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Msgtime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 课程ID
|
||||||
|
/// </summary>
|
||||||
|
public int Scheduleid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 平台ID
|
||||||
|
/// </summary>
|
||||||
|
public string? Appid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 用户user
|
||||||
|
/// </summary>
|
||||||
|
public string? Appuserid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 用户信息
|
||||||
|
/// </summary>
|
||||||
|
public string? Userinfo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 用户类型,0、普通用户,1、分析师等管理者
|
||||||
|
/// </summary>
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 企业微信打标签
|
||||||
|
/// </summary>
|
||||||
|
public class WeWorkTagVo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 账号类型
|
||||||
|
/// </summary>
|
||||||
|
public string appId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 账号
|
||||||
|
/// </summary>
|
||||||
|
public string appUserid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string tagName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指定企业微信,如果指定了,那么只能按照指定的企业微信进行打标签,不会去查找所有关联的企微进行标签
|
||||||
|
/// </summary>
|
||||||
|
public string targAppId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
|
||||||
|
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.61" />
|
||||||
|
<PackageReference Include="DG.EntityFramework" Version="1.0.25" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Cms.Core.Entity\Cms.Core.Entity.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="DG.EntityFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -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<DncmsbaseDbContext> 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> WeworkAgent { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Wework> Wework { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ZhiboSystemDiscussion> ZhiboSystemDiscussion { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ZhiboSystemSchedules> ZhiboSystemSchedules { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ZhiboSystemRoom> ZhiboSystemRoom { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DG.Kafka" Version="1.0.9" />
|
||||||
|
<PackageReference Include="DG.Redis" Version="1.0.17" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DG.Core" Version="1.1.3" />
|
||||||
|
<PackageReference Include="DG.Tool" Version="1.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
<PackageReference Include="Serilog" Version="2.11.0" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Zxd.Core.Shared" Version="1.0.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Cms.Core.EntityFramework\Cms.Core.EntityFramework.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Cms.Core.WebApi.Config
|
||||||
|
{
|
||||||
|
internal static class CacheKeys
|
||||||
|
{
|
||||||
|
public const string DeptList = "dept_list";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Cms.Core.WebApi.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("Api/[controller]")]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public class BaseController : ControllerBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 直播间数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Details")]
|
||||||
|
public async Task<List<LiveDetailDto>> GetLiveDetails([FromQuery] LiveDetailSearchDto dto)
|
||||||
|
{
|
||||||
|
return await _liveService.GetLiveDetails(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取直播间下拉
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Rooms")]
|
||||||
|
public async Task<List<SelectItem>> GetRooms()
|
||||||
|
=> await _liveService.GetRooms();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取课程下拉
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Schedules")]
|
||||||
|
public async Task<List<SelectItem>> GetSchedules()
|
||||||
|
=> await _liveService.GetSchedules();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 企业微信打标签接口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<SystemConfig>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<DeptmentDto>> GetDeptments()
|
||||||
|
{
|
||||||
|
var key = $"{CacheKeys.DeptList}";
|
||||||
|
if (!await _redisManager.ExistsAsync(key))
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetAsync<ApiResult<List<DeptmentDto>>>(_systemConfig.GetDepts());
|
||||||
|
if (response.Code == 0)
|
||||||
|
{
|
||||||
|
await _redisManager.SetAsync(key, response.Data, TimeSpan.FromDays(1));
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await _redisManager.GetListAsync<DeptmentDto>(key);
|
||||||
|
}
|
||||||
|
return new List<DeptmentDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using DG.Core;
|
||||||
|
using Zxd.Core.Shared.Dto;
|
||||||
|
|
||||||
|
namespace Cms.Core.WebApi.Domain.Impl
|
||||||
|
{
|
||||||
|
internal interface ICacheDomain : IScopedDependency
|
||||||
|
{
|
||||||
|
Task<List<DeptmentDto>> GetDeptments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 违法类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public Illegaltype Illegaltype { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 违法类型
|
||||||
|
/// </summary>
|
||||||
|
public string? IllegaltypeStr { get { return Illegaltype.GetDescription(); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消息类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public Msgtype Msgtype { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消息类型
|
||||||
|
/// </summary>
|
||||||
|
public string? MsgtypeStr { get { return Msgtype.GetDescription(); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内容
|
||||||
|
/// </summary>
|
||||||
|
public string? Msg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Msgtime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 营销类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public MarketingType? Marketingtype { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 营销类型
|
||||||
|
/// </summary>
|
||||||
|
public string? MarketingtypeStr { get { return Marketingtype?.GetDescription(); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 课程
|
||||||
|
/// </summary>
|
||||||
|
public string? SchedulesTitle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 直播间名称
|
||||||
|
/// </summary>
|
||||||
|
public string? LiveTitle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 课程id
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public int? Scheduleid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 直播间id
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public int? Roomid { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 封装要操作的字符
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sections">节点配置</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DncmsbaseDbContext>(options =>
|
||||||
|
{
|
||||||
|
options.UseMySql(builder.Configuration.GetConnectionString("dncmsbase"), ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("dncmsbase")));
|
||||||
|
});
|
||||||
|
builder.Services.AddRedis(builder.Configuration);
|
||||||
|
builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
|
builder.Services.AddMapper();
|
||||||
|
builder.Services.AddResponseCompression(options =>
|
||||||
|
{
|
||||||
|
options.EnableForHttps = true;
|
||||||
|
//options.Providers.Add<BrotliCompressionProvider>();
|
||||||
|
options.Providers.Add<GzipCompressionProvider>();
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
using Cms.Core.WebApi.Dtos;
|
||||||
|
using DG.Core;
|
||||||
|
|
||||||
|
namespace Cms.Core.WebApi.Services.Impl
|
||||||
|
{
|
||||||
|
public interface ILiveService : IScopedDependency
|
||||||
|
{
|
||||||
|
Task<List<SelectItem>> GetSchedules();
|
||||||
|
|
||||||
|
Task<List<SelectItem>> GetRooms();
|
||||||
|
|
||||||
|
Task<List<LiveDetailDto>> GetLiveDetails(LiveDetailSearchDto dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DncmsbaseDbContext> _dncmsbaseRepository;
|
||||||
|
private readonly ICacheDomain _cacheDomain;
|
||||||
|
public LiveService(IBaseRepository<DncmsbaseDbContext> dncmsbaseRepository,
|
||||||
|
ICacheDomain cacheDomain)
|
||||||
|
{
|
||||||
|
_dncmsbaseRepository = dncmsbaseRepository;
|
||||||
|
_cacheDomain = cacheDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<LiveDetailDto>> GetLiveDetails(LiveDetailSearchDto dto)
|
||||||
|
{
|
||||||
|
var query = from a in _dncmsbaseRepository.GetRepository<ZhiboSystemDiscussion>().Query()
|
||||||
|
join b in _dncmsbaseRepository.GetRepository<ZhiboSystemSchedules>().Query() on a.Scheduleid equals b.Id
|
||||||
|
join c in _dncmsbaseRepository.GetRepository<ZhiboSystemRoom>().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<List<SelectItem>> GetSchedules()
|
||||||
|
{
|
||||||
|
return await _dncmsbaseRepository.GetRepository<ZhiboSystemSchedules>().Query().Where(x => x.Status == 0)
|
||||||
|
.Select(x=>new SelectItem(x.Id, x.Title))
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<SelectItem>> GetRooms()
|
||||||
|
{
|
||||||
|
var deptments = await _cacheDomain.GetDeptments();
|
||||||
|
var data = await _dncmsbaseRepository.GetRepository<ZhiboSystemRoom>().Query().Where(x => x.Status == 0)
|
||||||
|
.ToListAsync();
|
||||||
|
var result = new List<SelectItem>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<UserSecretsId>3448d091-0b5e-41c8-a341-305746469209</UserSecretsId>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<DockerfileContext>.</DockerfileContext>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DG.Core" Version="1.1.3" />
|
||||||
|
<PackageReference Include="DG.Tool" Version="1.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
<PackageReference Include="Serilog" Version="2.11.0" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Cms.Core.EntityFramework\Cms.Core.EntityFramework.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -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<string, object>();
|
||||||
|
}
|
||||||
|
var bodyJson = JsonHelper.ToJson(obj);
|
||||||
|
var appId = InitConfiguration.GetSection("SignConfig:AppId").Value;
|
||||||
|
Dictionary<bool, string> res = new Dictionary<bool, string>();
|
||||||
|
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("签名已过期");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算 md5
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="enCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取时间戳
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string GetTimeStamp()
|
||||||
|
{
|
||||||
|
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||||
|
return Convert.ToInt64(ts.TotalSeconds).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送企微消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="weworkSendeMsg"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="ApiException"></exception>
|
||||||
|
[HttpPost("SendMessage")]
|
||||||
|
public async Task<string> 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<WeworkResponse<object?>>(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<string> 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<List<WeworkAgentDto>> 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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Appid
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[JsonPropertyName("appid")]
|
||||||
|
public string? Appid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Agentid
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[JsonPropertyName("agentid")]
|
||||||
|
public int Agentid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送数据
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[JsonPropertyName("data")]
|
||||||
|
public string? Data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WeworkResponse<T>
|
||||||
|
{
|
||||||
|
[JsonPropertyName("errcode")]
|
||||||
|
public int? ErrCode { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("errmsg")]
|
||||||
|
public string? RrrMessage { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("data")]
|
||||||
|
public T? Data { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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"]
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 封装要操作的字符
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sections">节点配置</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
|
builder.Services.AddMapper();
|
||||||
|
builder.Services.AddResponseCompression(options =>
|
||||||
|
{
|
||||||
|
options.EnableForHttps = true;
|
||||||
|
//options.Providers.Add<BrotliCompressionProvider>();
|
||||||
|
options.Providers.Add<GzipCompressionProvider>();
|
||||||
|
});
|
||||||
|
builder.Services.AddDGEntityFramework<DncmsbaseDbContext>(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();
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using Cms.External.WebApi.Dtos;
|
||||||
|
using DG.Core;
|
||||||
|
|
||||||
|
namespace Cms.External.WebApi.Services.Impl
|
||||||
|
{
|
||||||
|
public interface IWeworkAgentService : IScopedDependency
|
||||||
|
{
|
||||||
|
Task<List<WeworkAgentDto>> GetWeworkAgents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DncmsbaseDbContext> _dncmsbaseRepository;
|
||||||
|
public WeworkAgentService(IBaseRepository<DncmsbaseDbContext> dncmsbaseRepository)
|
||||||
|
{
|
||||||
|
_dncmsbaseRepository = dncmsbaseRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<WeworkAgentDto>> GetWeworkAgents()
|
||||||
|
{
|
||||||
|
return await (from a in _dncmsbaseRepository.GetRepository<WeworkAgent>().Query()
|
||||||
|
join b in _dncmsbaseRepository.GetRepository<Wework>().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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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="
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue