From c46d009e59b2d5502413afb715094f40c8ad0998 Mon Sep 17 00:00:00 2001 From: iamtsm <1905333456@qq.com> Date: Sat, 21 Jun 2025 21:41:50 +0800 Subject: [PATCH] feat: v0.05-release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: 支持企业开放注册通道 feat: 优化后台管理tab默认选中 feat: 支持指定pm2进程日志路径 feat: 优化请求异常处理 fix: 修复通过分享加入群聊消息错误 fix: 修复浏览器通知失效 fix: 修复画板变量作用域 fix: 修复频道公开开关变更不及时 --- package.json | 4 +- pm2.config.http.json | 15 +++- pm2.config.https.json | 15 +++- src/biz/channel/channel_user_biz.js | 8 +- src/biz/company/company_biz.js | 27 +++++- src/biz/config/config_biz.js | 68 +++++++++++--- src/biz/user/user_login_biz.js | 89 ++++++++++++------- .../system/system_web_company_controller.js | 13 +-- .../web/user/user_login_controller.js | 21 +++-- src/middleware/checkAdmin.js | 6 +- src/service/company/tl_company_service.js | 9 +- src/tables/tl_company.js | 1 + system-res/js/component/company-detail.js | 4 + system-res/js/component/company.js | 18 +++- system-res/js/system.js | 2 +- tlrtcapp.env | 2 +- web-res/index.html | 4 + web-res/js/component/api.js | 9 +- web-res/js/component/draw.js | 1 + web-res/js/module/channel/content.js | 2 + web-res/js/module/channel/list.js | 2 +- web-res/js/module/contact/contact.js | 11 ++- web-res/js/module/contact/list.js | 12 +-- web-res/js/module/login/content.js | 9 ++ web-res/js/module/login/content/account.js | 19 ++-- web-res/js/module/login/content/email.js | 19 +++- web-res/js/tl_rtc_app.js | 11 +-- 27 files changed, 288 insertions(+), 113 deletions(-) diff --git a/package.json b/package.json index 6d7c839..4b8a38b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tl-rtc-app", - "version": "0.0.3", + "version": "0.0.5", "description": "webrtc, p2p, file, video, draw, chat", "scripts": { "http": "pm2 start pm2.config.http.json", @@ -20,7 +20,6 @@ "@grpc/grpc-js": "^1.8.0", "@grpc/proto-loader": "^0.6.0", "body-parser": "^1.20.2", - "bull": "^4.16.5", "concurrently": "^8.2.0", "cookie-parser": "^1.4.6", "cross-env": "^5.2.0", @@ -49,7 +48,6 @@ "image-size": "^2.0.1", "lru-cache": "^10.0.1", "minimist": "^1.2.5", - "mocha": "^10.2.0", "multer": "^1.4.5-lts.1", "music-metadata": "^7.14.0", "mysql2": "^2.1.0", diff --git a/pm2.config.http.json b/pm2.config.http.json index 5d7b4dc..3d19e07 100644 --- a/pm2.config.http.json +++ b/pm2.config.http.json @@ -8,7 +8,10 @@ "max_memory_restart": "500M", "env": { "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", @@ -18,7 +21,10 @@ "max_memory_restart": "500M", "env": { "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", @@ -28,7 +34,10 @@ "max_memory_restart": "500M", "env": { "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 } ] } \ No newline at end of file diff --git a/pm2.config.https.json b/pm2.config.https.json index b00160e..547c145 100644 --- a/pm2.config.https.json +++ b/pm2.config.https.json @@ -8,7 +8,10 @@ "max_memory_restart": "500M", "env": { "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", @@ -18,7 +21,10 @@ "max_memory_restart": "500M", "env": { "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", @@ -28,7 +34,10 @@ "max_memory_restart": "500M", "env": { "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 } ] } \ No newline at end of file diff --git a/src/biz/channel/channel_user_biz.js b/src/biz/channel/channel_user_biz.js index eba4875..da183dc 100644 --- a/src/biz/channel/channel_user_biz.js +++ b/src/biz/channel/channel_user_biz.js @@ -100,12 +100,12 @@ const addChannelUser = async function({ TlUserDef.name ]) - let message = '
' + userInfo[TlUserDef.name] + "加入频道" + '
'; + let message = '' + userInfo[TlUserDef.name] + "加入群聊" + '
'; if(isInvite){ - message = '' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入频道" + '
'; + message = '' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入群聊" + '
'; } if(isShare){ - message = '' + loginUsername + "通过分享加入频道" + '
'; + message = '' + userInfo[TlUserDef.name] + "通过" + loginUsername + "的分享加入群聊" + '
'; } // 生成邀请消息 @@ -255,7 +255,7 @@ const addChannelUserList = async function({ loginInfo, channelId, userIdList, ro channelId, message: '' + loginUsername + "邀请 " + userInfoList.map( item => item[TlUserDef.name] - ).join(",") + " 共" + userInfoList.length + "人加入频道" + '
', + ).join(",") + " 共" + userInfoList.length + "人加入群聊" + '', other: JSON.stringify({ [TlChannelChatOther.ip]: '', }), diff --git a/src/biz/company/company_biz.js b/src/biz/company/company_biz.js index 810b49e..cd95138 100644 --- a/src/biz/company/company_biz.js +++ b/src/biz/company/company_biz.js @@ -26,7 +26,7 @@ const { * @param {*} description */ const adminAddCompany = async function ({ - loginInfo, name, address, phone, email, website, logo, description + loginInfo, name, address, phone, email, website, logo, description, openRegister }) { const { loginUserCompanyId, loginUserId, loginUserRoleId @@ -66,6 +66,11 @@ const adminAddCompany = async function ({ 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({ name, address, @@ -74,7 +79,8 @@ const adminAddCompany = async function ({ website, logo, description, - code + code, + flag }) if(Object.keys(info).length == 0){ @@ -99,10 +105,11 @@ const adminAddCompany = async function ({ * @param {*} code * @param {*} authStatus * @param {*} expiredStatus + * @param {*} openRegister */ const adminUpdateCompany = async function ({ id, loginInfo, name, address, phone, email, - website, logo, description, code, authStatus, expiredStatus + website, logo, description, code, authStatus, expiredStatus, openRegister }) { const { loginUserCompanyId, loginUserId, loginUserRoleId @@ -148,6 +155,10 @@ const adminUpdateCompany = async function ({ return tlResponseArgsError("请求参数错误") } + if(openRegister == undefined || openRegister == null){ + return tlResponseArgsError("请求参数错误") + } + const info = await companyService.getInfoById({ id }) @@ -169,6 +180,8 @@ const adminUpdateCompany = async function ({ flag = setBit(flag, TlCompanyFlag.IS_EXPIRED, false) } + flag = setBit(flag, TlCompanyFlag.IS_OPEN_REGISTER, openRegister) + const result = await companyService.updateInfoById({ id: id, }, { @@ -301,6 +314,7 @@ const adminGetCompanyList = async function ({ const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH) const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED) + const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER) resultList.push({ id: item[TlCompanyDef.id], @@ -314,6 +328,7 @@ const adminGetCompanyList = async function ({ code: item[TlCompanyDef.code], authStatus, expiredStatus, + openRegister, createTime: item[TlCompanyDef.createdAt], }) } @@ -396,6 +411,7 @@ const adminGetCompanyInfo = async function ({ const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH) const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED) + const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER) return tlResponseSuccess("获取成功", { id: info[TlCompanyDef.id], @@ -409,11 +425,14 @@ const adminGetCompanyInfo = async function ({ code: info[TlCompanyDef.code], authStatus, expiredStatus, + openRegister, createTime: info[TlCompanyDef.createdAt], }) } + + module.exports = { getCompanyInfo, @@ -421,5 +440,5 @@ module.exports = { adminUpdateCompany, adminGetCompanyList, adminDeleteCompany, - adminGetCompanyInfo + adminGetCompanyInfo, } \ No newline at end of file diff --git a/src/biz/config/config_biz.js b/src/biz/config/config_biz.js index c24081a..d28310e 100644 --- a/src/biz/config/config_biz.js +++ b/src/biz/config/config_biz.js @@ -1,14 +1,64 @@ - const crypto = require("crypto") const { - tlResponseSuccess, tlResponseForbidden + checkBit, tlResponseSuccess, tlResponseForbidden } = require("../../utils/utils"); const { get_env_config, set_env_config } = require("../../../conf/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 { 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 登录信息 */ const initData = async function({openTurn, useSecret, ip, token}){ + const inviteCodeList = await getAllCompanyInviteCode() + if(!token){ return tlResponseSuccess("获取成功",{ version : conf.version, @@ -26,6 +78,7 @@ const initData = async function({openTurn, useSecret, ip, token}){ rtcConfig: { iceServers: [] }, options: {}, logo : genClientLogo(), + codeList: inviteCodeList }) } @@ -40,6 +93,7 @@ const initData = async function({openTurn, useSecret, ip, token}){ rtcConfig: { iceServers: [] }, options: {}, logo : genClientLogo(), + codeList: inviteCodeList }) } @@ -57,6 +111,7 @@ const initData = async function({openTurn, useSecret, ip, token}){ "offerToReceiveVideo": 1 }, logo : genClientLogo(), + codeList: inviteCodeList }) } @@ -70,6 +125,7 @@ const initData = async function({openTurn, useSecret, ip, token}){ "offerToReceiveVideo": 1 }, logo : genClientLogo(), + codeList: inviteCodeList }) } @@ -158,14 +214,6 @@ const adminGetSystemEnvConfig = async function({ 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配置 const webrtcConfig = { stun_host: conf.webrtc_stun_host, diff --git a/src/biz/user/user_login_biz.js b/src/biz/user/user_login_biz.js index 891b527..05f617f 100644 --- a/src/biz/user/user_login_biz.js +++ b/src/biz/user/user_login_biz.js @@ -21,7 +21,7 @@ const { Def: TlUserDef, Flag: TlUserFlag } = userFields const { fields: userFingerPrintFields } = require('../../tables/tl_user_finger_print') const { Def: TlUserFingerPrintDef } = userFingerPrintFields 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') @@ -30,8 +30,9 @@ const { inner: TlRoleInner } = require('../../tables/tl_role') * @param {*} account * @param {*} password * @param {*} fps + * @param {*} inviteCode */ -const userLoginByAccount = async function({account, password, fps}){ +const userLoginByAccount = async function({account, password, fps, inviteCode}){ if(!account){ return tlResponseArgsError("用户名或密码错误") } @@ -40,6 +41,10 @@ const userLoginByAccount = async function({account, password, fps}){ return tlResponseArgsError("用户名或密码错误") } + if(!inviteCode){ + return tlResponseArgsError("邀请码错误") + } + // base64解码 account = Buffer.from(account, 'base64').toString() password = Buffer.from(password, 'base64').toString() @@ -52,7 +57,26 @@ const userLoginByAccount = async function({account, password, fps}){ 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 }, [ TlUserDef.id, @@ -78,20 +102,6 @@ const userLoginByAccount = async function({account, password, fps}){ 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 info = { loginUserId: user[TlUserDef.id], @@ -122,8 +132,9 @@ const userLoginByAccount = async function({account, password, fps}){ * @param {*} email * @param {*} password * @param {*} fps + * @param {*} inviteCode */ -const userLoginByEmail = async function({email, password, fps}){ +const userLoginByEmail = async function({email, password, fps, inviteCode}){ if(!email){ return tlResponseArgsError("邮箱或密码错误") } @@ -132,6 +143,10 @@ const userLoginByEmail = async function({email, password, fps}){ return tlResponseArgsError("邮箱或密码错误") } + if(!inviteCode){ + return tlResponseArgsError("邀请码错误") + } + // base64解码 email = Buffer.from(email, 'base64').toString() password = Buffer.from(password, 'base64').toString() @@ -144,7 +159,26 @@ const userLoginByEmail = async function({email, password, fps}){ 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 }, [ TlUserDef.id, @@ -162,20 +196,6 @@ const userLoginByEmail = async function({email, password, fps}){ 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({ inputStr: password, hashedStr: user[TlUserDef.password], @@ -214,6 +234,7 @@ const userLoginByEmail = async function({email, password, fps}){ * 通过指纹登录接口 - 一键登录 * @param {*} fps * @param {*} username + * @param {*} inviteCode */ const userLoginByFingerPrint = async function({fps, username}){ if(!fps){ @@ -223,7 +244,7 @@ const userLoginByFingerPrint = async function({fps, username}){ if(!username){ return tlResponseArgsError("一键登录失败, 请使用其他登录方式登录") } - + if(username.length > 20){ return tlResponseArgsError("一键登录失败, 请使用其他登录方式登录") } diff --git a/src/controller/web/system/system_web_company_controller.js b/src/controller/web/system/system_web_company_controller.js index e9cca2c..2b98c5b 100644 --- a/src/controller/web/system/system_web_company_controller.js +++ b/src/controller/web/system/system_web_company_controller.js @@ -1,5 +1,6 @@ const { - tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams, + tlConsole, tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams, + encryptData } = require("../../../utils/utils"); const express = require('express'); const router = express.Router(); @@ -14,10 +15,10 @@ const companyBiz = require('../../../biz/company/company_biz'); */ router.post('/add-company', async function(request, response) { try { - const { name, address, phone, email, website, logo, description } = request.body; + const { name, address, phone, email, website, logo, description, openRegister } = request.body; if (!checkRequestParams({ - name, address, phone, email, website, logo, description + name, address, phone, email, website, logo, description, openRegister })) { response.json(tlResponseArgsError("请求参数非法")); return; @@ -25,7 +26,7 @@ router.post('/add-company', async function(request, response) { const loginInfo = request.ctx || {} 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); @@ -46,7 +47,7 @@ router.post('/update-company', async function(request, response) { try { const { id, name, address, phone, email, website, logo, - description, code, authStatus, expiredStatus + description, code, authStatus, expiredStatus, openRegister } = request.body; if (!checkRequestParams({ @@ -60,7 +61,7 @@ router.post('/update-company', async function(request, response) { const loginInfo = request.ctx || {} const result = await companyBiz.adminUpdateCompany({ id, name, address, phone, email, website, - logo, description, loginInfo, code, authStatus, expiredStatus + logo, description, loginInfo, code, authStatus, expiredStatus, openRegister }); response.json(result); diff --git a/src/controller/web/user/user_login_controller.js b/src/controller/web/user/user_login_controller.js index 6b576fd..0ff8b29 100644 --- a/src/controller/web/user/user_login_controller.js +++ b/src/controller/web/user/user_login_controller.js @@ -1,4 +1,4 @@ -const { +const { tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams, tlResponseSuccess @@ -11,7 +11,6 @@ const { LOGIN : { LOGIN_TOKEN_KEY, LOGIN_TOKEN_EXPIRE, - SYSTEM_LOGIN_TOKEN_EXPIRE, 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) { try { - const { account, password, fps } = request.body; + const { account, password, fps, inviteCode } = request.body; const { [LOGIN_TOKEN_KEY]: token } = request.cookies; if(token){ @@ -59,14 +58,14 @@ router.post('/login-by-account', async function(request, response) { } if (!checkRequestParams({ - account, password, fps + account, password, fps, inviteCode })) { response.json(tlResponseArgsError("请求参数非法")); return; } const result = await userLoginBiz.userLoginByAccount({ - account, password, fps + account, password, fps, inviteCode }); 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) { try { - const { email, password, fps } = request.body; + const { email, password, fps, inviteCode } = request.body; const { [LOGIN_TOKEN_KEY]: token } = request.cookies; if(token){ @@ -101,14 +100,14 @@ router.post('/login-by-email', async function(request, response) { } if (!checkRequestParams({ - email, password, fps + email, password, fps, inviteCode })) { response.json(tlResponseArgsError("请求参数非法")); return; } const result = await userLoginBiz.userLoginByEmail({ - email, password, fps + email, password, fps, inviteCode }); 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) { try { - const { username, fps} = request.body; + const { username, fps, inviteCode } = request.body; const { [LOGIN_TOKEN_KEY]: token } = request.cookies; if(token){ @@ -144,14 +143,14 @@ router.post('/login-by-fp', async function(request, response) { } if (!checkRequestParams({ - username, fps + username, fps, inviteCode })) { response.json(tlResponseArgsError("请求参数非法")); return; } const result = await userLoginBiz.userLoginByFingerPrint({ - username, fps + username, fps, inviteCode }); response.cookie(LOGIN_TOKEN_KEY, result.data, { diff --git a/src/middleware/checkAdmin.js b/src/middleware/checkAdmin.js index 2f0f914..1a799d9 100644 --- a/src/middleware/checkAdmin.js +++ b/src/middleware/checkAdmin.js @@ -1,7 +1,7 @@ const crypto = require('crypto'); const { get_env_config } = require("./../../conf/env_config"); const { - tlConsoleWarn, encryptStr, verifyEncryptStr, + tlConsoleWarn, encryptStr, verifyEncryptStr, setBit } = require("./../../src/utils/utils"); //获取环境变量 const conf = get_env_config(); @@ -14,6 +14,7 @@ const { fields: companyFields } = require('../tables/tl_company') const TlUserDef = userFields.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', description: 'TL-RTC-APP默认企业', 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){ diff --git a/src/service/company/tl_company_service.js b/src/service/company/tl_company_service.js index 071a21a..117e203 100644 --- a/src/service/company/tl_company_service.js +++ b/src/service/company/tl_company_service.js @@ -2,6 +2,7 @@ const { fields } = require('../../tables/tl_company') const TlCompanyDao = require('../../dao/tl_company_dao') const TlCompanyDef = fields.Def const TableName = fields.Name +const TableFields = Object.keys(fields.Def).map(key => fields.Def[key]) const { tlConsoleError, tlConsole } = require("../../../src/utils/utils"); const { Op } = require('sequelize') @@ -11,7 +12,7 @@ const { Op } = require('sequelize') * @param {*} data */ const addInfo = async function ({ - name, address, phone, email, website, logo, description, code + name, address, phone, email, website, logo, description, code, flag }) { // 参数校验 if (!name) { @@ -49,6 +50,11 @@ const addInfo = async function ({ return {} } + if(flag == undefined || flag == null){ + tlConsoleError(TableName, "请求service参数flag为空") + return {} + } + const info = await TlCompanyDao.addInfo({ [TlCompanyDef.name]: name, [TlCompanyDef.address]: address, @@ -57,6 +63,7 @@ const addInfo = async function ({ [TlCompanyDef.website]: website, [TlCompanyDef.logo]: logo, [TlCompanyDef.code]: code, + [TlCompanyDef.flag]: flag, [TlCompanyDef.description]: description }); diff --git a/src/tables/tl_company.js b/src/tables/tl_company.js index a013fcb..719e66a 100644 --- a/src/tables/tl_company.js +++ b/src/tables/tl_company.js @@ -20,6 +20,7 @@ const tl_company_fields = { Flag: { IS_PASS_AUTH: 0x1, //是否通过认证 IS_EXPIRED: 0x2, //是否过期 + IS_OPEN_REGISTER: 0x4, // 是否开放注册 }, } diff --git a/system-res/js/component/company-detail.js b/system-res/js/component/company-detail.js index 84c5bf1..13dcf9b 100644 --- a/system-res/js/component/company-detail.js +++ b/system-res/js/component/company-detail.js @@ -109,6 +109,10 @@ Vue.component('company-detail', { 认证状态: {{ currentCompany.authStatus ? '已认证' : '未认证' }} +