Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
ezijing-node-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
ezijing-node-server
Commits
fa57eaeb
提交
fa57eaeb
authored
11月 28, 2025
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
0c468741
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
268 行增加
和
219 行删除
+268
-219
package-lock.json
package-lock.json
+0
-0
CkeditorMonitor.js
server/controller/CkeditorMonitor.js
+27
-18
ESignMonitor.js
server/controller/ESignMonitor.js
+141
-112
MixedFlowMonitor.js
server/controller/MixedFlowMonitor.js
+52
-48
NextToSend.js
server/controller/NextToSend.js
+14
-11
ProxyRequest.js
server/controller/ProxyRequest.js
+14
-11
RTMPMonitor.js
server/controller/RTMPMonitor.js
+3
-4
TestMonitor.js
server/controller/TestMonitor.js
+8
-6
WxMonitor.js
server/controller/WxMonitor.js
+1
-1
setCloudClassMonitor.js
server/controller/setCloudClassMonitor.js
+4
-4
wxChartSuccessMonitor.js
server/controller/wxChartSuccessMonitor.js
+4
-4
没有找到文件。
package-lock.json
浏览文件 @
fa57eaeb
This source diff could not be displayed because it is too large. You can
view the blob
instead.
server/controller/CkeditorMonitor.js
浏览文件 @
fa57eaeb
const
fs
=
require
(
'fs'
)
const
conf
=
require
(
'../config'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
Proxy
=
com
.
Proxy
const
ckeditorUpload
=
(
req
,
res
)
=>
{
/* 文件上传 ckeditor4.5以上返回格式 */
function
sendHtml
(
url
,
msg
)
{
function
sendHtml
(
url
,
msg
)
{
res
.
json
({
'uploaded'
:
url
?
1
:
0
,
'fileName'
:
'image'
,
'url'
:
url
,
'error'
:
{
'message'
:
msg
}
uploaded
:
url
?
1
:
0
,
fileName
:
'image'
,
url
:
url
,
error
:
{
message
:
msg
,
}
,
})
}
if
(
req
.
files
.
length
)
{
if
(
!
req
.
files
[
0
].
mimetype
.
startsWith
(
'image'
))
{
sendHtml
(
''
,
'文件类型错误,请上传图片'
);
return
}
if
(
req
.
files
[
0
].
size
>
10
*
1024
*
1024
)
{
sendHtml
(
''
,
'图片大小超限'
);
return
}
if
(
!
req
.
files
[
0
].
mimetype
.
startsWith
(
'image'
))
{
sendHtml
(
''
,
'文件类型错误,请上传图片'
)
return
}
if
(
req
.
files
[
0
].
size
>
10
*
1024
*
1024
)
{
sendHtml
(
''
,
'图片大小超限'
)
return
}
req
.
files
[
0
].
fieldname
=
'file'
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
req
.
headers
.
reqhost
,
// 直接传 host,会被 kong的nginx接管,不能再调用,所以改为自定义host
path
:
'/api/lms/util/upload-file'
,
method
:
'POST'
,
...
...
@@ -30,12 +37,13 @@ const ckeditorUpload = (req, res) => {
query
:
req
.
query
||
{},
files
:
req
.
files
,
headers
:
{
'tenant'
:
req
.
headers
.
tenant
,
'Cookie'
:
req
.
headers
.
cookie
||
''
,
tenant
:
req
.
headers
.
tenant
,
Cookie
:
req
.
headers
.
cookie
||
''
,
'User-Agent'
:
req
.
headers
[
'user-agent'
],
'Content-Type'
:
'multipart/form-data'
}
},
function
(
str
,
obj
)
{
'Content-Type'
:
'multipart/form-data'
,
},
},
function
(
str
,
obj
)
{
try
{
const
_json
=
JSON
.
parse
(
str
)
if
(
_json
.
success
)
{
...
...
@@ -46,10 +54,11 @@ const ckeditorUpload = (req, res) => {
}
catch
(
e
)
{
sendHtml
(
''
,
'上传错误,请重试1'
)
}
})
}
)
}
}
module
.
exports
=
{
ckeditorUpload
:
ckeditorUpload
ckeditorUpload
:
ckeditorUpload
,
}
server/controller/ESignMonitor.js
浏览文件 @
fa57eaeb
...
...
@@ -2,7 +2,7 @@ const fs = require('fs')
// 自带模块 crypto
const
crypto
=
require
(
'crypto'
)
const
path
=
require
(
'path'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
Proxy
=
com
.
Proxy
const
md5
=
com
.
Tool
.
md5
...
...
@@ -10,7 +10,7 @@ const md5 = com.Tool.md5
const
appPro1
=
{
AppId
:
'5111635045'
,
AppSecret
:
'0f35445117f738c9292c52ad8af94064'
AppSecret
:
'0f35445117f738c9292c52ad8af94064'
,
}
// 数据文件必须存 固定地点
const
appPro2
=
{
...
...
@@ -29,23 +29,22 @@ const appTest = {
// flowId: '9926fcd1956d41ab8e081c4480562f53'
}
let
_accessToken
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnSWQiOiIzZWVkMDZkODE1MmQ0YzNlOGMwOGM2ZTQzNjA5ODViZCIsImFwcElkIjoiNTExMTYzNTA2OCIsIm9JZCI6IjhiYTNkMDY0ZDZjYTQ0MThhM2Q0YzNkNTI4MDVlOWJiIiwidGltZXN0YW1wIjoxNjA5NDMxOTg5NTQ4fQ.3F4izbojHlWj80zA4mUcgBZTWJn9IDzQsd-tHQw7cr8'
let
_accessToken
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnSWQiOiIzZWVkMDZkODE1MmQ0YzNlOGMwOGM2ZTQzNjA5ODViZCIsImFwcElkIjoiNTExMTYzNTA2OCIsIm9JZCI6IjhiYTNkMDY0ZDZjYTQ0MThhM2Q0YzNkNTI4MDVlOWJiIiwidGltZXN0YW1wIjoxNjA5NDMxOTg5NTQ4fQ.3F4izbojHlWj80zA4mUcgBZTWJn9IDzQsd-tHQw7cr8'
let
_info
=
{
domain_test
:
'smlopenapi.esign.cn'
,
domain_pro
:
'openapi.esign.cn'
domain_pro
:
'openapi.esign.cn'
,
}
// const _app = appPro2
// const _domain = _info.domain_pro
const
_app
=
appTest
const
_domain
=
_info
.
domain_test
const
_getAccessToken
=
(
req
,
res
)
=>
{
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/oauth2/access_token'
,
method
:
'GET'
,
...
...
@@ -53,12 +52,13 @@ const _getAccessToken = (req, res) => {
query
:
{
appId
:
_app
.
AppId
,
secret
:
_app
.
AppSecret
,
grantType
:
'client_credentials'
grantType
:
'client_credentials'
,
},
headers
:
{
'Host'
:
_domain
}
},
function
(
str
,
obj
)
{
Host
:
_domain
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'_getAccessToken 接口 调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -74,12 +74,12 @@ const _getAccessToken = (req, res) => {
}
_accessToken
=
_json
.
data
.
token
res
.
status
(
200
).
json
(
_json
)
})
}
)
}
// 需要传一个 file - 暂时只支持单文件
const
_getUploadUrl
=
(
req
,
res
)
=>
{
// 暂时先指定 originalname,中文本地服务存在问题
req
.
files
[
0
].
originalname
=
req
.
body
.
name
||
req
.
files
[
0
].
originalname
...
...
@@ -94,7 +94,8 @@ const _getUploadUrl = (req, res) => {
fs
.
renameSync
(
req
.
files
[
0
].
path
,
req
.
files
[
0
].
destination
+
req
.
files
[
0
].
originalname
)
req
.
files
[
0
].
path
=
req
.
files
[
0
].
destination
+
req
.
files
[
0
].
originalname
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/files/getUploadUrl'
,
method
:
'POST'
,
...
...
@@ -104,16 +105,17 @@ const _getUploadUrl = (req, res) => {
contentType
:
'application/octet-stream'
,
convert2Pdf
:
/pdf/gi
.
test
(
req
.
files
[
0
].
originalname
),
fileName
:
req
.
files
[
0
].
originalname
,
// req.files[0].originalname 暂时存在一个问题,1.本地服务中文乱码
fileSize
:
req
.
files
[
0
].
size
fileSize
:
req
.
files
[
0
].
size
,
},
query
:
{},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'_getUploadUrl 接口 第一步调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -136,14 +138,16 @@ const _getUploadUrl = (req, res) => {
_app
.
fileId
=
fileId
res
.
status
(
200
).
json
(
_json
)
})
})
}
)
}
// 通过 application/octet-stream 方式 上传 文件
const
_uploadFileFromOctetStream
=
(
uploadUrl
,
str_base64_md5
,
filePath
,
callback
)
=>
{
let
buffer
=
fs
.
readFileSync
(
filePath
)
console
.
log
(
uploadUrl
)
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
uploadUrl
.
replace
(
/http
(
s|
)
:
\/\/
/gi
,
''
).
replace
(
/
\/
.*$/gi
,
''
),
path
:
uploadUrl
.
replace
(
/http
(
s|
)
:
\/\/[^\/]
*
?\/
/gi
,
'/'
),
method
:
'PUT'
,
...
...
@@ -152,8 +156,9 @@ const _uploadFileFromOctetStream = (uploadUrl, str_base64_md5, filePath, callbac
headers
:
{
'content-md5'
:
str_base64_md5
,
'content-type'
:
'application/octet-stream'
,
}
},
function
(
str
,
obj
)
{
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'_getUploadUrl 接口 第二步 _uploadFileFromOctetStream 调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -163,28 +168,32 @@ const _uploadFileFromOctetStream = (uploadUrl, str_base64_md5, filePath, callbac
_json
=
jsonErr
}
callback
(
_json
)
})
}
)
}
// 根据 fileId 查询文件上传状态
const
_getInfoToUploadFile
=
(
req
,
res
)
=>
{
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/files/'
+
req
.
body
.
fileId
,
method
:
'GET'
,
data
:
{},
query
:
{},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
console
.
log
(
str
)
// callback(str)
res
.
status
(
200
).
json
(
JSON
.
parse
(
str
))
})
}
)
}
// 先调用创建用户 再一建发起签署,返回url
...
...
@@ -203,7 +212,8 @@ const getOneStepUrl = (req, res) => {
}
const
_token
=
(
req
,
res
,
callback
)
=>
{
// 获取token
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/oauth2/access_token'
,
method
:
'GET'
,
...
...
@@ -211,12 +221,13 @@ const _token = (req, res, callback) => {
query
:
{
appId
:
_app
.
AppId
,
secret
:
_app
.
AppSecret
,
grantType
:
'client_credentials'
grantType
:
'client_credentials'
,
},
headers
:
{
'Host'
:
_domain
}
},
function
(
str
,
obj
)
{
Host
:
_domain
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'getOneStepUrl 接口 第一步 /v1/oauth2/access_token调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -233,30 +244,33 @@ const _token = (req, res, callback) => {
_accessToken
=
_json
.
data
.
token
callback
&&
callback
()
})
}
)
}
const
_createUser
=
(
req
,
res
,
callback
)
=>
{
// 创建用户
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/accounts/createByThirdPartyUserId'
,
method
:
'POST'
,
data
:
{
"email"
:
req
.
body
.
email
||
""
,
"idNumber"
:
""
,
"idType"
:
""
,
"mobile"
:
req
.
body
.
mobile
||
""
,
"name"
:
req
.
body
.
name
||
"张彦新"
,
"thirdPartyUserId"
:
req
.
body
.
uuid
||
"17601621100"
email
:
req
.
body
.
email
||
''
,
idNumber
:
''
,
idType
:
''
,
mobile
:
req
.
body
.
mobile
||
''
,
name
:
req
.
body
.
name
||
'张彦新'
,
thirdPartyUserId
:
req
.
body
.
uuid
||
'17601621100'
,
},
query
:
{},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'getOneStepUrl 接口 第二步 /v1/accounts/createByThirdPartyUserId调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -274,66 +288,75 @@ const _createUser = (req, res, callback) => {
// accountId 传入,防止高并发时,出现意外
callback
&&
callback
(
_json
.
data
.
accountId
)
})
}
)
}
const
_signFlowId
=
(
req
,
res
,
callback
)
=>
{
// 一建发起签署
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/api/v2/signflows/createFlowOneStep'
,
method
:
'POST'
,
data
:
{
"attachments"
:
[],
"copiers"
:
[],
"docs"
:[{
"fileId"
:
_app
.
fileId
,
"fileName"
:
""
,
"filePassword"
:
""
}],
"flowInfo"
:
{
"autoArchive"
:
true
,
"autoInitiate"
:
true
,
"businessScene"
:
"Test 一键发起部署"
,
"flowConfigInfo"
:
{
"noticeDeveloperUrl"
:
""
,
"noticeType"
:
""
,
"redirectUrl"
:
""
,
"signPlatform"
:
""
},
"initiatorAccountId"
:
""
,
"initiatorAuthorizedAccountId"
:
""
,
"remark"
:
""
},
"signers"
:
[{
"platformSign"
:
false
,
"signerAccount"
:
{
"authorizedAccountId"
:
""
,
"signerAccountId"
:
req
.
accountId
},
"signfields"
:
[{
"autoExecute"
:
false
,
"fileId"
:
_app
.
fileId
,
"signType"
:
0
,
"posBean"
:
{
"posPage"
:
""
},
"sealId"
:
""
,
"sealType"
:
"0, 1"
,
"signDateBean"
:
{
"format"
:
""
}
}],
"thirdOrderNo"
:
""
}]
attachments
:
[],
copiers
:
[],
docs
:
[
{
fileId
:
_app
.
fileId
,
fileName
:
''
,
filePassword
:
''
,
},
],
flowInfo
:
{
autoArchive
:
true
,
autoInitiate
:
true
,
businessScene
:
'Test 一键发起部署'
,
flowConfigInfo
:
{
noticeDeveloperUrl
:
''
,
noticeType
:
''
,
redirectUrl
:
''
,
signPlatform
:
''
,
},
initiatorAccountId
:
''
,
initiatorAuthorizedAccountId
:
''
,
remark
:
''
,
},
signers
:
[
{
platformSign
:
false
,
signerAccount
:
{
authorizedAccountId
:
''
,
signerAccountId
:
req
.
accountId
,
},
signfields
:
[
{
autoExecute
:
false
,
fileId
:
_app
.
fileId
,
signType
:
0
,
posBean
:
{
posPage
:
''
,
},
sealId
:
''
,
sealType
:
'0, 1'
,
signDateBean
:
{
format
:
''
,
},
},
],
thirdOrderNo
:
''
,
},
],
},
query
:
{},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'getOneStepUrl 接口 第三步 /api/v2/signflows/createFlowOneStep调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -351,26 +374,29 @@ const _signFlowId = (req, res, callback) => {
// 每次生成的flowId不一致,防止高并发时出现意外
callback
&&
callback
(
_json
.
data
.
flowId
)
})
}
)
}
const
_getUrl
=
(
req
,
res
,
callback
)
=>
{
// 获取url
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/signflows/'
+
req
.
flowId
+
'/executeUrl'
,
method
:
'GET'
,
data
:
{},
query
:
{
flowId
:
req
.
flowId
,
accountId
:
req
.
accountId
accountId
:
req
.
accountId
,
},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
let
jsonErr
=
{
code
:
500
,
message
:
'getOneStepUrl 接口 第四步 /v1/signflows/{flowId}/executeUrl调用失败'
}
let
_json
=
{}
try
{
...
...
@@ -390,35 +416,38 @@ const _getUrl = (req, res, callback) => {
_json
.
data
.
accountId
=
req
.
accountId
_json
.
data
.
fileId
=
_app
.
fileId
callback
&&
callback
(
_json
)
})
}
)
}
// 获取签署后的文件
const
getAfterSignFile
=
(
req
,
res
)
=>
{
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
_domain
,
path
:
'/v1/signflows/'
+
req
.
body
.
flowId
+
'/documents'
,
method
:
'GET'
,
data
:
{},
query
:
{},
headers
:
{
'Host'
:
_domain
,
Host
:
_domain
,
'Content-Type'
:
'application/json; charset=UTF-8'
,
'X-Tsign-Open-Token'
:
_accessToken
,
'X-Tsign-Open-App-Id'
:
_app
.
AppId
}
},
function
(
str
,
obj
)
{
'X-Tsign-Open-App-Id'
:
_app
.
AppId
,
},
},
function
(
str
,
obj
)
{
console
.
log
(
str
)
// callback(str)
res
.
status
(
200
).
json
(
JSON
.
parse
(
str
))
})
}
)
}
module
.
exports
=
{
_getAccessToken
:
_getAccessToken
,
_getUploadUrl
:
_getUploadUrl
,
_getInfoToUploadFile
:
_getInfoToUploadFile
,
getOneStepUrl
:
getOneStepUrl
,
getAfterSignFile
:
getAfterSignFile
getAfterSignFile
:
getAfterSignFile
,
}
server/controller/MixedFlowMonitor.js
浏览文件 @
fa57eaeb
var
com
=
require
(
'@
god
/node-com'
)
var
com
=
require
(
'@
ezijing
/node-com'
)
var
_ReqHttp
=
com
.
Proxy
.
reqHttp
var
_MD5
=
com
.
Tool
.
md5
...
...
@@ -9,7 +9,7 @@ var conf = {
StreamAppId
:
1400255568
,
bizid
:
'33393'
,
sessionId
:
''
,
outStreamId
:
''
outStreamId
:
''
,
}
/* 根据腾讯云 - 创建混流 */
var
getFlow
=
function
(
req
,
res
)
{
...
...
@@ -41,79 +41,83 @@ var _concelFlow = function (req, res) {
/* 处理 混流建立 方式 */
var
_dealCreateData
=
function
(
req
,
_time
)
{
conf
.
sessionId
=
'ne4MjXHKFce1yIwNMkKv9QtV6_hy0RoT'
||
_MD5
(
'zyx_'
+
_time
)
conf
.
outStreamId
=
'33393_ca44d26966c309105baca4dbd10bb279'
||
(
'stream_'
+
conf
.
sessionId
)
conf
.
outStreamId
=
'33393_ca44d26966c309105baca4dbd10bb279'
||
'stream_'
+
conf
.
sessionId
console
.
log
(
_time
,
conf
.
AppId
,
conf
.
sessionId
,
conf
.
outStreamId
,
req
.
body
)
return
JSON
.
stringify
({
'timestamp'
:
_time
,
// UNIX 时间戳数
'eventId'
:
_time
,
// 取随机数即可,标识一次网络请求
'interface'
:
{
'interfaceName'
:
'Mix_StreamV2'
,
// 固定值
'para'
:
{
'app_id'
:
conf
.
AppId
,
// 填写直播 APPID
'interface'
:
'mix_streamv2.start_mix_stream_advanced'
,
// 固定值
timestamp
:
_time
,
// UNIX 时间戳数
eventId
:
_time
,
// 取随机数即可,标识一次网络请求
interface
:
{
interfaceName
:
'Mix_StreamV2'
,
// 固定值
para
:
{
app_id
:
conf
.
AppId
,
// 填写直播 APPID
interface
:
'mix_streamv2.start_mix_stream_advanced'
,
// 固定值
// 'interface': 'mix_streamv2.cancel_mix_stream', // 固定值
'mix_stream_template_id'
:
0
,
'mix_stream_session_id'
:
conf
.
sessionId
,
// 标识一次网络请求
'output_stream_id'
:
conf
.
outStreamId
,
// 填输出流 ID
'output_stream_type'
:
0
,
// 生成新流时,写1
'input_stream_list'
:
[{
mix_stream_template_id
:
0
,
mix_stream_session_id
:
conf
.
sessionId
,
// 标识一次网络请求
output_stream_id
:
conf
.
outStreamId
,
// 填输出流 ID
output_stream_type
:
0
,
// 生成新流时,写1
input_stream_list
:
[
{
// 背景画面
'input_stream_id'
:
'33393_ca44d26966c309105baca4dbd10bb279'
,
// 流 ID
'layout_params'
:
{
'image_layer'
:
1
,
// 图层号,背景填1
'image_width'
:
640
,
'image_height'
:
360
}
},
{
input_stream_id
:
'33393_ca44d26966c309105baca4dbd10bb279'
,
// 流 ID
layout_params
:
{
image_layer
:
1
,
// 图层号,背景填1
image_width
:
640
,
image_height
:
360
,
},
},
{
// 小画面1
'input_stream_id'
:
'33393_9806f61c2d2193106b5bad448e80c3d8'
,
// 流 ID
'layout_params'
:
{
'image_layer'
:
2
,
// 图层标识号
'image_width'
:
120
,
// 画面宽度
'image_height'
:
90
,
// 画面高度
'location_x'
:
10
,
// x偏移:相对于背景画面左上角的横向偏移
'location_y'
:
10
// y偏移:相对于背景画面左上角的纵向偏移
}
}]
}
}
input_stream_id
:
'33393_9806f61c2d2193106b5bad448e80c3d8'
,
// 流 ID
layout_params
:
{
image_layer
:
2
,
// 图层标识号
image_width
:
120
,
// 画面宽度
image_height
:
90
,
// 画面高度
location_x
:
10
,
// x偏移:相对于背景画面左上角的横向偏移
location_y
:
10
,
// y偏移:相对于背景画面左上角的纵向偏移
},
},
],
},
},
})
}
/* 处理 混流取消 方式 */
var
_dealCancelData
=
function
(
req
,
_time
)
{
return
JSON
.
stringify
({
'timestamp'
:
_time
,
// UNIX 时间戳数
'eventId'
:
_time
,
// 混流事件ID,取时间戳即可
'interface'
:
{
'interfaceName'
:
'Mix_StreamV2'
,
// 固定值
'para'
:
{
'app_id'
:
conf
.
AppId
,
'interface'
:
'mix_streamv2.cancel_mix_stream'
,
// 取消混流
timestamp
:
_time
,
// UNIX 时间戳数
eventId
:
_time
,
// 混流事件ID,取时间戳即可
interface
:
{
interfaceName
:
'Mix_StreamV2'
,
// 固定值
para
:
{
app_id
:
conf
.
AppId
,
interface
:
'mix_streamv2.cancel_mix_stream'
,
// 取消混流
// 'interface': 'mix_streamv2.start_mix_stream_advanced', // 取消混流
'mix_stream_session_id'
:
conf
.
sessionId
,
'output_stream_id'
:
conf
.
outStreamId
}
}
mix_stream_session_id
:
conf
.
sessionId
,
output_stream_id
:
conf
.
outStreamId
,
}
,
}
,
})
}
/* 鉴权 - 返回参数 */
var
_getOpt
=
function
(
_time
)
{
/* 定义鉴权 */
var
str
=
'appid='
+
conf
.
AppId
+
'&interface=Mix_StreamV2&t='
+
(
_time
+
60
)
+
'&sign='
+
_MD5
(
conf
.
AppSecret
+
(
_time
+
60
))
var
str
=
'appid='
+
conf
.
AppId
+
'&interface=Mix_StreamV2&t='
+
(
_time
+
60
)
+
'&sign='
+
_MD5
(
conf
.
AppSecret
+
(
_time
+
60
))
var
opt
=
{
hostname
:
'fcgi.video.qcloud.com'
,
path
:
'/common_access?'
+
str
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
'Content-Type'
:
'application/json'
,
},
data
:
{}
data
:
{}
,
}
return
opt
}
module
.
exports
=
{
getFlow
getFlow
,
}
server/controller/NextToSend.js
浏览文件 @
fa57eaeb
const
fs
=
require
(
'fs'
)
const
path
=
require
(
'path'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
Proxy
=
com
.
Proxy
const
getData
=
(
req
,
res
)
=>
{
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
'lms-api.ezijing.com'
,
path
:
'/v2/education/courses/'
+
req
.
path
.
replace
(
/
\/
abc
\/
test
\/
cba
\/
/gi
,
''
),
data
:
{},
query
:
{},
headers
:
{
'Host'
:
'lms-api.ezijing.com'
,
'tenant'
:
req
.
headers
.
tenant
,
'token'
:
req
.
headers
.
token
,
'apikey'
:
req
.
headers
.
apikey
,
Host
:
'lms-api.ezijing.com'
,
tenant
:
req
.
headers
.
tenant
,
token
:
req
.
headers
.
token
,
apikey
:
req
.
headers
.
apikey
,
'User-Agent'
:
req
.
headers
[
'user-agent'
],
'Content-Type'
:
'application/x-www-form-urlencoded'
}
},
function
(
str
,
cookieStr
)
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
},
},
function
(
str
,
cookieStr
)
{
console
.
error
(
'接口读取数据'
,
req
.
headers
.
token
,
str
)
res
.
status
(
200
).
json
(
JSON
.
parse
(
str
))
})
}
)
}
module
.
exports
=
{
getData
:
getData
getData
:
getData
,
}
server/controller/ProxyRequest.js
浏览文件 @
fa57eaeb
const
fs
=
require
(
'fs'
)
const
path
=
require
(
'path'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
Proxy
=
com
.
Proxy
const
md5
=
com
.
Tool
.
md5
const
use
=
(
req
,
res
)
=>
{
Proxy
.
reqHttps
({
Proxy
.
reqHttps
(
{
hostname
:
'zws-api.ezijing.com'
,
path
:
req
.
baseUrl
,
method
:
req
.
method
,
data
:
req
.
body
||
{},
query
:
req
.
query
||
{},
headers
:
{
'Host'
:
'zws-api.ezijing.com'
,
'Cookie'
:
req
.
headers
.
cookie
||
''
,
'apikey'
:
'CXOIO7njD7o3RScs7MSHhvxeG4hbwX2S'
,
Host
:
'zws-api.ezijing.com'
,
Cookie
:
req
.
headers
.
cookie
||
''
,
apikey
:
'CXOIO7njD7o3RScs7MSHhvxeG4hbwX2S'
,
'User-Agent'
:
req
.
headers
[
'user-agent'
],
'Content-Type'
:
'application/x-www-form-urlencoded'
}
},
function
(
str
,
obj
)
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
},
},
function
(
str
,
obj
)
{
console
.
error
(
'获取cookie - 123456789'
,
req
.
headers
.
cookie
)
if
(
/image/gi
.
test
(
obj
.
resHeader
[
'content-type'
]))
{
// 这种方式不够高级,还要先生成一个图片文件,能不能直接返回一个文档流
res
.
header
(
'Content-Type'
,
obj
.
resHeader
[
'content-type'
])
str
=
str
.
replace
(
/^data:image
\/\w
+;base64,/
,
""
)
str
=
str
.
replace
(
/^data:image
\/\w
+;base64,/
,
''
)
let
bf
=
new
Buffer
(
str
,
'base64'
)
fs
.
writeFileSync
(
'upload_tmp/image.'
+
md5
(
bf
)
+
'.png'
,
bf
)
fs
.
createReadStream
(
'upload_tmp/image.'
+
md5
(
bf
)
+
'.png'
).
pipe
(
res
)
...
...
@@ -34,9 +36,10 @@ const use = (req, res) => {
}
else
{
res
.
status
(
200
).
json
(
JSON
.
parse
(
str
))
}
})
}
)
}
module
.
exports
=
{
use
:
use
use
:
use
,
}
server/controller/RTMPMonitor.js
浏览文件 @
fa57eaeb
// var com = require('@god/node-com')
// var com = require('@ezijing/node-com')
var
callback
=
function
(
req
,
res
)
{
var
_body
=
req
.
body
||
{}
console
.
log
(
JSON
.
stringify
(
_body
))
res
.
status
(
200
).
json
({
'msg'
:
'正常'
})
res
.
status
(
200
).
json
({
msg
:
'正常'
})
}
module
.
exports
=
{
callback
:
callback
callback
:
callback
,
}
server/controller/TestMonitor.js
浏览文件 @
fa57eaeb
var
com
=
require
(
'@god/node-com'
)
var
com
=
require
(
'@ezijing/node-com'
)
var
_MD5
=
com
.
Tool
.
md5
...
...
@@ -11,14 +10,17 @@ var isRun = function (req, res) {
var
apikey
=
req
.
headers
.
apikey
||
''
var
timestamp
=
Math
.
floor
(
new
Date
().
getTime
()
/
100000000
)
+
'00000000'
var
md5Str
=
_MD5
(
'godzyx.com'
+
timestamp
)
if
(
operate
===
'1'
)
{
res
.
status
(
200
).
json
({
'MD5-auth'
:
md5Str
});
return
}
if
(
operate
===
'1'
)
{
res
.
status
(
200
).
json
({
'MD5-auth'
:
md5Str
})
return
}
if
(
apikey
===
md5Str
)
{
res
.
status
(
200
).
json
({
'msg'
:
'数据正在处理'
})
res
.
status
(
200
).
json
({
msg
:
'数据正在处理'
})
}
else
{
res
.
status
(
200
).
json
({
'msg'
:
'拒绝访问该接口'
})
res
.
status
(
200
).
json
({
msg
:
'拒绝访问该接口'
})
}
}
module
.
exports
=
{
isRun
:
isRun
isRun
:
isRun
,
}
server/controller/WxMonitor.js
浏览文件 @
fa57eaeb
...
...
@@ -38,7 +38,7 @@ function getsignature (req, res) {
share_json
.
jsapi_ticket
=
JSON
.
parse
(
body
).
ticket
share_json
.
noncestr
=
Math
.
random
().
toString
(
36
).
substr
(
2
,
15
)
// 随机字符串
share_json
.
timestamp
=
parseInt
(
new
Date
().
getTime
()
/
1000
)
+
''
// 事件戳
share_json
.
url
=
req
.
body
.
url
||
req
.
headers
.
referer
share_json
.
url
=
encodeURIComponent
(
req
.
body
.
url
||
req
.
headers
.
referer
)
let
str1
=
'jsapi_ticket='
+
share_json
.
jsapi_ticket
+
'&noncestr='
+
share_json
.
noncestr
+
'×tamp='
+
share_json
.
timestamp
+
'&url='
+
share_json
.
url
let
token
=
sha1
(
str1
)
return
err
?
reject
(
err
)
:
res
.
send
({
...
...
server/controller/setCloudClassMonitor.js
浏览文件 @
fa57eaeb
const
fs
=
require
(
'fs'
)
const
path
=
require
(
'path'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
_mkdir
=
com
.
Tool
.
Directory
.
mkdir
...
...
@@ -10,7 +10,7 @@ const getTable = (req, res) => {
_mkdir
(
path1
.
replace
(
/
\/[^\/]
*
?
$/gi
,
''
),
()
=>
{
fs
.
writeFileSync
(
path1
,
JSON
.
stringify
({}),
'utf8'
)
})
res
.
status
(
200
).
json
({
'msg'
:
'文件不存在,创建文件'
})
res
.
status
(
200
).
json
({
msg
:
'文件不存在,创建文件'
})
return
}
let
_json
=
JSON
.
parse
(
fs
.
readFileSync
(
path1
).
toString
()
||
'{}'
)
...
...
@@ -21,7 +21,7 @@ const setTable = (req, res) => {
let
path1
=
path
.
resolve
(
process
.
cwd
(),
'../node-server-data/cloud-class.json'
)
if
(
!
fs
.
existsSync
(
path1
))
{
_mkdir
(
path1
)
res
.
status
(
200
).
json
({
'msg'
:
'文件不存在,创建文件'
})
res
.
status
(
200
).
json
({
msg
:
'文件不存在,创建文件'
})
return
}
let
_json
=
JSON
.
parse
(
fs
.
readFileSync
(
path1
).
toString
()
||
'{}'
)
...
...
@@ -38,5 +38,5 @@ const setTable = (req, res) => {
module
.
exports
=
{
getTable
:
getTable
,
setTable
:
setTable
setTable
:
setTable
,
}
server/controller/wxChartSuccessMonitor.js
浏览文件 @
fa57eaeb
const
fs
=
require
(
'fs'
)
const
path
=
require
(
'path'
)
const
com
=
require
(
'@
god
/node-com'
)
const
com
=
require
(
'@
ezijing
/node-com'
)
const
_mkdir
=
com
.
Tool
.
Directory
.
mkdir
...
...
@@ -10,7 +10,7 @@ const get = (req, res) => {
_mkdir
(
path1
.
replace
(
/
\/[^\/]
*
?
$/gi
,
''
),
()
=>
{
fs
.
writeFileSync
(
path1
,
JSON
.
stringify
({}),
'utf8'
)
})
res
.
status
(
200
).
json
({
'msg'
:
'文件不存在,创建文件'
})
res
.
status
(
200
).
json
({
msg
:
'文件不存在,创建文件'
})
return
}
let
_json
=
JSON
.
parse
(
fs
.
readFileSync
(
path1
).
toString
()
||
'{}'
)
...
...
@@ -23,7 +23,7 @@ const set = (req, res) => {
let
path1
=
path
.
resolve
(
process
.
cwd
(),
'../node-server-data/wxchart-success.json'
)
if
(
!
fs
.
existsSync
(
path1
))
{
_mkdir
(
path1
.
replace
(
/
\/[^\/]
*
?
$/gi
,
''
))
res
.
status
(
200
).
json
({
'msg'
:
'文件不存在,创建文件'
})
res
.
status
(
200
).
json
({
msg
:
'文件不存在,创建文件'
})
return
}
let
_json
=
JSON
.
parse
(
fs
.
readFileSync
(
path1
).
toString
()
||
'{}'
)
...
...
@@ -36,5 +36,5 @@ const set = (req, res) => {
module
.
exports
=
{
get
:
get
,
set
:
set
set
:
set
,
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论