feat: v0.05-release
feat: 支持企业开放注册通道 feat: 优化后台管理tab默认选中 feat: 支持指定pm2进程日志路径 feat: 优化请求异常处理 fix: 修复通过分享加入群聊消息错误 fix: 修复浏览器通知失效 fix: 修复画板变量作用域 fix: 修复频道公开开关变更不及时
This commit is contained in:
parent
0f59746e47
commit
c46d009e59
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tl-rtc-app",
|
"name": "tl-rtc-app",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"description": "webrtc, p2p, file, video, draw, chat",
|
"description": "webrtc, p2p, file, video, draw, chat",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"http": "pm2 start pm2.config.http.json",
|
"http": "pm2 start pm2.config.http.json",
|
||||||
@ -20,7 +20,6 @@
|
|||||||
"@grpc/grpc-js": "^1.8.0",
|
"@grpc/grpc-js": "^1.8.0",
|
||||||
"@grpc/proto-loader": "^0.6.0",
|
"@grpc/proto-loader": "^0.6.0",
|
||||||
"body-parser": "^1.20.2",
|
"body-parser": "^1.20.2",
|
||||||
"bull": "^4.16.5",
|
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
@ -49,7 +48,6 @@
|
|||||||
"image-size": "^2.0.1",
|
"image-size": "^2.0.1",
|
||||||
"lru-cache": "^10.0.1",
|
"lru-cache": "^10.0.1",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"mocha": "^10.2.0",
|
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"music-metadata": "^7.14.0",
|
"music-metadata": "^7.14.0",
|
||||||
"mysql2": "^2.1.0",
|
"mysql2": "^2.1.0",
|
||||||
|
|||||||
@ -8,7 +8,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "http"
|
"tl_rtc_app_env_mode": "http"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-super-api.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-super-api.error.log",
|
||||||
|
"merge_logs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tl-rtc-app-api",
|
"name": "tl-rtc-app-api",
|
||||||
@ -18,7 +21,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "http"
|
"tl_rtc_app_env_mode": "http"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-api.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-api.error.log",
|
||||||
|
"merge_logs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tl-rtc-app-socket",
|
"name": "tl-rtc-app-socket",
|
||||||
@ -28,7 +34,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "http"
|
"tl_rtc_app_env_mode": "http"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-socket.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-socket.error.log",
|
||||||
|
"merge_logs": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -8,7 +8,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "https"
|
"tl_rtc_app_env_mode": "https"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-super-api.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-super-api.error.log",
|
||||||
|
"merge_logs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tl-rtc-app-api",
|
"name": "tl-rtc-app-api",
|
||||||
@ -18,7 +21,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "https"
|
"tl_rtc_app_env_mode": "https"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-api.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-api.error.log",
|
||||||
|
"merge_logs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tl-rtc-app-socket",
|
"name": "tl-rtc-app-socket",
|
||||||
@ -28,7 +34,10 @@
|
|||||||
"max_memory_restart": "500M",
|
"max_memory_restart": "500M",
|
||||||
"env": {
|
"env": {
|
||||||
"tl_rtc_app_env_mode": "https"
|
"tl_rtc_app_env_mode": "https"
|
||||||
}
|
},
|
||||||
|
"out_file": "./logs/tl-rtc-app-socket.log",
|
||||||
|
"error_file": "./logs/tl-rtc-app-socket.error.log",
|
||||||
|
"merge_logs": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -100,12 +100,12 @@ const addChannelUser = async function({
|
|||||||
TlUserDef.name
|
TlUserDef.name
|
||||||
])
|
])
|
||||||
|
|
||||||
let message = '<p>' + userInfo[TlUserDef.name] + "加入频道" + '</p>';
|
let message = '<p>' + userInfo[TlUserDef.name] + "加入群聊" + '</p>';
|
||||||
if(isInvite){
|
if(isInvite){
|
||||||
message = '<p>' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入频道" + '</p>';
|
message = '<p>' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入群聊" + '</p>';
|
||||||
}
|
}
|
||||||
if(isShare){
|
if(isShare){
|
||||||
message = '<p>' + loginUsername + "通过分享加入频道" + '</p>';
|
message = '<p>' + userInfo[TlUserDef.name] + "通过" + loginUsername + "的分享加入群聊" + '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成邀请消息
|
// 生成邀请消息
|
||||||
@ -255,7 +255,7 @@ const addChannelUserList = async function({ loginInfo, channelId, userIdList, ro
|
|||||||
channelId,
|
channelId,
|
||||||
message: '<p>' + loginUsername + "邀请 " + userInfoList.map(
|
message: '<p>' + loginUsername + "邀请 " + userInfoList.map(
|
||||||
item => item[TlUserDef.name]
|
item => item[TlUserDef.name]
|
||||||
).join(",") + " 共" + userInfoList.length + "人加入频道" + '</p>',
|
).join(",") + " 共" + userInfoList.length + "人加入群聊" + '</p>',
|
||||||
other: JSON.stringify({
|
other: JSON.stringify({
|
||||||
[TlChannelChatOther.ip]: '',
|
[TlChannelChatOther.ip]: '',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const {
|
|||||||
* @param {*} description
|
* @param {*} description
|
||||||
*/
|
*/
|
||||||
const adminAddCompany = async function ({
|
const adminAddCompany = async function ({
|
||||||
loginInfo, name, address, phone, email, website, logo, description
|
loginInfo, name, address, phone, email, website, logo, description, openRegister
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
loginUserCompanyId, loginUserId, loginUserRoleId
|
loginUserCompanyId, loginUserId, loginUserRoleId
|
||||||
@ -66,6 +66,11 @@ const adminAddCompany = async function ({
|
|||||||
|
|
||||||
const code = uuid.v4().replace(/-/g, '')
|
const code = uuid.v4().replace(/-/g, '')
|
||||||
|
|
||||||
|
let flag = 0
|
||||||
|
if(openRegister !== null && openRegister !== undefined){
|
||||||
|
flag = setBit(flag, TlCompanyFlag.IS_OPEN_REGISTER, openRegister)
|
||||||
|
}
|
||||||
|
|
||||||
const info = await companyService.addInfo({
|
const info = await companyService.addInfo({
|
||||||
name,
|
name,
|
||||||
address,
|
address,
|
||||||
@ -74,7 +79,8 @@ const adminAddCompany = async function ({
|
|||||||
website,
|
website,
|
||||||
logo,
|
logo,
|
||||||
description,
|
description,
|
||||||
code
|
code,
|
||||||
|
flag
|
||||||
})
|
})
|
||||||
|
|
||||||
if(Object.keys(info).length == 0){
|
if(Object.keys(info).length == 0){
|
||||||
@ -99,10 +105,11 @@ const adminAddCompany = async function ({
|
|||||||
* @param {*} code
|
* @param {*} code
|
||||||
* @param {*} authStatus
|
* @param {*} authStatus
|
||||||
* @param {*} expiredStatus
|
* @param {*} expiredStatus
|
||||||
|
* @param {*} openRegister
|
||||||
*/
|
*/
|
||||||
const adminUpdateCompany = async function ({
|
const adminUpdateCompany = async function ({
|
||||||
id, loginInfo, name, address, phone, email,
|
id, loginInfo, name, address, phone, email,
|
||||||
website, logo, description, code, authStatus, expiredStatus
|
website, logo, description, code, authStatus, expiredStatus, openRegister
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
loginUserCompanyId, loginUserId, loginUserRoleId
|
loginUserCompanyId, loginUserId, loginUserRoleId
|
||||||
@ -148,6 +155,10 @@ const adminUpdateCompany = async function ({
|
|||||||
return tlResponseArgsError("请求参数错误")
|
return tlResponseArgsError("请求参数错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(openRegister == undefined || openRegister == null){
|
||||||
|
return tlResponseArgsError("请求参数错误")
|
||||||
|
}
|
||||||
|
|
||||||
const info = await companyService.getInfoById({
|
const info = await companyService.getInfoById({
|
||||||
id
|
id
|
||||||
})
|
})
|
||||||
@ -169,6 +180,8 @@ const adminUpdateCompany = async function ({
|
|||||||
flag = setBit(flag, TlCompanyFlag.IS_EXPIRED, false)
|
flag = setBit(flag, TlCompanyFlag.IS_EXPIRED, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag = setBit(flag, TlCompanyFlag.IS_OPEN_REGISTER, openRegister)
|
||||||
|
|
||||||
const result = await companyService.updateInfoById({
|
const result = await companyService.updateInfoById({
|
||||||
id: id,
|
id: id,
|
||||||
}, {
|
}, {
|
||||||
@ -301,6 +314,7 @@ const adminGetCompanyList = async function ({
|
|||||||
|
|
||||||
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
|
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
|
||||||
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
|
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
|
||||||
|
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
|
||||||
|
|
||||||
resultList.push({
|
resultList.push({
|
||||||
id: item[TlCompanyDef.id],
|
id: item[TlCompanyDef.id],
|
||||||
@ -314,6 +328,7 @@ const adminGetCompanyList = async function ({
|
|||||||
code: item[TlCompanyDef.code],
|
code: item[TlCompanyDef.code],
|
||||||
authStatus,
|
authStatus,
|
||||||
expiredStatus,
|
expiredStatus,
|
||||||
|
openRegister,
|
||||||
createTime: item[TlCompanyDef.createdAt],
|
createTime: item[TlCompanyDef.createdAt],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -396,6 +411,7 @@ const adminGetCompanyInfo = async function ({
|
|||||||
|
|
||||||
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
|
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
|
||||||
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
|
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
|
||||||
|
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
|
||||||
|
|
||||||
return tlResponseSuccess("获取成功", {
|
return tlResponseSuccess("获取成功", {
|
||||||
id: info[TlCompanyDef.id],
|
id: info[TlCompanyDef.id],
|
||||||
@ -409,11 +425,14 @@ const adminGetCompanyInfo = async function ({
|
|||||||
code: info[TlCompanyDef.code],
|
code: info[TlCompanyDef.code],
|
||||||
authStatus,
|
authStatus,
|
||||||
expiredStatus,
|
expiredStatus,
|
||||||
|
openRegister,
|
||||||
createTime: info[TlCompanyDef.createdAt],
|
createTime: info[TlCompanyDef.createdAt],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getCompanyInfo,
|
getCompanyInfo,
|
||||||
|
|
||||||
@ -421,5 +440,5 @@ module.exports = {
|
|||||||
adminUpdateCompany,
|
adminUpdateCompany,
|
||||||
adminGetCompanyList,
|
adminGetCompanyList,
|
||||||
adminDeleteCompany,
|
adminDeleteCompany,
|
||||||
adminGetCompanyInfo
|
adminGetCompanyInfo,
|
||||||
}
|
}
|
||||||
@ -1,14 +1,64 @@
|
|||||||
|
|
||||||
const crypto = require("crypto")
|
const crypto = require("crypto")
|
||||||
const {
|
const {
|
||||||
tlResponseSuccess, tlResponseForbidden
|
checkBit, tlResponseSuccess, tlResponseForbidden
|
||||||
} = require("../../utils/utils");
|
} = require("../../utils/utils");
|
||||||
const { get_env_config, set_env_config } = require("../../../conf/env_config");
|
const { get_env_config, set_env_config } = require("../../../conf/env_config");
|
||||||
const conf = get_env_config()
|
const conf = get_env_config()
|
||||||
|
|
||||||
|
const companyService = require('../../service/company/tl_company_service')
|
||||||
const userSessionService = require('../../service/user/tl_user_session_service')
|
const userSessionService = require('../../service/user/tl_user_session_service')
|
||||||
const { inner: TlRoleInner } = require('../../tables/tl_role')
|
const { inner: TlRoleInner } = require('../../tables/tl_role')
|
||||||
|
|
||||||
|
const { fields: TlCompanyFields } = require('../../tables/tl_company')
|
||||||
|
|
||||||
|
const {
|
||||||
|
Def: TlCompanyDef, Flag: TlCompanyFlag
|
||||||
|
} = TlCompanyFields
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有企业邀请码 - 最多返回10个
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getAllCompanyInviteCode = async function () {
|
||||||
|
const companyList = await companyService.getListForPage({}, [
|
||||||
|
TlCompanyDef.id,
|
||||||
|
TlCompanyDef.code,
|
||||||
|
TlCompanyDef.name,
|
||||||
|
TlCompanyDef.flag
|
||||||
|
], 1, 10)
|
||||||
|
|
||||||
|
const resultList = []
|
||||||
|
|
||||||
|
for(let i = 0; i < companyList.length; i++) {
|
||||||
|
const item = companyList[i];
|
||||||
|
// 处理每个企业的邀请码
|
||||||
|
const flag = item[TlCompanyDef.flag] || 0
|
||||||
|
const code = item[TlCompanyDef.code] || ''
|
||||||
|
const name = item[TlCompanyDef.name] || ''
|
||||||
|
|
||||||
|
// 过滤掉没有邀请码的企业
|
||||||
|
if(code.length === 0) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
|
||||||
|
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
|
||||||
|
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
|
||||||
|
|
||||||
|
// 没有通过认证、已过期、未开放注册的企业,不算在内
|
||||||
|
if(!authStatus && !expiredStatus && !openRegister) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
resultList.push({
|
||||||
|
value: code,
|
||||||
|
name: name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +69,8 @@ const { inner: TlRoleInner } = require('../../tables/tl_role')
|
|||||||
* @param {*} loginInfo 登录信息
|
* @param {*} loginInfo 登录信息
|
||||||
*/
|
*/
|
||||||
const initData = async function({openTurn, useSecret, ip, token}){
|
const initData = async function({openTurn, useSecret, ip, token}){
|
||||||
|
const inviteCodeList = await getAllCompanyInviteCode()
|
||||||
|
|
||||||
if(!token){
|
if(!token){
|
||||||
return tlResponseSuccess("获取成功",{
|
return tlResponseSuccess("获取成功",{
|
||||||
version : conf.version,
|
version : conf.version,
|
||||||
@ -26,6 +78,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
|
|||||||
rtcConfig: { iceServers: [] },
|
rtcConfig: { iceServers: [] },
|
||||||
options: {},
|
options: {},
|
||||||
logo : genClientLogo(),
|
logo : genClientLogo(),
|
||||||
|
codeList: inviteCodeList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +93,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
|
|||||||
rtcConfig: { iceServers: [] },
|
rtcConfig: { iceServers: [] },
|
||||||
options: {},
|
options: {},
|
||||||
logo : genClientLogo(),
|
logo : genClientLogo(),
|
||||||
|
codeList: inviteCodeList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +111,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
|
|||||||
"offerToReceiveVideo": 1
|
"offerToReceiveVideo": 1
|
||||||
},
|
},
|
||||||
logo : genClientLogo(),
|
logo : genClientLogo(),
|
||||||
|
codeList: inviteCodeList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +125,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
|
|||||||
"offerToReceiveVideo": 1
|
"offerToReceiveVideo": 1
|
||||||
},
|
},
|
||||||
logo : genClientLogo(),
|
logo : genClientLogo(),
|
||||||
|
codeList: inviteCodeList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,14 +214,6 @@ const adminGetSystemEnvConfig = async function({
|
|||||||
password: conf.redis_password,
|
password: conf.redis_password,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 队列配置
|
|
||||||
const queueConfig = {
|
|
||||||
type: conf.task_queue_type,
|
|
||||||
host: conf.task_queue_host,
|
|
||||||
port: conf.task_queue_port,
|
|
||||||
password: conf.task_queue_password,
|
|
||||||
}
|
|
||||||
|
|
||||||
// webrtc配置
|
// webrtc配置
|
||||||
const webrtcConfig = {
|
const webrtcConfig = {
|
||||||
stun_host: conf.webrtc_stun_host,
|
stun_host: conf.webrtc_stun_host,
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const { Def: TlUserDef, Flag: TlUserFlag } = userFields
|
|||||||
const { fields: userFingerPrintFields } = require('../../tables/tl_user_finger_print')
|
const { fields: userFingerPrintFields } = require('../../tables/tl_user_finger_print')
|
||||||
const { Def: TlUserFingerPrintDef } = userFingerPrintFields
|
const { Def: TlUserFingerPrintDef } = userFingerPrintFields
|
||||||
const { fields: channelUserFields } = require('../../tables/tl_channel_user')
|
const { fields: channelUserFields } = require('../../tables/tl_channel_user')
|
||||||
const { Def: TlChannelUserDef } = channelUserFields
|
const { Def: TlChannelUserDef, Type: TlChannelUserType } = channelUserFields
|
||||||
const { inner: TlRoleInner } = require('../../tables/tl_role')
|
const { inner: TlRoleInner } = require('../../tables/tl_role')
|
||||||
|
|
||||||
|
|
||||||
@ -30,8 +30,9 @@ const { inner: TlRoleInner } = require('../../tables/tl_role')
|
|||||||
* @param {*} account
|
* @param {*} account
|
||||||
* @param {*} password
|
* @param {*} password
|
||||||
* @param {*} fps
|
* @param {*} fps
|
||||||
|
* @param {*} inviteCode
|
||||||
*/
|
*/
|
||||||
const userLoginByAccount = async function({account, password, fps}){
|
const userLoginByAccount = async function({account, password, fps, inviteCode}){
|
||||||
if(!account){
|
if(!account){
|
||||||
return tlResponseArgsError("用户名或密码错误")
|
return tlResponseArgsError("用户名或密码错误")
|
||||||
}
|
}
|
||||||
@ -40,6 +41,10 @@ const userLoginByAccount = async function({account, password, fps}){
|
|||||||
return tlResponseArgsError("用户名或密码错误")
|
return tlResponseArgsError("用户名或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!inviteCode){
|
||||||
|
return tlResponseArgsError("邀请码错误")
|
||||||
|
}
|
||||||
|
|
||||||
// base64解码
|
// base64解码
|
||||||
account = Buffer.from(account, 'base64').toString()
|
account = Buffer.from(account, 'base64').toString()
|
||||||
password = Buffer.from(password, 'base64').toString()
|
password = Buffer.from(password, 'base64').toString()
|
||||||
@ -52,7 +57,26 @@ const userLoginByAccount = async function({account, password, fps}){
|
|||||||
return tlResponseArgsError("用户名或密码错误")
|
return tlResponseArgsError("用户名或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await userService.getInfoByNameForLogin({
|
const company = await companyService.getInfoByCode({
|
||||||
|
code: inviteCode
|
||||||
|
}, [
|
||||||
|
TlCompanyDef.id,
|
||||||
|
TlCompanyDef.name
|
||||||
|
])
|
||||||
|
|
||||||
|
if(Object.keys(company).length === 0){
|
||||||
|
return tlResponseArgsError("邀请码无效")
|
||||||
|
}
|
||||||
|
|
||||||
|
const companyId = company[TlCompanyDef.id]
|
||||||
|
const companyName = company[TlCompanyDef.name]
|
||||||
|
|
||||||
|
if(!companyId){
|
||||||
|
return tlResponseForbidden("非法用户")
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await userService.getInfoByName({
|
||||||
|
companyId: companyId,
|
||||||
name: account
|
name: account
|
||||||
}, [
|
}, [
|
||||||
TlUserDef.id,
|
TlUserDef.id,
|
||||||
@ -78,20 +102,6 @@ const userLoginByAccount = async function({account, password, fps}){
|
|||||||
return tlResponseArgsError("用户名或密码错误")
|
return tlResponseArgsError("用户名或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
const company = await companyService.getInfoById({
|
|
||||||
id: user[TlUserDef.companyId]
|
|
||||||
}, [
|
|
||||||
TlCompanyDef.id,
|
|
||||||
TlCompanyDef.name,
|
|
||||||
])
|
|
||||||
|
|
||||||
const companyId = company[TlCompanyDef.id]
|
|
||||||
const companyName = company[TlCompanyDef.name]
|
|
||||||
|
|
||||||
if(!companyId){
|
|
||||||
return tlResponseForbidden("非法用户")
|
|
||||||
}
|
|
||||||
|
|
||||||
const token = userSessionService.generateLoginToken();
|
const token = userSessionService.generateLoginToken();
|
||||||
const info = {
|
const info = {
|
||||||
loginUserId: user[TlUserDef.id],
|
loginUserId: user[TlUserDef.id],
|
||||||
@ -122,8 +132,9 @@ const userLoginByAccount = async function({account, password, fps}){
|
|||||||
* @param {*} email
|
* @param {*} email
|
||||||
* @param {*} password
|
* @param {*} password
|
||||||
* @param {*} fps
|
* @param {*} fps
|
||||||
|
* @param {*} inviteCode
|
||||||
*/
|
*/
|
||||||
const userLoginByEmail = async function({email, password, fps}){
|
const userLoginByEmail = async function({email, password, fps, inviteCode}){
|
||||||
if(!email){
|
if(!email){
|
||||||
return tlResponseArgsError("邮箱或密码错误")
|
return tlResponseArgsError("邮箱或密码错误")
|
||||||
}
|
}
|
||||||
@ -132,6 +143,10 @@ const userLoginByEmail = async function({email, password, fps}){
|
|||||||
return tlResponseArgsError("邮箱或密码错误")
|
return tlResponseArgsError("邮箱或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!inviteCode){
|
||||||
|
return tlResponseArgsError("邀请码错误")
|
||||||
|
}
|
||||||
|
|
||||||
// base64解码
|
// base64解码
|
||||||
email = Buffer.from(email, 'base64').toString()
|
email = Buffer.from(email, 'base64').toString()
|
||||||
password = Buffer.from(password, 'base64').toString()
|
password = Buffer.from(password, 'base64').toString()
|
||||||
@ -144,7 +159,26 @@ const userLoginByEmail = async function({email, password, fps}){
|
|||||||
return tlResponseArgsError("邮箱或密码错误")
|
return tlResponseArgsError("邮箱或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await userService.getInfoByEmailForLogin({
|
const company = await companyService.getInfoByCode({
|
||||||
|
code: inviteCode
|
||||||
|
}, [
|
||||||
|
TlCompanyDef.id,
|
||||||
|
TlCompanyDef.name
|
||||||
|
])
|
||||||
|
|
||||||
|
if(Object.keys(company).length === 0){
|
||||||
|
return tlResponseArgsError("邀请码无效")
|
||||||
|
}
|
||||||
|
|
||||||
|
const companyId = company[TlCompanyDef.id]
|
||||||
|
const companyName = company[TlCompanyDef.name]
|
||||||
|
|
||||||
|
if(!companyId){
|
||||||
|
return tlResponseForbidden("非法用户")
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await userService.getInfoByEmail({
|
||||||
|
companyId: companyId,
|
||||||
email
|
email
|
||||||
}, [
|
}, [
|
||||||
TlUserDef.id,
|
TlUserDef.id,
|
||||||
@ -162,20 +196,6 @@ const userLoginByEmail = async function({email, password, fps}){
|
|||||||
return tlResponseArgsError("邮箱或密码错误")
|
return tlResponseArgsError("邮箱或密码错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
const company = await companyService.getInfoById({
|
|
||||||
id: user[TlUserDef.companyId]
|
|
||||||
}, [
|
|
||||||
TlCompanyDef.id,
|
|
||||||
TlCompanyDef.name
|
|
||||||
])
|
|
||||||
|
|
||||||
const companyId = company[TlCompanyDef.id]
|
|
||||||
const companyName = company[TlCompanyDef.name]
|
|
||||||
|
|
||||||
if(!companyId){
|
|
||||||
return tlResponseForbidden("非法用户")
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!verifyEncryptStr({
|
if(!verifyEncryptStr({
|
||||||
inputStr: password,
|
inputStr: password,
|
||||||
hashedStr: user[TlUserDef.password],
|
hashedStr: user[TlUserDef.password],
|
||||||
@ -214,6 +234,7 @@ const userLoginByEmail = async function({email, password, fps}){
|
|||||||
* 通过指纹登录接口 - 一键登录
|
* 通过指纹登录接口 - 一键登录
|
||||||
* @param {*} fps
|
* @param {*} fps
|
||||||
* @param {*} username
|
* @param {*} username
|
||||||
|
* @param {*} inviteCode
|
||||||
*/
|
*/
|
||||||
const userLoginByFingerPrint = async function({fps, username}){
|
const userLoginByFingerPrint = async function({fps, username}){
|
||||||
if(!fps){
|
if(!fps){
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
const {
|
const {
|
||||||
tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams,
|
tlConsole, tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams,
|
||||||
|
encryptData
|
||||||
} = require("../../../utils/utils");
|
} = require("../../../utils/utils");
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
@ -14,10 +15,10 @@ const companyBiz = require('../../../biz/company/company_biz');
|
|||||||
*/
|
*/
|
||||||
router.post('/add-company', async function(request, response) {
|
router.post('/add-company', async function(request, response) {
|
||||||
try {
|
try {
|
||||||
const { name, address, phone, email, website, logo, description } = request.body;
|
const { name, address, phone, email, website, logo, description, openRegister } = request.body;
|
||||||
|
|
||||||
if (!checkRequestParams({
|
if (!checkRequestParams({
|
||||||
name, address, phone, email, website, logo, description
|
name, address, phone, email, website, logo, description, openRegister
|
||||||
})) {
|
})) {
|
||||||
response.json(tlResponseArgsError("请求参数非法"));
|
response.json(tlResponseArgsError("请求参数非法"));
|
||||||
return;
|
return;
|
||||||
@ -25,7 +26,7 @@ router.post('/add-company', async function(request, response) {
|
|||||||
|
|
||||||
const loginInfo = request.ctx || {}
|
const loginInfo = request.ctx || {}
|
||||||
const result = await companyBiz.adminAddCompany({
|
const result = await companyBiz.adminAddCompany({
|
||||||
name, address, phone, email, website, logo, description, loginInfo
|
name, address, phone, email, website, logo, description, loginInfo, openRegister
|
||||||
});
|
});
|
||||||
|
|
||||||
response.json(result);
|
response.json(result);
|
||||||
@ -46,7 +47,7 @@ router.post('/update-company', async function(request, response) {
|
|||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
id, name, address, phone, email, website, logo,
|
id, name, address, phone, email, website, logo,
|
||||||
description, code, authStatus, expiredStatus
|
description, code, authStatus, expiredStatus, openRegister
|
||||||
} = request.body;
|
} = request.body;
|
||||||
|
|
||||||
if (!checkRequestParams({
|
if (!checkRequestParams({
|
||||||
@ -60,7 +61,7 @@ router.post('/update-company', async function(request, response) {
|
|||||||
const loginInfo = request.ctx || {}
|
const loginInfo = request.ctx || {}
|
||||||
const result = await companyBiz.adminUpdateCompany({
|
const result = await companyBiz.adminUpdateCompany({
|
||||||
id, name, address, phone, email, website,
|
id, name, address, phone, email, website,
|
||||||
logo, description, loginInfo, code, authStatus, expiredStatus
|
logo, description, loginInfo, code, authStatus, expiredStatus, openRegister
|
||||||
});
|
});
|
||||||
|
|
||||||
response.json(result);
|
response.json(result);
|
||||||
|
|||||||
@ -11,7 +11,6 @@ const {
|
|||||||
LOGIN : {
|
LOGIN : {
|
||||||
LOGIN_TOKEN_KEY,
|
LOGIN_TOKEN_KEY,
|
||||||
LOGIN_TOKEN_EXPIRE,
|
LOGIN_TOKEN_EXPIRE,
|
||||||
|
|
||||||
SYSTEM_LOGIN_TOKEN_EXPIRE,
|
SYSTEM_LOGIN_TOKEN_EXPIRE,
|
||||||
SYSTEM_LOGIN_TOKEN_KEY
|
SYSTEM_LOGIN_TOKEN_KEY
|
||||||
}
|
}
|
||||||
@ -46,7 +45,7 @@ router.get('/login-state', async function(request, response) {
|
|||||||
*/
|
*/
|
||||||
router.post('/login-by-account', async function(request, response) {
|
router.post('/login-by-account', async function(request, response) {
|
||||||
try {
|
try {
|
||||||
const { account, password, fps } = request.body;
|
const { account, password, fps, inviteCode } = request.body;
|
||||||
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
||||||
|
|
||||||
if(token){
|
if(token){
|
||||||
@ -59,14 +58,14 @@ router.post('/login-by-account', async function(request, response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkRequestParams({
|
if (!checkRequestParams({
|
||||||
account, password, fps
|
account, password, fps, inviteCode
|
||||||
})) {
|
})) {
|
||||||
response.json(tlResponseArgsError("请求参数非法"));
|
response.json(tlResponseArgsError("请求参数非法"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await userLoginBiz.userLoginByAccount({
|
const result = await userLoginBiz.userLoginByAccount({
|
||||||
account, password, fps
|
account, password, fps, inviteCode
|
||||||
});
|
});
|
||||||
|
|
||||||
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
||||||
@ -88,7 +87,7 @@ router.post('/login-by-account', async function(request, response) {
|
|||||||
*/
|
*/
|
||||||
router.post('/login-by-email', async function(request, response) {
|
router.post('/login-by-email', async function(request, response) {
|
||||||
try {
|
try {
|
||||||
const { email, password, fps } = request.body;
|
const { email, password, fps, inviteCode } = request.body;
|
||||||
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
||||||
|
|
||||||
if(token){
|
if(token){
|
||||||
@ -101,14 +100,14 @@ router.post('/login-by-email', async function(request, response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkRequestParams({
|
if (!checkRequestParams({
|
||||||
email, password, fps
|
email, password, fps, inviteCode
|
||||||
})) {
|
})) {
|
||||||
response.json(tlResponseArgsError("请求参数非法"));
|
response.json(tlResponseArgsError("请求参数非法"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await userLoginBiz.userLoginByEmail({
|
const result = await userLoginBiz.userLoginByEmail({
|
||||||
email, password, fps
|
email, password, fps, inviteCode
|
||||||
});
|
});
|
||||||
|
|
||||||
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
||||||
@ -131,7 +130,7 @@ router.post('/login-by-email', async function(request, response) {
|
|||||||
*/
|
*/
|
||||||
router.post('/login-by-fp', async function(request, response) {
|
router.post('/login-by-fp', async function(request, response) {
|
||||||
try {
|
try {
|
||||||
const { username, fps} = request.body;
|
const { username, fps, inviteCode } = request.body;
|
||||||
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
|
||||||
|
|
||||||
if(token){
|
if(token){
|
||||||
@ -144,14 +143,14 @@ router.post('/login-by-fp', async function(request, response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkRequestParams({
|
if (!checkRequestParams({
|
||||||
username, fps
|
username, fps, inviteCode
|
||||||
})) {
|
})) {
|
||||||
response.json(tlResponseArgsError("请求参数非法"));
|
response.json(tlResponseArgsError("请求参数非法"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await userLoginBiz.userLoginByFingerPrint({
|
const result = await userLoginBiz.userLoginByFingerPrint({
|
||||||
username, fps
|
username, fps, inviteCode
|
||||||
});
|
});
|
||||||
|
|
||||||
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
response.cookie(LOGIN_TOKEN_KEY, result.data, {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const { get_env_config } = require("./../../conf/env_config");
|
const { get_env_config } = require("./../../conf/env_config");
|
||||||
const {
|
const {
|
||||||
tlConsoleWarn, encryptStr, verifyEncryptStr,
|
tlConsoleWarn, encryptStr, verifyEncryptStr, setBit
|
||||||
} = require("./../../src/utils/utils");
|
} = require("./../../src/utils/utils");
|
||||||
//获取环境变量
|
//获取环境变量
|
||||||
const conf = get_env_config();
|
const conf = get_env_config();
|
||||||
@ -14,6 +14,7 @@ const { fields: companyFields } = require('../tables/tl_company')
|
|||||||
|
|
||||||
const TlUserDef = userFields.Def
|
const TlUserDef = userFields.Def
|
||||||
const TlCompanyDef = companyFields.Def
|
const TlCompanyDef = companyFields.Def
|
||||||
|
const TlCompanyFlag = companyFields.Flag
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +46,8 @@ const checkDefaultBeforStartServer = async function(){
|
|||||||
website: 'https://github.com/tl-open-source/tl-rtc-app',
|
website: 'https://github.com/tl-open-source/tl-rtc-app',
|
||||||
description: 'TL-RTC-APP默认企业',
|
description: 'TL-RTC-APP默认企业',
|
||||||
logo: '/image/tlrtcapp-logo.svg',
|
logo: '/image/tlrtcapp-logo.svg',
|
||||||
code: 'tl-rtc-app'
|
code: 'tl-rtc-app',
|
||||||
|
flag: setBit(0, TlCompanyFlag.IS_OPEN_REGISTER, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
if(Object.keys(result).length === 0){
|
if(Object.keys(result).length === 0){
|
||||||
|
|||||||
@ -2,6 +2,7 @@ const { fields } = require('../../tables/tl_company')
|
|||||||
const TlCompanyDao = require('../../dao/tl_company_dao')
|
const TlCompanyDao = require('../../dao/tl_company_dao')
|
||||||
const TlCompanyDef = fields.Def
|
const TlCompanyDef = fields.Def
|
||||||
const TableName = fields.Name
|
const TableName = fields.Name
|
||||||
|
const TableFields = Object.keys(fields.Def).map(key => fields.Def[key])
|
||||||
const { tlConsoleError, tlConsole } = require("../../../src/utils/utils");
|
const { tlConsoleError, tlConsole } = require("../../../src/utils/utils");
|
||||||
const { Op } = require('sequelize')
|
const { Op } = require('sequelize')
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ const { Op } = require('sequelize')
|
|||||||
* @param {*} data
|
* @param {*} data
|
||||||
*/
|
*/
|
||||||
const addInfo = async function ({
|
const addInfo = async function ({
|
||||||
name, address, phone, email, website, logo, description, code
|
name, address, phone, email, website, logo, description, code, flag
|
||||||
}) {
|
}) {
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (!name) {
|
if (!name) {
|
||||||
@ -49,6 +50,11 @@ const addInfo = async function ({
|
|||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(flag == undefined || flag == null){
|
||||||
|
tlConsoleError(TableName, "请求service参数flag为空")
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
const info = await TlCompanyDao.addInfo({
|
const info = await TlCompanyDao.addInfo({
|
||||||
[TlCompanyDef.name]: name,
|
[TlCompanyDef.name]: name,
|
||||||
[TlCompanyDef.address]: address,
|
[TlCompanyDef.address]: address,
|
||||||
@ -57,6 +63,7 @@ const addInfo = async function ({
|
|||||||
[TlCompanyDef.website]: website,
|
[TlCompanyDef.website]: website,
|
||||||
[TlCompanyDef.logo]: logo,
|
[TlCompanyDef.logo]: logo,
|
||||||
[TlCompanyDef.code]: code,
|
[TlCompanyDef.code]: code,
|
||||||
|
[TlCompanyDef.flag]: flag,
|
||||||
[TlCompanyDef.description]: description
|
[TlCompanyDef.description]: description
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const tl_company_fields = {
|
|||||||
Flag: {
|
Flag: {
|
||||||
IS_PASS_AUTH: 0x1, //是否通过认证
|
IS_PASS_AUTH: 0x1, //是否通过认证
|
||||||
IS_EXPIRED: 0x2, //是否过期
|
IS_EXPIRED: 0x2, //是否过期
|
||||||
|
IS_OPEN_REGISTER: 0x4, // 是否开放注册
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -109,6 +109,10 @@ Vue.component('company-detail', {
|
|||||||
<span class="info-label">认证状态:</span>
|
<span class="info-label">认证状态:</span>
|
||||||
<span class="info-value">{{ currentCompany.authStatus ? '已认证' : '未认证' }}</span>
|
<span class="info-value">{{ currentCompany.authStatus ? '已认证' : '未认证' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">注册通道:</span>
|
||||||
|
<span class="info-value">{{ currentCompany.openRegister ? '已开放' : '已关闭' }}</span>
|
||||||
|
</div>
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<span class="info-label">创建时间:</span>
|
<span class="info-label">创建时间:</span>
|
||||||
<span class="info-value">{{ window.util.timeAgo(currentCompany.createTime) }}</span>
|
<span class="info-value">{{ window.util.timeAgo(currentCompany.createTime) }}</span>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ Vue.component('company-component', {
|
|||||||
description: '',
|
description: '',
|
||||||
expiredStatus: false,
|
expiredStatus: false,
|
||||||
authStatus: false,
|
authStatus: false,
|
||||||
|
openRegister: false,
|
||||||
createTime: ''
|
createTime: ''
|
||||||
},
|
},
|
||||||
companySearch: { // 企业搜索条件
|
companySearch: { // 企业搜索条件
|
||||||
@ -175,7 +176,8 @@ Vue.component('company-component', {
|
|||||||
logo: '',
|
logo: '',
|
||||||
description: '',
|
description: '',
|
||||||
expiredStatus: false,
|
expiredStatus: false,
|
||||||
authStatus: false
|
authStatus: false,
|
||||||
|
openRegister: false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showCompanyDialog('添加企业');
|
this.showCompanyDialog('添加企业');
|
||||||
@ -198,7 +200,8 @@ Vue.component('company-component', {
|
|||||||
logo: company.logo || '',
|
logo: company.logo || '',
|
||||||
description: company.description || '',
|
description: company.description || '',
|
||||||
authStatus: company.authStatus || false,
|
authStatus: company.authStatus || false,
|
||||||
expiredStatus: company.expiredStatus || false
|
expiredStatus: company.expiredStatus || false,
|
||||||
|
openRegister: company.openRegister || false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showCompanyDialog('编辑企业');
|
this.showCompanyDialog('编辑企业');
|
||||||
@ -274,6 +277,12 @@ Vue.component('company-component', {
|
|||||||
<input type="checkbox" name="expiredStatus" lay-skin="switch" lay-text="已过期|未过期" ${this.companyForm.expiredStatus ? 'checked' : ''}>
|
<input type="checkbox" name="expiredStatus" lay-skin="switch" lay-text="已过期|未过期" ${this.companyForm.expiredStatus ? 'checked' : ''}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item" style="${isAdd ? 'display:none;' : ''}">
|
||||||
|
<label class="layui-form-label">注册通道</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="checkbox" name="openRegister" lay-skin="switch" lay-text="关闭|开放" ${this.companyForm.openRegister ? 'checked' : ''}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<label class="layui-form-label">企业描述</label>
|
<label class="layui-form-label">企业描述</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -295,6 +304,8 @@ Vue.component('company-component', {
|
|||||||
that.companyForm.authStatus = data.elem.checked;
|
that.companyForm.authStatus = data.elem.checked;
|
||||||
}else if(data.elem.name === 'expiredStatus'){
|
}else if(data.elem.name === 'expiredStatus'){
|
||||||
that.companyForm.expiredStatus = data.elem.checked;
|
that.companyForm.expiredStatus = data.elem.checked;
|
||||||
|
}else if(data.elem.name === 'openRegister'){
|
||||||
|
that.companyForm.openRegister = data.elem.checked;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -311,7 +322,8 @@ Vue.component('company-component', {
|
|||||||
logo: $('input[name="logo"]').val(),
|
logo: $('input[name="logo"]').val(),
|
||||||
description: $('textarea[name="description"]').val(),
|
description: $('textarea[name="description"]').val(),
|
||||||
authStatus: that.companyForm.authStatus,
|
authStatus: that.companyForm.authStatus,
|
||||||
expiredStatus: that.companyForm.expiredStatus
|
expiredStatus: that.companyForm.expiredStatus,
|
||||||
|
openRegister: that.companyForm.openRegister
|
||||||
};
|
};
|
||||||
|
|
||||||
// 保存企业信息
|
// 保存企业信息
|
||||||
|
|||||||
@ -119,7 +119,7 @@ const loadSystemJs = function(){
|
|||||||
username: username, // 用户名
|
username: username, // 用户名
|
||||||
userAvatar: userAvatar, // 用户头像
|
userAvatar: userAvatar, // 用户头像
|
||||||
showUserPanel: false, // 显示用户面板
|
showUserPanel: false, // 显示用户面板
|
||||||
activeTab: '', // 当前激活的Tab
|
activeTab: 'service', // 当前激活的Tab
|
||||||
sidebarCollapsed: false,// 侧边栏是否收缩
|
sidebarCollapsed: false,// 侧边栏是否收缩
|
||||||
loginForm: { // 登录表单
|
loginForm: { // 登录表单
|
||||||
username: '',
|
username: '',
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#-----------------以下为基础配置-----------------#
|
#-----------------以下为基础配置-----------------#
|
||||||
tl_rtc_app_version=0.0.3
|
tl_rtc_app_version=0.0.5
|
||||||
## 后台管理端口
|
## 后台管理端口
|
||||||
tl_rtc_app_super_api_port=9098
|
tl_rtc_app_super_api_port=9098
|
||||||
## api服务端口
|
## api服务端口
|
||||||
|
|||||||
@ -69,6 +69,7 @@
|
|||||||
:is-mobile="isMobile"
|
:is-mobile="isMobile"
|
||||||
:right-module="rightModule"
|
:right-module="rightModule"
|
||||||
:left-module="leftModule"
|
:left-module="leftModule"
|
||||||
|
:code-list="codeList"
|
||||||
v-cloak>
|
v-cloak>
|
||||||
</tl_rtc_app_module_login>
|
</tl_rtc_app_module_login>
|
||||||
|
|
||||||
@ -90,6 +91,8 @@
|
|||||||
@left-module-change="leftModuleChange"
|
@left-module-change="leftModuleChange"
|
||||||
v-show="leftModule == 'contact'"
|
v-show="leftModule == 'contact'"
|
||||||
:socket="socket"
|
:socket="socket"
|
||||||
|
:company="company"
|
||||||
|
:user="user"
|
||||||
:is-mobile="isMobile"
|
:is-mobile="isMobile"
|
||||||
:right-module="rightModule"
|
:right-module="rightModule"
|
||||||
:left-module="leftModule"
|
:left-module="leftModule"
|
||||||
@ -133,6 +136,7 @@
|
|||||||
:is-mobile="isMobile"
|
:is-mobile="isMobile"
|
||||||
:right-module="rightModule"
|
:right-module="rightModule"
|
||||||
:left-module="leftModule"
|
:left-module="leftModule"
|
||||||
|
:code-list="codeList"
|
||||||
v-cloak>
|
v-cloak>
|
||||||
</tl_rtc_app_module_login_content>
|
</tl_rtc_app_module_login_content>
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,14 @@ const tl_rtc_app_api = new Vue({
|
|||||||
options.responseType = responseType;
|
options.responseType = responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = await axios(options)
|
let response = null
|
||||||
|
try{
|
||||||
|
response = await axios(options)
|
||||||
|
}catch(e){
|
||||||
|
console.error("request error: ", e.message)
|
||||||
|
callback && callback(null)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
if(useCache && this.defaultOpenCache){
|
if(useCache && this.defaultOpenCache){
|
||||||
await this.setData({
|
await this.setData({
|
||||||
|
|||||||
@ -1394,6 +1394,7 @@ const tl_rtc_app_draw = new Vue({
|
|||||||
parentDom.appendChild(textarea);
|
parentDom.appendChild(textarea);
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
|
|
||||||
|
let that = this;
|
||||||
textarea.addEventListener('blur', function () {
|
textarea.addEventListener('blur', function () {
|
||||||
if (textarea.value !== '') {
|
if (textarea.value !== '') {
|
||||||
drawTextHandler(textarea.value);
|
drawTextHandler(textarea.value);
|
||||||
|
|||||||
@ -1394,6 +1394,8 @@ const tl_rtc_app_module_channel_content = {
|
|||||||
update_types: ['channelInfo'],
|
update_types: ['channelInfo'],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.channelGroupCanBeSearch = !this.channelGroupCanBeSearch
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@ -228,7 +228,7 @@ const tl_rtc_app_module_channel_list = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
const channelInfo = this.channels.find(item => item.channelId === channelId)
|
const channelInfo = this.channels.find(item => item.channelId === channelId)
|
||||||
new Notification(channelInfo.channelName, {
|
new Notification(channelInfo.channelName, {
|
||||||
body: '收到新消息啦,快去看看吧',
|
body: '收到新消息啦,快去看看吧',
|
||||||
|
|||||||
@ -15,7 +15,11 @@ const tl_rtc_app_module_contact = {
|
|||||||
rightModule: {
|
rightModule: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
}
|
},
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
propsSocket(){
|
propsSocket(){
|
||||||
@ -30,6 +34,9 @@ const tl_rtc_app_module_contact = {
|
|||||||
propsRightModule() {
|
propsRightModule() {
|
||||||
return this.rightModule;
|
return this.rightModule;
|
||||||
},
|
},
|
||||||
|
propsUser(){
|
||||||
|
return this.user;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
leftModule: function (val) {
|
leftModule: function (val) {
|
||||||
@ -74,6 +81,7 @@ const tl_rtc_app_module_contact = {
|
|||||||
:left-module="propsLeftModule"
|
:left-module="propsLeftModule"
|
||||||
:right-module="propsRightModule"
|
:right-module="propsRightModule"
|
||||||
:socket="propsSocket"
|
:socket="propsSocket"
|
||||||
|
:user="propsUser"
|
||||||
@left-module-change="leftModuleChange"
|
@left-module-change="leftModuleChange"
|
||||||
@right-module-change="rightModuleChange"
|
@right-module-change="rightModuleChange"
|
||||||
v-cloak>
|
v-cloak>
|
||||||
@ -84,6 +92,7 @@ const tl_rtc_app_module_contact = {
|
|||||||
:right-module="propsRightModule"
|
:right-module="propsRightModule"
|
||||||
:is-mobile="propsIsMobile"
|
:is-mobile="propsIsMobile"
|
||||||
:socket="propsSocket"
|
:socket="propsSocket"
|
||||||
|
:user="propsUser"
|
||||||
@left-module-change="leftModuleChange"
|
@left-module-change="leftModuleChange"
|
||||||
@right-module-change="rightModuleChange"
|
@right-module-change="rightModuleChange"
|
||||||
v-cloak>
|
v-cloak>
|
||||||
|
|||||||
@ -524,7 +524,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyContactList()
|
await this.getApplyContactList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("好友申请提醒", {
|
new Notification("好友申请提醒", {
|
||||||
body: '收到新的好友申请,快去看看吧',
|
body: '收到新的好友申请,快去看看吧',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
@ -544,7 +544,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyContactList()
|
await this.getApplyContactList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("好友申请提醒", {
|
new Notification("好友申请提醒", {
|
||||||
body: 'ta通过了你的好友申请',
|
body: 'ta通过了你的好友申请',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
@ -564,7 +564,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyContactList()
|
await this.getApplyContactList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("好友申请提醒", {
|
new Notification("好友申请提醒", {
|
||||||
body: 'ta拒绝了你的好友申请',
|
body: 'ta拒绝了你的好友申请',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
@ -582,7 +582,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyGroupList()
|
await this.getApplyGroupList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("群聊申请提醒", {
|
new Notification("群聊申请提醒", {
|
||||||
body: '收到新的群聊申请,快去看看吧',
|
body: '收到新的群聊申请,快去看看吧',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
@ -598,7 +598,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyGroupList()
|
await this.getApplyGroupList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("群聊申请提醒", {
|
new Notification("群聊申请提醒", {
|
||||||
body: 'ta通过了你的群聊申请',
|
body: 'ta通过了你的群聊申请',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
@ -614,7 +614,7 @@ const tl_rtc_app_module_contact_list = {
|
|||||||
await this.getApplyGroupList()
|
await this.getApplyGroupList()
|
||||||
|
|
||||||
// 有浏览器系统桌面消息通知
|
// 有浏览器系统桌面消息通知
|
||||||
if(webNotify && window.Notification && Notification.permission === 'granted'){
|
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
|
||||||
new Notification("群聊申请提醒", {
|
new Notification("群聊申请提醒", {
|
||||||
body: 'ta拒绝了你的群聊申请',
|
body: 'ta拒绝了你的群聊申请',
|
||||||
dir: 'auto',
|
dir: 'auto',
|
||||||
|
|||||||
@ -15,6 +15,10 @@ const tl_rtc_app_module_login_content = {
|
|||||||
rightModule: {
|
rightModule: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
codeList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -30,6 +34,9 @@ const tl_rtc_app_module_login_content = {
|
|||||||
propsRightModule() {
|
propsRightModule() {
|
||||||
return this.rightModule;
|
return this.rightModule;
|
||||||
},
|
},
|
||||||
|
propsCodeList() {
|
||||||
|
return this.codeList;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
leftModule: function (val) {
|
leftModule: function (val) {
|
||||||
@ -105,6 +112,7 @@ const tl_rtc_app_module_login_content = {
|
|||||||
:socket="propsSocket"
|
:socket="propsSocket"
|
||||||
:left-module="propsLeftModule"
|
:left-module="propsLeftModule"
|
||||||
:right-module="propsRightModule"
|
:right-module="propsRightModule"
|
||||||
|
:code-list="propsCodeList"
|
||||||
@left-module-change="leftModuleChange"
|
@left-module-change="leftModuleChange"
|
||||||
@right-module-change="rightModuleChange"
|
@right-module-change="rightModuleChange"
|
||||||
>
|
>
|
||||||
@ -116,6 +124,7 @@ const tl_rtc_app_module_login_content = {
|
|||||||
:socket="propsSocket"
|
:socket="propsSocket"
|
||||||
:left-module="propsLeftModule"
|
:left-module="propsLeftModule"
|
||||||
:right-module="propsRightModule"
|
:right-module="propsRightModule"
|
||||||
|
:code-list="propsCodeList"
|
||||||
@left-module-change="leftModuleChange"
|
@left-module-change="leftModuleChange"
|
||||||
@right-module-change="rightModuleChange"
|
@right-module-change="rightModuleChange"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -11,6 +11,10 @@ const tl_rtc_app_module_login_content_account = {
|
|||||||
rightModule: {
|
rightModule: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
codeList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -23,6 +27,9 @@ const tl_rtc_app_module_login_content_account = {
|
|||||||
propsRightModule() {
|
propsRightModule() {
|
||||||
return this.rightModule;
|
return this.rightModule;
|
||||||
},
|
},
|
||||||
|
propsCodeList() {
|
||||||
|
return this.codeList;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
leftModule: function (val) {
|
leftModule: function (val) {
|
||||||
@ -36,7 +43,7 @@ const tl_rtc_app_module_login_content_account = {
|
|||||||
return {
|
return {
|
||||||
account: '',
|
account: '',
|
||||||
password: '',
|
password: '',
|
||||||
inviteCode: 'tlrtcappdemo',
|
inviteCode: '请输入邀请码',
|
||||||
btnType : 'login',
|
btnType : 'login',
|
||||||
requesting : false
|
requesting : false
|
||||||
}
|
}
|
||||||
@ -92,6 +99,7 @@ const tl_rtc_app_module_login_content_account = {
|
|||||||
let params = {
|
let params = {
|
||||||
account: Base64.encode(this.account),
|
account: Base64.encode(this.account),
|
||||||
password: Base64.encode(this.password),
|
password: Base64.encode(this.password),
|
||||||
|
inviteCode: this.inviteCode,
|
||||||
fps: fps,
|
fps: fps,
|
||||||
}
|
}
|
||||||
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
|
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
|
||||||
@ -182,10 +190,11 @@ const tl_rtc_app_module_login_content_account = {
|
|||||||
开始注册帐号
|
开始注册帐号
|
||||||
</div>
|
</div>
|
||||||
<div class="tl-rtc-app-right-login-content-body-form">
|
<div class="tl-rtc-app-right-login-content-body-form">
|
||||||
<div class="tl-rtc-app-right-login-content-body-form-item" v-show="btnType === 'register'">
|
<div class="tl-rtc-app-right-login-content-body-form-item">
|
||||||
<input
|
<select class="layui-input" lay-search="" v-model="inviteCode">
|
||||||
v-model="inviteCode"
|
<option key="请输入邀请码" value="请输入邀请码">请输入邀请码</option>
|
||||||
type="text" autocomplete="off" placeholder="邀请码" class="layui-input" maxlength="60">
|
<option v-for="code in propsCodeList" :key="code.value" :value="code.value">{{ code.value }} ({{ code.name }})</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="tl-rtc-app-right-login-content-body-form-item">
|
<div class="tl-rtc-app-right-login-content-body-form-item">
|
||||||
<input id='loginAccountInput'
|
<input id='loginAccountInput'
|
||||||
|
|||||||
@ -11,6 +11,10 @@ const tl_rtc_app_module_login_content_email = {
|
|||||||
rightModule: {
|
rightModule: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
codeList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -29,6 +33,9 @@ const tl_rtc_app_module_login_content_email = {
|
|||||||
propsRightModule() {
|
propsRightModule() {
|
||||||
return this.rightModule;
|
return this.rightModule;
|
||||||
},
|
},
|
||||||
|
propsCodeList() {
|
||||||
|
return this.codeList;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
leftModule: function (val) {
|
leftModule: function (val) {
|
||||||
@ -43,7 +50,7 @@ const tl_rtc_app_module_login_content_email = {
|
|||||||
code: '',
|
code: '',
|
||||||
email: '',
|
email: '',
|
||||||
password: '',
|
password: '',
|
||||||
inviteCode: 'tlrtcappdemo',
|
inviteCode: '请输入邀请码',
|
||||||
btnType : 'login',
|
btnType : 'login',
|
||||||
requesting : false,
|
requesting : false,
|
||||||
getCodeTime: 0,
|
getCodeTime: 0,
|
||||||
@ -99,7 +106,8 @@ const tl_rtc_app_module_login_content_email = {
|
|||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
email: Base64.encode(this.email),
|
email: Base64.encode(this.email),
|
||||||
password: Base64.encode(this.password)
|
password: Base64.encode(this.password),
|
||||||
|
inviteCode: this.inviteCode
|
||||||
}
|
}
|
||||||
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
|
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
|
||||||
this.popErrorMsg("请求参数非法")
|
this.popErrorMsg("请求参数非法")
|
||||||
@ -314,8 +322,11 @@ const tl_rtc_app_module_login_content_email = {
|
|||||||
开始重置密码
|
开始重置密码
|
||||||
</div>
|
</div>
|
||||||
<div class="tl-rtc-app-right-login-content-body-form">
|
<div class="tl-rtc-app-right-login-content-body-form">
|
||||||
<div class="tl-rtc-app-right-login-content-body-form-item" v-show="btnType === 'register' || btnType === 'forgot'">
|
<div class="tl-rtc-app-right-login-content-body-form-item">
|
||||||
<input v-model="inviteCode" type="text" autocomplete="off" placeholder="邀请码" class="layui-input" maxlength="60">
|
<select class="layui-input" lay-search="" v-model="inviteCode">
|
||||||
|
<option key="请输入邀请码" value="请输入邀请码">请输入邀请码</option>
|
||||||
|
<option v-for="code in propsCodeList" :key="code.value" :value="code.value">{{ code.value }} ({{ code.name }})</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="tl-rtc-app-right-login-content-body-form-item">
|
<div class="tl-rtc-app-right-login-content-body-form-item">
|
||||||
<input id='loginEmailInput' v-model="email" type="text" autocomplete="off" placeholder="邮箱" class="layui-input" maxlength="48">
|
<input id='loginEmailInput' v-model="email" type="text" autocomplete="off" placeholder="邮箱" class="layui-input" maxlength="48">
|
||||||
|
|||||||
@ -13,7 +13,7 @@ let load_tl_rtc_app_js = async function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
wsHost, logo, version, rtcConfig, options,
|
wsHost, logo, version, rtcConfig, options, codeList
|
||||||
} = configInitRes.data
|
} = configInitRes.data
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@ -195,15 +195,7 @@ let load_tl_rtc_app_js = async function(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let langMode = 'zh'
|
|
||||||
let langArgs = tl_rtc_app_comm.getRequestHashArgs("lang")
|
|
||||||
if (langArgs && ['zh','en'].includes(langArgs)) {
|
|
||||||
langMode = langArgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
langMode : langMode, // 默认中文
|
|
||||||
lang : tl_rtc_app_lang, // 语言包
|
|
||||||
logo : logo, // 打印logo
|
logo : logo, // 打印logo
|
||||||
version : version,// 项目当前版本
|
version : version,// 项目当前版本
|
||||||
socket: socket, // socket
|
socket: socket, // socket
|
||||||
@ -211,6 +203,7 @@ let load_tl_rtc_app_js = async function(){
|
|||||||
options: options, // rtc配置
|
options: options, // rtc配置
|
||||||
wsHost : wsHost, // ws地址
|
wsHost : wsHost, // ws地址
|
||||||
isLogin : isLogin, // 是否登录
|
isLogin : isLogin, // 是否登录
|
||||||
|
codeList: codeList, // 开放的邀请码列表
|
||||||
user: {
|
user: {
|
||||||
userId : userId, // 用户id
|
userId : userId, // 用户id
|
||||||
username: username, // 用户名称
|
username: username, // 用户名称
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user