++ +
From 1415e3084ab5e658159662662e1bf1752e3d2001 Mon Sep 17 00:00:00 2001 From: iamtsm <1905333456@qq.com> Date: Fri, 13 Jun 2025 23:08:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=89=AA=E8=B4=B4=E6=9D=BF/=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=B5=81=E7=A8=8B/=E6=96=87=E6=A1=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 54 +- README_ZH.md | 50 +- gulpfile.js | 7 + package.json | 12 +- pm2.config.http.json | 31 + pm2.config.https.json | 31 + src/biz/cut_paste/cut_paste_biz.js | 1038 +++++++++++++ .../web/cut_paste/cut_paste_controller.js | 308 ++++ .../cut_paste/cut_paste_share_controller.js | 67 + src/controller/web/web.js | 8 + src/dao/tl_cut_paste_dao.js | 211 +++ src/dao/tl_cut_paste_detail_dao.js | 238 +++ src/role/accountRole.js | 9 + src/role/permission.js | 33 + src/role/role.js | 5 +- .../cut_paste/tl_cut_paste_detail_service.js | 186 +++ src/service/cut_paste/tl_cut_paste_service.js | 373 +++++ src/service/user/tl_user_config_service.js | 1 + src/tables/tl_cut_paste.js | 98 ++ src/tables/tl_cut_paste_detail.js | 96 ++ src/tables/tl_user_config.js | 2 + tlrtcapp.env | 2 +- web-res/css/cut-paste/cut-paste-detail.css | 230 +++ web-res/css/cut-paste/cut-paste-list.css | 239 +++ web-res/css/mobile.css | 5 + web-res/css/pc.css | 11 +- web-res/cut-paste.html | 557 +++++++ web-res/image/channel-chat.png | Bin 110534 -> 330432 bytes web-res/index.html | 28 + web-res/js/module/cut_paste/content.js | 688 +++++++++ web-res/js/module/cut_paste/cut_paste.js | 124 ++ web-res/js/module/cut_paste/list.js | 320 ++++ web-res/js/module/cut_paste/top.js | 113 ++ web-res/js/module/setting/content/normal.js | 26 + web-res/js/module/sidebar/sidebar.js | 20 + web-res/js/tl_rtc_app.js | 3 + web-res/static/js/highlight.min.js | 1358 +++++++++++++++++ 37 files changed, 6511 insertions(+), 71 deletions(-) create mode 100644 pm2.config.http.json create mode 100644 pm2.config.https.json create mode 100644 src/biz/cut_paste/cut_paste_biz.js create mode 100644 src/controller/web/cut_paste/cut_paste_controller.js create mode 100644 src/controller/web/cut_paste/cut_paste_share_controller.js create mode 100644 src/dao/tl_cut_paste_dao.js create mode 100644 src/dao/tl_cut_paste_detail_dao.js create mode 100644 src/service/cut_paste/tl_cut_paste_detail_service.js create mode 100644 src/service/cut_paste/tl_cut_paste_service.js create mode 100644 src/tables/tl_cut_paste.js create mode 100644 src/tables/tl_cut_paste_detail.js create mode 100644 web-res/css/cut-paste/cut-paste-detail.css create mode 100644 web-res/css/cut-paste/cut-paste-list.css create mode 100644 web-res/cut-paste.html create mode 100644 web-res/js/module/cut_paste/content.js create mode 100644 web-res/js/module/cut_paste/cut_paste.js create mode 100644 web-res/js/module/cut_paste/list.js create mode 100644 web-res/js/module/cut_paste/top.js create mode 100644 web-res/static/js/highlight.min.js diff --git a/README.md b/README.md index a42d986..4310a72 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +中文: [README_ZH.md](README_ZH.md) +
-
### 安装步骤
-1. 克隆仓库:
+1. 前提条件
+
+ ```bash
+ 确保已安装 Node.js (v16+) 和 npm,mysql(5.7+), redis(4.0+)。
+ ```
+
+2. 克隆仓库:
```bash
git clone https://github.com/tl-open-source/tl-rtc-app.git
```
-
-2. 进入项目目录:
+
+3. 进入项目目录:
```bash
cd tl-rtc-app
```
-
-3. 安装依赖:
+
+4. 安装依赖:
```bash
npm install
```
-4. 安装pm2:
+5. 安装pm2:
```bash
npm install pm2 -g
```
-5. 启动后台管理服务:
+6. 启动服务:
```bash
- pm2 start npm --name=tl-rtc-app-super-api -- run http-super-api
+ npm run http
```
- 或者
+ 或者 (如需体验音视频/屏幕共享/直播等功能):
```bash
- pm2 start npm --name=tl-rtc-app-super-api -- run https-super-api
+ npm run https
```
-6. 启动Api服务:
+7. 打包前端资源:
```bash
- pm2 start npm --name=tl-rtc-app-api -- run http-api
- ```
- 或者
-
- ```bash
- pm2 start npm --name=tl-rtc-app-api -- run https-api
+ gulp default
```
-7. 启动Socket服务:
-
- ```bash
- pm2 start npm --name=tl-rtc-app-socket -- run http-socket
- ```
- 或者
-
- ```bash
- pm2 start npm --name=tl-rtc-app-socket -- run https-socket
- ```
### 使用说明
1. 打开浏览器并访问 `http://localhost:9096` (默认)。
-2. 通过管理端应用进行IM应用管理 `http://localhost:9098` (默认)。
+2. 通过管理端应用进行IM应用管理 `http://localhost:9098/system.html` (默认)。
### 许可证
diff --git a/gulpfile.js b/gulpfile.js
index a32e2b0..335b486 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -211,6 +211,13 @@ const web_module_js = () => {
'./web-res/js/module/contact/content/search_group.js',
'./web-res/js/module/contact/content.js',
+ //cut_paste模块
+ './web-res/js/module/cut_paste/top.js',
+ './web-res/js/module/cut_paste/list.js',
+ './web-res/js/module/cut_paste/cut_paste.js',
+ // cut_paste-content模块
+ './web-res/js/module/cut_paste/content.js',
+
//setting模块
'./web-res/js/module/setting/list.js',
'./web-res/js/module/setting/setting.js',
diff --git a/package.json b/package.json
index d6eb809..8ae86d2 100644
--- a/package.json
+++ b/package.json
@@ -1,14 +1,10 @@
{
"name": "tl-rtc-app",
- "version": "0.0.2",
- "description": "webrtc, video, draw, chat",
+ "version": "0.0.3",
+ "description": "webrtc, p2p, file, video, draw, chat",
"scripts": {
- "http-api": "cross-env tl_rtc_app_env_mode=http node tlapi",
- "http-super-api": "cross-env tl_rtc_app_env_mode=http node tlsuperapi",
- "http-socket": "cross-env tl_rtc_app_env_mode=http node tlsocket",
- "https-api": "cross-env tl_rtc_app_env_mode=https node tlapi",
- "https-super-api": "cross-env tl_rtc_app_env_mode=https node tlsuperapi",
- "https-socket": "cross-env tl_rtc_app_env_mode=https node tlsocket"
+ "http": "pm2 start pm2.config.http.json",
+ "https": "pm2 start pm2.config.https.json"
},
"repository": {
"type": "git",
diff --git a/pm2.config.http.json b/pm2.config.http.json
new file mode 100644
index 0000000..2913878
--- /dev/null
+++ b/pm2.config.http.json
@@ -0,0 +1,31 @@
+{
+ "apps": [
+ {
+ "name": "tl-rtc-app-super-api",
+ "script": "node tlsuperapi",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "http"
+ }
+ },
+ {
+ "name": "tl-rtc-app-api",
+ "script": "node tlapi",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "http"
+ }
+ },
+ {
+ "name": "tl-rtc-app-socket",
+ "script": "node tlsocket",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "http"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/pm2.config.https.json b/pm2.config.https.json
new file mode 100644
index 0000000..3871d03
--- /dev/null
+++ b/pm2.config.https.json
@@ -0,0 +1,31 @@
+{
+ "apps": [
+ {
+ "name": "tl-rtc-app-super-api",
+ "script": "node tlsuperapi",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "https"
+ }
+ },
+ {
+ "name": "tl-rtc-app-api",
+ "script": "node tlapi",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "https"
+ }
+ },
+ {
+ "name": "tl-rtc-app-socket",
+ "script": "node tlsocket",
+ "instances": 1,
+ "max_memory_restart": "500M",
+ "env": {
+ "tl_rtc_app_env_mode": "https"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/biz/cut_paste/cut_paste_biz.js b/src/biz/cut_paste/cut_paste_biz.js
new file mode 100644
index 0000000..a1ddc64
--- /dev/null
+++ b/src/biz/cut_paste/cut_paste_biz.js
@@ -0,0 +1,1038 @@
+const uuid = require('uuid')
+const {
+ tlResponseArgsError, tlResponseForbidden, tlResponseSvrError,
+ tlResponseTimeout, tlResponseNotFound, tlResponseSuccess,
+ tlConsole,
+ setBit,
+ checkBit, checkIsId
+} = require('../../utils/utils')
+const cutPasteService = require('../../service/cut_paste/tl_cut_paste_service')
+const cutPasteDetailService = require('../../service/cut_paste/tl_cut_paste_detail_service')
+const companyService = require('../../service/company/tl_company_service')
+const userService = require('../../service/user/tl_user_service')
+
+const { fields: TlUserFields } = require('../../tables/tl_user')
+const { fields: TlCutPasteFields } = require('../../tables/tl_cut_paste')
+const { fields: TlCutPasteDetailFields } = require('../../tables/tl_cut_paste_detail')
+const { inner: TlRoleInner } = require('../../tables/tl_role')
+const { fields: TlCompanyFields } = require('../../tables/tl_company')
+
+const {
+ Def: TlCutPasteDef, Status: TlCutPasteStatus, Flag: TlCutPasteFlag
+} = TlCutPasteFields
+const {
+ Def: TlCutPasteDetailDef, Type: TlCutPasteDetailType,
+} = TlCutPasteDetailFields
+const { Def: TlUserDef, Flag: TlUserFlag } = TlUserFields
+const { Def: TlCompanyDef } = TlCompanyFields
+
+
+
+/**
+ * 创建剪切板
+ * @param {*} loginInfo
+ * @param {*} title
+ * @param {*} password
+ */
+const createCutPaste = async function ({ loginInfo, title, password }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!title) {
+ return tlResponseArgsError("标题不能为空")
+ }
+
+ if(title.length > 32) {
+ return tlResponseArgsError("标题长度不能超过32")
+ }
+
+ if(password && password.length > 32) {
+ return tlResponseArgsError("密码长度不能超过32")
+ }
+
+ const code = uuid.v4().replace(/-/g, '')
+
+ const cutPaste = await cutPasteService.addInfo({
+ companyId: loginUserCompanyId,
+ userId: loginUserId,
+ title,
+ code,
+ password,
+ flag: 0,
+ status: TlCutPasteStatus.USEED,
+ })
+
+ if(Object.keys(cutPaste).length === 0) {
+ return tlResponseSvrError("创建失败")
+ }
+
+ return tlResponseSuccess("创建成功", {
+ id: cutPaste[TlCutPasteDef.id],
+ code: cutPaste[TlCutPasteDef.code],
+ })
+}
+
+
+/**
+ * 获取剪切板列表
+ * @param {*} loginInfo
+ */
+const getCutPasteList = async function ({ loginInfo }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ const cutPasteList = await cutPasteService.getListByUserId({
+ companyId: loginUserCompanyId,
+ userId: loginUserId,
+ })
+
+ const cutPasteIdList = cutPasteList.map(item => item[TlCutPasteDef.id])
+
+ // 统计剪切板详情数量
+ const cutPasteDetailCountResult = await cutPasteDetailService.getCountByCutPasteIdList({
+ cutPasteIdList,
+ })
+ const cutPasteDetailCountMap = {}
+ for(let i = 0; i < cutPasteDetailCountResult.length; i++) {
+ let item = cutPasteDetailCountResult[i]
+ cutPasteDetailCountMap[item[TlCutPasteDetailDef.cutPasteId]] = item.count
+ }
+
+ let resultList = []
+ for(let i = 0; i < cutPasteList.length; i++) {
+ let item = cutPasteList[i]
+
+ let status = item[TlCutPasteDef.status]
+ let statusStr = ""
+ if (status === TlCutPasteStatus.USEED) {
+ statusStr = "使用中"
+ } else if (status === TlCutPasteStatus.CLOSE) {
+ statusStr = "已关闭"
+ }
+
+ let cutPasteId = item[TlCutPasteDef.id]
+ let detailCount = cutPasteDetailCountMap[cutPasteId] || 0
+
+ resultList.push({
+ id: item[TlCutPasteDef.id],
+ code: item[TlCutPasteDef.code],
+ title: item[TlCutPasteDef.title],
+ status: statusStr,
+ createdTime: item[TlCutPasteDef.createdAt],
+ detailCount,
+ })
+ }
+
+ return tlResponseSuccess("获取成功", resultList)
+}
+
+
+/**
+ * 更新剪切板名称
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ * @param {*} title
+ */
+const updateCutPasteTitle = async function ({ loginInfo, cutPasteId, title }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ if (!title) {
+ return tlResponseArgsError("标题不能为空")
+ }
+
+ if(title.length > 32) {
+ return tlResponseArgsError("标题长度不能超过32")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const updateRes = await cutPasteService.updateInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ }, {
+ [TlCutPasteDef.title]: title,
+ })
+
+ if(Object.keys(updateRes).length === 0) {
+ return tlResponseSvrError("更新失败")
+ }
+
+ return tlResponseSuccess("更新成功")
+}
+
+
+/**
+ * 关闭剪切板
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ */
+const closeCutPaste = async function ({ loginInfo, cutPasteId }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const updateRes = await cutPasteService.updateInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ }, {
+ [TlCutPasteDef.status]: TlCutPasteStatus.CLOSE,
+ })
+
+ if(Object.keys(updateRes).length === 0) {
+ return tlResponseSvrError("关闭失败")
+ }
+
+ return tlResponseSuccess("关闭成功")
+}
+
+
+/**
+ * 开启剪切板
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ */
+const openCutPaste = async function ({ loginInfo, cutPasteId }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const updateRes = await cutPasteService.updateInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ }, {
+ [TlCutPasteDef.status]: TlCutPasteStatus.USEED,
+ })
+
+ if(Object.keys(updateRes).length === 0) {
+ return tlResponseSvrError("开启失败")
+ }
+
+ return tlResponseSuccess("开启成功")
+}
+
+
+/**
+ * 更新剪切板密码
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ * @param {*} password
+ */
+const updateCutPastePassword = async function ({ loginInfo, cutPasteId, password }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ if(password && password.length > 32) {
+ return tlResponseArgsError("密码长度不能超过32")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const updateRes = await cutPasteService.updateInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ }, {
+ [TlCutPasteDef.password]: password,
+ })
+
+ if(Object.keys(updateRes).length === 0) {
+ return tlResponseSvrError("更新失败")
+ }
+
+ return tlResponseSuccess("更新成功")
+}
+
+
+/**
+ * 删除剪切板
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ */
+const deleteCutPaste = async function ({ loginInfo, cutPasteId }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const deleteRes = await cutPasteService.deleteInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if(deleteRes === 0) {
+ return tlResponseSvrError("删除失败")
+ }
+
+ return tlResponseSuccess("删除成功")
+}
+
+
+/**
+ * 删除剪切板详情
+ * @param {*} loginInfo
+ * @param {*} cutPasteDetailId
+ */
+const deleteCutPasteDetail = async function ({ loginInfo, cutPasteDetailId }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteDetailId) {
+ return tlResponseArgsError("剪切板内容id不能为空")
+ }
+
+ cutPasteDetailId = parseInt(cutPasteDetailId)
+ if (!checkIsId(cutPasteDetailId)) {
+ return tlResponseArgsError("剪切板内容id格式错误")
+ }
+
+ const cutPasteDetail = await cutPasteDetailService.getInfoById({
+ id: cutPasteDetailId,
+ }, [
+ TlCutPasteDetailDef.id
+ ])
+
+ if (Object.keys(cutPasteDetail).length === 0) {
+ return tlResponseNotFound("剪切板内容不存在")
+ }
+
+ const result = await cutPasteDetailService.deleteInfoById({
+ id: cutPasteDetailId,
+ })
+
+ if(result === 0) {
+ return tlResponseSvrError("删除失败")
+ }
+
+ return tlResponseSuccess("删除成功")
+}
+
+
+/**
+ * 添加剪切板详情记录
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ * @param {*} content
+ */
+const addCutPasteDetail = async function ({ loginInfo, cutPasteId, content }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if (!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ if (!content) {
+ return tlResponseArgsError("内容不能为空")
+ }
+
+ if(content.length > 8096) {
+ return tlResponseArgsError("内容长度不能超过1024")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const userId = cutPaste[TlCutPasteDef.userId]
+ if (userId !== loginUserId) {
+ return tlResponseForbidden("无权限")
+ }
+
+ const code = cutPaste[TlCutPasteDef.code]
+
+ // 识别内容类型
+ let type = TlCutPasteDetailType.OTHER
+
+ const cutPasteDetail = await cutPasteDetailService.addInfo({
+ cutPasteId,
+ code,
+ flag: 0,
+ content,
+ type
+ })
+
+ if(Object.keys(cutPasteDetail).length === 0) {
+ return tlResponseSvrError("添加失败")
+ }
+
+ return tlResponseSuccess("添加成功", {
+ id: cutPasteDetail[TlCutPasteDetailDef.id],
+ content: cutPasteDetail[TlCutPasteDetailDef.content],
+ type: TlCutPasteDetailType.toStr[cutPasteDetail[TlCutPasteDetailDef.type]],
+ createdTime: cutPasteDetail[TlCutPasteDetailDef.createdAt],
+ })
+}
+
+
+/**
+ * 获取剪切板详情列表
+ * @param {*} loginInfo
+ * @param {*} cutPasteId
+ * @param {*} typeList
+ */
+const getCutPasteDetailList = async function ({ loginInfo, cutPasteId, typeList }) {
+ const {
+ loginUserCompanyId, loginUserId
+ } = loginInfo
+
+ if(!cutPasteId) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ cutPasteId = parseInt(cutPasteId)
+ if (!checkIsId(cutPasteId)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId: loginUserCompanyId,
+ id: cutPasteId,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const cutPasteDetailList = await cutPasteDetailService.getListByCutPasteIdAndTypeList({
+ cutPasteId,
+ typeList,
+ })
+
+ let resultList = []
+ for(let i = 0; i < cutPasteDetailList.length; i++) {
+ let item = cutPasteDetailList[i]
+
+ resultList.push({
+ id: item[TlCutPasteDetailDef.id],
+ content: item[TlCutPasteDetailDef.content],
+ type: TlCutPasteDetailType.toStr[item[TlCutPasteDetailDef.type]],
+ createdTime: item[TlCutPasteDetailDef.createdAt],
+ })
+ }
+
+ return tlResponseSuccess("获取成功", resultList)
+}
+
+
+/**
+ * 获取剪切板详情 - code: 分享场景,不需要登录
+ * @param {*} loginInfo
+ * @param {*} typeList
+ * @param {*} inputPassword
+ */
+const getCutPasteDetailListByCode = async function ({ code, typeList, inputPassword }) {
+ if(!code) {
+ return tlResponseArgsError("剪切板码为空")
+ }
+
+ const cutPaste = await cutPasteService.getInfoByCode({
+ code,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const status = cutPaste[TlCutPasteDef.status]
+ if (status === TlCutPasteStatus.CLOSE) {
+ return tlResponseForbidden("剪切板已关闭")
+ }
+
+ const password = cutPaste[TlCutPasteDef.password]
+ if (password && password !== inputPassword) {
+ return tlResponseForbidden("密码错误")
+ }
+
+ const cutPasteId = cutPaste[TlCutPasteDef.id]
+ const cutPasteDetailList = await cutPasteDetailService.getListByCutPasteIdAndTypeList({
+ cutPasteId,
+ typeList,
+ })
+
+ let resultList = []
+ for(let i = 0; i < cutPasteDetailList.length; i++) {
+ let item = cutPasteDetailList[i]
+
+ resultList.push({
+ id: item[TlCutPasteDetailDef.id],
+ content: item[TlCutPasteDetailDef.content],
+ type: item[TlCutPasteDetailDef.type],
+ createdTime: item[TlCutPasteDetailDef.createdAt],
+ })
+ }
+
+ return tlResponseSuccess("获取成功", resultList)
+}
+
+
+/**
+ * 添加剪切板详情记录 - code: 分享场景,不需要登录
+ * @param {*} code
+ * @param {*} content
+ * @param {*} inputPassword
+ */
+const addCutPasteDetailByCode = async function ({ code, content, inputPassword }) {
+ if(!code) {
+ return tlResponseArgsError("剪切板码为空")
+ }
+
+ if (!content) {
+ return tlResponseArgsError("内容不能为空")
+ }
+
+ const cutPaste = await cutPasteService.getInfoByCode({
+ code,
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const status = cutPaste[TlCutPasteDef.status]
+ if (status === TlCutPasteStatus.CLOSE) {
+ return tlResponseForbidden("剪切板已关闭")
+ }
+
+ const password = cutPaste[TlCutPasteDef.password]
+ if (password && password !== inputPassword) {
+ return tlResponseForbidden("密码错误")
+ }
+
+ const cutPasteId = cutPaste[TlCutPasteDef.id]
+
+ // 识别内容类型
+ let type = TlCutPasteDetailType.OTHER
+
+ const cutPasteDetail = await cutPasteDetailService.addInfo({
+ cutPasteId,
+ code,
+ flag: 0,
+ content,
+ type
+ })
+
+ if(Object.keys(cutPasteDetail).length === 0) {
+ return tlResponseSvrError("添加失败")
+ }
+
+ return tlResponseSuccess("添加成功", {
+ id: cutPasteDetail[TlCutPasteDetailDef.id],
+ content: cutPasteDetail[TlCutPasteDetailDef.content],
+ type: TlCutPasteDetailType.toStr[cutPasteDetail[TlCutPasteDetailDef.type]],
+ createdTime: cutPasteDetail[TlCutPasteDetailDef.createdAt],
+ })
+}
+
+
+/**
+ * 创建剪切板 - 管理员
+ * @param {*} loginInfo
+ * @param {*} title
+ * @param {*} password
+ * @param {*} companyId
+ * @param {*} userId
+ */
+const adminAddCutPaste = async function ({
+ loginInfo, companyId, userId, title, password
+ }) {
+ const {
+ loginUserCompanyId, loginUserId, loginUserRoleId
+ } = loginInfo
+
+ if(loginUserRoleId !== TlRoleInner.user.admin.id){
+ return tlResponseForbidden("非法用户")
+ }
+
+ if (!title) {
+ return tlResponseArgsError("标题不能为空")
+ }
+
+ if(title.length > 32) {
+ return tlResponseArgsError("标题长度不能超过32")
+ }
+
+ if(password && password.length > 32) {
+ return tlResponseArgsError("密码长度不能超过32")
+ }
+
+ if(!companyId) {
+ return tlResponseArgsError("企业id不能为空")
+ }
+
+ if(!userId) {
+ return tlResponseArgsError("用户id不能为空")
+ }
+
+ if(!checkIsId(companyId)) {
+ return tlResponseArgsError("企业id格式错误")
+ }
+
+ if(!checkIsId(userId)) {
+ return tlResponseArgsError("用户id格式错误")
+ }
+
+ companyId = parseInt(companyId)
+ userId = parseInt(userId)
+
+ const company = await companyService.getInfoById({
+ id: companyId,
+ })
+
+ if (Object.keys(company).length === 0) {
+ return tlResponseNotFound("企业不存在")
+ }
+
+ const user = await userService.getInfoById({
+ companyId,
+ id: userId,
+ })
+
+ if (Object.keys(user).length === 0) {
+ return tlResponseNotFound("用户不存在")
+ }
+
+ const code = uuid.v4().replace(/-/g, '')
+
+ let flag = 0
+ if(password) {
+ flag = setBit(flag, TlCutPasteFlag.HAS_PASSWORD, true)
+ }
+
+ const cutPaste = await cutPasteService.addInfo({
+ companyId,
+ userId,
+ title,
+ code,
+ password,
+ flag: flag,
+ status: TlCutPasteStatus.USEED,
+ })
+
+ if(Object.keys(cutPaste).length === 0) {
+ return tlResponseSvrError("创建失败")
+ }
+
+ return tlResponseSuccess("创建成功")
+}
+
+
+/**
+ * 更新剪切板 - 管理员
+ * @param {*} loginInfo
+ * @param {*} companyId
+ * @param {*} id
+ * @param {*} title
+ * @param {*} password
+ * @param {*} status
+ */
+const adminUpdateCutPaste = async function ({
+ loginInfo, companyId, id, title, password, status
+ }) {
+ const {
+ loginUserCompanyId, loginUserId, loginUserRoleId
+ } = loginInfo
+
+ if(loginUserRoleId !== TlRoleInner.user.admin.id){
+ return tlResponseForbidden("非法用户")
+ }
+
+ if (!id) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if(!companyId) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if(!status) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if (!checkIsId(id)) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if(!checkIsId(companyId)) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if(!checkIsId(status)) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ id = parseInt(id)
+ companyId = parseInt(companyId)
+ status = parseInt(status)
+
+ if (!title) {
+ return tlResponseArgsError("标题不能为空")
+ }
+
+ if(title.length > 32) {
+ return tlResponseArgsError("标题长度不能超过32")
+ }
+
+ if(password && password.length > 32) {
+ return tlResponseArgsError("密码长度不能超过32")
+ }
+
+ if(Object.values(TlCutPasteStatus).indexOf(status) === -1) {
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId,
+ id
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ let flag = cutPaste[TlCutPasteDef.flag]
+ if(password) {
+ flag = setBit(flag, TlCutPasteFlag.HAS_PASSWORD, true)
+ } else {
+ flag = setBit(flag, TlCutPasteFlag.HAS_PASSWORD, false)
+ }
+
+ const updateRes = await cutPasteService.updateInfoById({
+ companyId,
+ id,
+ }, {
+ [TlCutPasteDef.title]: title,
+ [TlCutPasteDef.password]: password,
+ [TlCutPasteDef.flag]: flag,
+ [TlCutPasteDef.status]: status
+ })
+
+ if(Object.keys(updateRes).length === 0) {
+ return tlResponseSvrError("更新失败")
+ }
+
+ return tlResponseSuccess("更新成功")
+}
+
+
+/**
+ * 删除剪切板 - 管理员
+ * @param {*} loginInfo
+ * @param {*} companyId
+ * @param {*} id
+ */
+const adminDeleteCutPaste = async function ({ loginInfo, companyId, id }) {
+ const {
+ loginUserCompanyId, loginUserId, loginUserRoleId
+ } = loginInfo
+
+ if(loginUserRoleId !== TlRoleInner.user.admin.id){
+ return tlResponseForbidden("非法用户")
+ }
+
+ if (!id) {
+ return tlResponseArgsError("剪切板ID不能为空")
+ }
+
+ if(!companyId) {
+ return tlResponseArgsError("企业id不能为空")
+ }
+
+ if (!checkIsId(id)) {
+ return tlResponseArgsError("剪切板ID格式错误")
+ }
+
+ id = parseInt(id)
+ companyId = parseInt(companyId)
+
+ const cutPaste = await cutPasteService.getInfoById({
+ companyId,
+ id
+ })
+
+ if (Object.keys(cutPaste).length === 0) {
+ return tlResponseNotFound("剪切板不存在")
+ }
+
+ const deleteRes = await cutPasteService.deleteInfoById({
+ companyId,
+ id,
+ })
+
+ if(deleteRes === 0) {
+ return tlResponseSvrError("删除失败")
+ }
+
+ return tlResponseSuccess("删除成功")
+}
+
+
+/**
+ * 获取剪切板列表 - 管理员
+ * @param {*} loginInfo
+ * @param {*} keyword
+ * @param {*} page
+ * @param {*} limit
+ */
+const adminGetCutPasteList = async function ({ loginInfo, keyword, page, limit }) {
+ const {
+ loginUserCompanyId, loginUserId, loginUserRoleId
+ } = loginInfo
+
+ if(loginUserRoleId !== TlRoleInner.user.admin.id){
+ return tlResponseForbidden("非法用户")
+ }
+
+ if(!checkIsId(page)){
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ if(!checkIsId(limit)){
+ return tlResponseArgsError("请求参数错误")
+ }
+
+ page = parseInt(page)
+ limit = parseInt(limit)
+
+ let total = 0
+ let list = []
+
+ if(keyword === '' || keyword === null || keyword === undefined){
+ list = await cutPasteService.getListForPage({}, [
+ TlCutPasteDef.id,
+ TlCutPasteDef.companyId,
+ TlCutPasteDef.userId,
+ TlCutPasteDef.code,
+ TlCutPasteDef.password,
+ TlCutPasteDef.title,
+ TlCutPasteDef.status,
+ TlCutPasteDef.createdAt,
+ ], page, limit)
+
+ total = await cutPasteService.getCount({})
+ }else{
+ list = await cutPasteService.getListByKeywordForPage({
+ keyword
+ }, [
+ TlCutPasteDef.id,
+ TlCutPasteDef.companyId,
+ TlCutPasteDef.userId,
+ TlCutPasteDef.code,
+ TlCutPasteDef.password,
+ TlCutPasteDef.title,
+ TlCutPasteDef.status,
+ TlCutPasteDef.createdAt,
+ ], page, limit)
+
+ total = await cutPasteService.getCountByKeyword({
+ keyword
+ })
+ }
+
+ // 获取用户信息
+ const userMap = {}
+ const userIdList = list.map(item => item[TlCutPasteDef.userId])
+ const userList = await userService.getListByIdListNoCompanyId({
+ idList: userIdList
+ }, [
+ TlUserDef.id,
+ TlUserDef.name
+ ])
+ userList.forEach(item => {
+ userMap[item[TlUserDef.id]] = item
+ })
+
+ // 获取企业信息
+ const companyMap = {}
+ const companyIdList = list.map(item => item[TlCutPasteDef.companyId])
+ const companyList = await companyService.getListByIdList({
+ idList: companyIdList
+ }, [
+ TlCompanyDef.id,
+ TlCompanyDef.name
+ ])
+ companyList.forEach(item => {
+ companyMap[item[TlCompanyDef.id]] = item
+ })
+
+ let resultList = []
+
+ for(let i = 0; i < list.length; i++) {
+ let item = list[i]
+
+ let status = item[TlCutPasteDef.status]
+ let statusStr = TlCutPasteStatus.toStr(status)
+
+ let userId = item[TlCutPasteDef.userId]
+ let user = userMap[userId] || {}
+
+ let companyId = item[TlCutPasteDef.companyId]
+ let company = companyMap[companyId] || {}
+
+ resultList.push({
+ id: item[TlCutPasteDef.id],
+ companyId,
+ companyName: company[TlCompanyDef.name],
+ userId,
+ username: user[TlUserDef.name],
+ code: item[TlCutPasteDef.code],
+ title: item[TlCutPasteDef.title],
+ password: item[TlCutPasteDef.password],
+ statusStr,
+ status,
+ createTime: item[TlCutPasteDef.createdAt],
+ })
+ }
+
+ return tlResponseSuccess("获取成功", {
+ count: total,
+ list: resultList
+ })
+}
+
+
+module.exports = {
+ createCutPaste,
+ getCutPasteList,
+ updateCutPasteTitle,
+ closeCutPaste,
+ openCutPaste,
+ updateCutPastePassword,
+ deleteCutPaste,
+
+ deleteCutPasteDetail,
+ addCutPasteDetail,
+ getCutPasteDetailList,
+ getCutPasteDetailListByCode,
+ addCutPasteDetailByCode,
+
+ adminAddCutPaste,
+ adminUpdateCutPaste,
+ adminDeleteCutPaste,
+ adminGetCutPasteList
+}
\ No newline at end of file
diff --git a/src/controller/web/cut_paste/cut_paste_controller.js b/src/controller/web/cut_paste/cut_paste_controller.js
new file mode 100644
index 0000000..0874117
--- /dev/null
+++ b/src/controller/web/cut_paste/cut_paste_controller.js
@@ -0,0 +1,308 @@
+const {
+ tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams,
+} = require("../../../utils/utils");
+const express = require('express');
+const router = express.Router();
+const cutPasteBiz = require('../../../biz/cut_paste/cut_paste_biz');
+const {
+ contentFilter, objectContentFilter
+} = require('../../../utils/sensitive/content')
+
+
+/**
+ * #controller get /api/web/cut-paste/get-cut-paste-list
+ * #desc 获取剪切板列表
+ * @param {*} request
+ * @param {*} response
+ */
+router.get('/get-cut-paste-list', async function(request, response) {
+ try {
+ const loginInfo = request.ctx || {}
+ const result = await cutPasteBiz.getCutPasteList({
+ loginInfo
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/add-cut-paste
+ * #desc 新增剪切板
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/add-cut-paste', async function(request, response) {
+ try {
+ const { code, title, password } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ code, title, password
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.createCutPaste({
+ loginInfo, code, title: contentFilter(title), password
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/update-cut-paste-title
+ * #desc 更新剪切板标题
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/update-cut-paste-title', async function(request, response) {
+ try {
+ const { cutPasteId, title } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId, title
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.updateCutPasteTitle({
+ loginInfo, cutPasteId, title: contentFilter(title),
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/update-cut-paste-password
+ * #desc 更新剪切板密码
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/update-cut-paste-password', async function(request, response) {
+ try {
+ const { cutPasteId, password } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId, password
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.updateCutPastePassword({
+ loginInfo, cutPasteId, password
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/close-cut-paste
+ * #desc 关闭剪切板
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/close-cut-paste', async function(request, response) {
+ try {
+ const { cutPasteId } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.closeCutPaste({
+ loginInfo, cutPasteId
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/open-cut-paste
+ * #desc 开启剪切板
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/open-cut-paste', async function(request, response) {
+ try {
+ const { cutPasteId } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.openCutPaste({
+ loginInfo, cutPasteId
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/delete-cut-paste
+ * #desc 删除剪切板
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/delete-cut-paste', async function(request, response) {
+ try {
+ const { cutPasteId } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.deleteCutPaste({
+ loginInfo, cutPasteId
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste/delete-cut-paste-detail
+ * #desc 删除剪切板详情
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/delete-cut-paste-detail', async function(request, response) {
+ try {
+ const { cutPasteDetailId } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteDetailId
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.deleteCutPasteDetail({
+ loginInfo, cutPasteDetailId
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+
+/**
+ * #controller post /api/web/cut-paste/add-cut-paste-detail
+ * #desc 新增剪切板详情
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/add-cut-paste-detail', async function(request, response) {
+ try {
+ const { cutPasteId, content } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.addCutPasteDetail({
+ loginInfo, cutPasteId, content: contentFilter(content),
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+
+/**
+ * #controller post /api/web/cut-paste/get-cut-paste-detail-list
+ * #desc 获取剪切板详情列表
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/get-cut-paste-detail-list', async function(request, response) {
+ try {
+ const { cutPasteId, typeList } = request.body;
+ const loginInfo = request.ctx || {}
+
+ if (!checkRequestParams({
+ cutPasteId, typeList
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.getCutPasteDetailList({
+ loginInfo, cutPasteId, typeList
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+
+
+module.exports = router;
+
diff --git a/src/controller/web/cut_paste/cut_paste_share_controller.js b/src/controller/web/cut_paste/cut_paste_share_controller.js
new file mode 100644
index 0000000..55dadf1
--- /dev/null
+++ b/src/controller/web/cut_paste/cut_paste_share_controller.js
@@ -0,0 +1,67 @@
+const {
+ tlConsole, tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams
+} = require("../../../utils/utils");
+const express = require('express');
+const router = express.Router();
+const cutPasteBiz = require('../../../biz/cut_paste/cut_paste_biz');
+
+
+/**
+ * #controller post /api/web/cut-paste-share/share-get-cut-paste-list
+ * #desc 通过分享渠道获取剪切板列表
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/share-get-cut-paste-list', async function(request, response) {
+ try {
+ const { code, typeList, password } = request.body;
+ if (!checkRequestParams({
+ code, typeList, password
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.getCutPasteDetailListByCode({
+ code, typeList, inputPassword: password
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+/**
+ * #controller post /api/web/cut-paste-share/share-add-cut-paste-detail
+ * #desc 通过分享渠道新增剪切板详情
+ * @param {*} request
+ * @param {*} response
+ */
+router.post('/share-add-cut-paste-detail', async function(request, response) {
+ try {
+ const { code, content, password } = request.body;
+
+ if (!checkRequestParams({
+ code, password
+ })) {
+ response.json(tlResponseArgsError("请求参数非法"));
+ return;
+ }
+
+ const result = await cutPasteBiz.addCutPasteDetailByCode({
+ code, content, inputPassword: password
+ });
+
+ response.json(result);
+ } catch (error) {
+ tlConsoleError(error)
+ response.json(tlResponseSvrError());
+ }
+});
+
+
+module.exports = router;
+
diff --git a/src/controller/web/web.js b/src/controller/web/web.js
index 2b509c8..e312170 100644
--- a/src/controller/web/web.js
+++ b/src/controller/web/web.js
@@ -39,6 +39,11 @@ const channelMedia = require('./channel/channel_media_controller')
// 文件
const cloudFile = require('./cloud/cloud_file_controller')
+// 剪贴板
+const cutPaste = require('./cut_paste/cut_paste_controller')
+const cutPasteShare = require('./cut_paste/cut_paste_share_controller')
+
+
module.exports = {
"system-web-config" : systemWebConfig,
"system-web-company" : systemWebCompany,
@@ -68,5 +73,8 @@ module.exports = {
"channel-file" : channelFile,
"channel-media" : channelMedia,
+ "cut-paste" : cutPaste,
+ "cut-paste-share" : cutPasteShare,
+
"cloud-file" : cloudFile,
}
diff --git a/src/dao/tl_cut_paste_dao.js b/src/dao/tl_cut_paste_dao.js
new file mode 100644
index 0000000..168cb7b
--- /dev/null
+++ b/src/dao/tl_cut_paste_dao.js
@@ -0,0 +1,211 @@
+const { DataTypes, where } = require('sequelize');
+const { dbClient } = require('../tables/db')
+const { model, fields } = require('../tables/tl_cut_paste')
+const Table = model(dbClient, DataTypes).TlCutPaste
+const TableName = fields.Name
+const TableFields = Object.keys(fields.Def).map(key => fields.Def[key])
+const { tlConsoleError, tlConsole, checkRawFieldType } = require("../utils/utils");
+
+/**
+ * addInfo 接口
+ * @param {*} data
+ */
+const addInfo = async function(data){
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+
+ const info = await Table.create(data)
+
+ tlConsole(TableName, data, info)
+
+ return info
+}
+
+/**
+ * addList 接口
+ * @param {*} dataList
+ */
+const addList = async function(dataList){
+ if(dataList.length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ for(let data of dataList){
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+ }
+
+ const list = await Table.bulkCreate(dataList)
+
+ tlConsole(TableName, dataList, list)
+
+ return list
+}
+
+
+/**
+ * getInfo 接口
+ * @param {*} params
+ * @param {*} fields
+ */
+const getInfo = async function(params, fields = TableFields){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ const info = await Table.findOne({
+ where: params,
+ attributes: fields
+ })
+
+ return info
+}
+
+/**
+ * getList 接口
+ * @param {*} params
+ * @param {*} fields
+ * @param {*} order
+ */
+const getList = async function(params, fields = TableFields, order = [['id', 'ASC']]){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const list = await Table.findAll({
+ where : params,
+ attributes: fields,
+ order: order
+ })
+
+ return list
+}
+
+/**
+ * getListForPage 接口
+ * @param {*} params
+ * @param {*} fields
+ * @param {*} order
+ * @param {*} page
+ * @param {*} pageSize
+ */
+const getListForPage = async function(params, fields = TableFields, order = [['id', 'ASC']], page = 1, pageSize = 10){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const list = await Table.findAll({
+ where : params,
+ attributes: fields,
+ order: order,
+ offset: (page - 1) * pageSize,
+ limit: pageSize
+ })
+
+ return list
+}
+
+/**
+ * updateInfo 接口
+ * @param {*} params
+ */
+const updateInfo = async function(params, data){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+
+ const info = await Table.update(data, {
+ where: params
+ })
+
+ tlConsole(TableName, params, data, info)
+
+ if(info[0] === 0){
+ return null
+ }
+
+ return {
+ count: info[0]
+ }
+}
+
+
+/**
+ * deleteInfo 接口
+ * @param {*} params
+ */
+const deleteInfo = async function(params){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ const info = await Table.destroy({
+ where: params
+ })
+
+ tlConsole(TableName, params, info)
+
+ return info
+}
+
+/**
+ * getCount 接口
+ * @param {*} params
+ */
+const getCount = async function(params){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const count = await Table.count({
+ where : params
+ })
+
+ return count
+}
+
+
+module.exports = {
+ addInfo, addList,
+ getInfo, getList, getListForPage,
+ updateInfo,
+ deleteInfo,
+ getCount,
+}
\ No newline at end of file
diff --git a/src/dao/tl_cut_paste_detail_dao.js b/src/dao/tl_cut_paste_detail_dao.js
new file mode 100644
index 0000000..4730966
--- /dev/null
+++ b/src/dao/tl_cut_paste_detail_dao.js
@@ -0,0 +1,238 @@
+const { DataTypes, where } = require('sequelize');
+const { dbClient } = require('../tables/db')
+const { model, fields } = require('../tables/tl_cut_paste_detail')
+const Table = model(dbClient, DataTypes).TlCutPasteDetail
+const TableName = fields.Name
+const TableFields = Object.keys(fields.Def).map(key => fields.Def[key])
+const { tlConsoleError, tlConsole, checkRawFieldType } = require("../utils/utils");
+
+/**
+ * addInfo 接口
+ * @param {*} data
+ */
+const addInfo = async function(data){
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+
+ const info = await Table.create(data)
+
+ tlConsole(TableName, data, info)
+
+ return info
+}
+
+/**
+ * addList 接口
+ * @param {*} dataList
+ */
+const addList = async function(dataList){
+ if(dataList.length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ for(let data of dataList){
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+ }
+
+ const list = await Table.bulkCreate(dataList)
+
+ tlConsole(TableName, dataList, list)
+
+ return list
+}
+
+
+/**
+ * getInfo 接口
+ * @param {*} params
+ * @param {*} fields
+ */
+const getInfo = async function(params, fields = TableFields){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ const info = await Table.findOne({
+ where: params,
+ attributes: fields
+ })
+
+ return info
+}
+
+/**
+ * getList 接口
+ * @param {*} params
+ * @param {*} fields
+ * @param {*} order
+ */
+const getList = async function(params, fields = TableFields, order = [['id', 'ASC']]){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const list = await Table.findAll({
+ where : params,
+ attributes: fields,
+ order: order
+ })
+
+ return list
+}
+
+/**
+ * getListForPage 接口
+ * @param {*} params
+ * @param {*} fields
+ * @param {*} order
+ * @param {*} page
+ * @param {*} pageSize
+ */
+const getListForPage = async function(params, fields = TableFields, order = [['id', 'ASC']], page = 1, pageSize = 10){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const list = await Table.findAll({
+ where : params,
+ attributes: fields,
+ order: order,
+ offset: (page - 1) * pageSize,
+ limit: pageSize
+ })
+
+ return list
+}
+
+/**
+ * updateInfo 接口
+ * @param {*} params
+ */
+const updateInfo = async function(params, data){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ if(Object.keys(data).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ // 参数校验
+ const checkStatus = checkRawFieldType(Table.rawAttributes, data)
+ if (!checkStatus) {
+ tlConsoleError(TableName, "请求dao参数类型错误")
+ return null
+ }
+
+ const info = await Table.update(data, {
+ where: params
+ })
+
+ tlConsole(TableName, params, data, info)
+
+ if(info[0] === 0){
+ return null
+ }
+
+ return {
+ count: info[0]
+ }
+}
+
+
+/**
+ * deleteInfo 接口
+ * @param {*} params
+ */
+const deleteInfo = async function(params){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数为空")
+ return null
+ }
+
+ const info = await Table.destroy({
+ where: params
+ })
+
+ tlConsole(TableName, params, info)
+
+ return info
+}
+
+/**
+ * getCount 接口
+ * @param {*} params
+ */
+const getCount = async function(params){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const count = await Table.count({
+ where : params
+ })
+
+ return count
+}
+
+
+/**
+ * getGroupCount 接口
+ * @param {*} params
+ * @param {*} group
+ */
+const getGroupCount = async function(params, group){
+ if(Object.keys(params).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ if(Object.keys(group).length === 0){
+ tlConsoleError(TableName, "请求dao参数有为空项")
+ return null
+ }
+
+ const count = await Table.count({
+ where : params,
+ attributes: [group],
+ group: group,
+ })
+
+ return count
+}
+
+
+module.exports = {
+ addInfo, addList,
+ getInfo, getList, getListForPage,
+ updateInfo,
+ deleteInfo,
+ getCount,
+ getGroupCount
+}
\ No newline at end of file
diff --git a/src/role/accountRole.js b/src/role/accountRole.js
index 026f78a..35b9dbc 100644
--- a/src/role/accountRole.js
+++ b/src/role/accountRole.js
@@ -5,6 +5,7 @@ const {
userPermission,
companyPermission,
configPermission,
+ cutPastePermission,
channelPerfix,
channelNoticePerfix,
@@ -67,6 +68,10 @@ const userNormalPermissions = function(){
Object.keys(configPermission).forEach((key) => {
returnPermission.push(...Object.values(configPermission[key]));
})
+ // 剪切板权限
+ Object.keys(cutPastePermission).forEach((key) => {
+ returnPermission.push(...Object.values(cutPastePermission[key]));
+ })
return returnPermission;
}
@@ -102,6 +107,10 @@ const userAdminPermissions = function(){
Object.keys(configPermission).forEach((key) => {
returnPermission.push(...Object.values(configPermission[key]));
})
+ // 剪切板权限
+ Object.keys(cutPastePermission).forEach((key) => {
+ returnPermission.push(...Object.values(cutPastePermission[key]));
+ })
return returnPermission;
}
diff --git a/src/role/permission.js b/src/role/permission.js
index 2b2435c..47dd9b0 100644
--- a/src/role/permission.js
+++ b/src/role/permission.js
@@ -11,6 +11,7 @@ const cloudPermissionIdBase = 200000
const companyPermissionIdBase = 300000
const userPermissionIdBase = 400000
const configPermissionIdBase = 500000
+const cutPastePermissionIdBase = 600000
// key前缀
const systemWebConfigPerfix = 'SYSTEM_WEB_CONFIG:'
@@ -37,6 +38,7 @@ const userLoginPerfix = 'USER_LOGIN:'
const userLogoutPerfix = 'USER_LOGOUT:'
const userClearPerfix = 'USER_CLEAR:'
const configSkinPerfix = 'CONFIG_SKIN:'
+const cutPastePerfix = 'CUT_PASTE:'
// 补充前缀
@@ -335,6 +337,33 @@ const configPermission = {
}
+// 剪切板权限 600000 - 699999
+const cutPastePermission = {
+ cutPaste: { // 600000 ~ 699999
+ // 添加剪切板
+ ADD_CUT_PASTE: cutPastePermissionIdBase + 1,
+ // 获取剪切板列表
+ GET_CUT_PASTE_LIST: cutPastePermissionIdBase + 2,
+ // 删除剪切板
+ DELETE_CUT_PASTE: cutPastePermissionIdBase + 3,
+ // 更新剪切板标题
+ UPDATE_CUT_PASTE_TITLE: cutPastePermissionIdBase + 4,
+ // 更新剪切板密码
+ UPDATE_CUT_PASTE_PASSWORD: cutPastePermissionIdBase + 5,
+ // 关闭剪切板
+ CLOSE_CUT_PASTE: cutPastePermissionIdBase + 6,
+ // 开启剪切板
+ OPEN_CUT_PASTE: cutPastePermissionIdBase + 7,
+ // 添加剪切板内容详情
+ ADD_CUT_PASTE_DETAIL: cutPastePermissionIdBase + 8,
+ // 获取剪切板内容详情列表
+ GET_CUT_PASTE_DETAIL_LIST: cutPastePermissionIdBase + 9,
+ // 删除剪切板内容详情
+ DELETE_CUT_PASTE_DETAIL: cutPastePermissionIdBase + 10,
+ }
+}
+
+
addPerfix(systemPermission.systemWebConfig, systemWebConfigPerfix)
addPerfix(systemPermission.systemWebCompany, systemWebCompanyPerfix)
addPerfix(systemPermission.systemWebUser, systemWebUserPerfix)
@@ -364,6 +393,8 @@ addPerfix(userPermission.userTag, userTagPerfix)
addPerfix(userPermission.userClear, userClearPerfix)
addPerfix(configPermission.skin, configSkinPerfix)
+addPerfix(cutPastePermission.cutPaste, cutPastePerfix)
+
module.exports = {
systemPermission,
@@ -372,6 +403,7 @@ module.exports = {
companyPermission,
userPermission,
configPermission,
+ cutPastePermission,
systemWebConfigPerfix,
systemWebCompanyPerfix,
@@ -395,4 +427,5 @@ module.exports = {
userLogoutPerfix,
userTagPerfix,
configSkinPerfix,
+ cutPastePerfix,
}
\ No newline at end of file
diff --git a/src/role/role.js b/src/role/role.js
index 0bdd802..005661c 100644
--- a/src/role/role.js
+++ b/src/role/role.js
@@ -5,6 +5,7 @@ const {
userPermission,
companyPermission,
configPermission,
+ cutPastePermission
} = require('./permission');
const {
@@ -57,7 +58,9 @@ const getAllPermissionsMap = function(){
returnPermissionMap = Object.assign(returnPermissionMap, userPermission.userClear)
// 配置权限
returnPermissionMap = Object.assign(returnPermissionMap, configPermission.skin)
-
+ // 剪切板权限
+ returnPermissionMap = Object.assign(returnPermissionMap, cutPastePermission.cutPaste)
+
return returnPermissionMap;
}
diff --git a/src/service/cut_paste/tl_cut_paste_detail_service.js b/src/service/cut_paste/tl_cut_paste_detail_service.js
new file mode 100644
index 0000000..ac1b72b
--- /dev/null
+++ b/src/service/cut_paste/tl_cut_paste_detail_service.js
@@ -0,0 +1,186 @@
+const { fields } = require('../../tables/tl_cut_paste_detail')
+const TlCutPasteDetailDao = require('../../dao/tl_cut_paste_detail_dao')
+const TlCutPasteDetailDef = fields.Def
+const TlCutPasteDetailType = fields.Type
+const TableName = fields.Name
+const TableFields = Object.keys(fields.Def).map(key => fields.Def[key])
+const { tlConsoleError, tlConsole } = require("../../../src/utils/utils");
+
+
+/**
+ * 创建剪贴板详情
+ * @param {*} data
+ */
+const addInfo = async function ({
+ code, cutPasteId, flag, content, type
+}) {
+ // 参数校验
+ if(!code){
+ tlConsoleError(TableName, "请求service参数code为空")
+ return {}
+ }
+
+ if(!cutPasteId){
+ tlConsoleError(TableName, "请求service参数cutPasteId为空")
+ return {}
+ }
+
+ if(!content){
+ tlConsoleError(TableName, "请求service参数content为空")
+ return {}
+ }
+
+ if(!type){
+ tlConsoleError(TableName, "请求service参数type为空")
+ return {}
+ }
+
+ if(flag === undefined || flag === null){
+ tlConsoleError(TableName, "请求service参数flag为空")
+ return {}
+ }
+
+ if(![
+ TlCutPasteDetailType.TEXT,
+ TlCutPasteDetailType.IMAGE,
+ TlCutPasteDetailType.FILE,
+ TlCutPasteDetailType.AUDIO,
+ TlCutPasteDetailType.VIDEO,
+ TlCutPasteDetailType.RICH_TEXT,
+ TlCutPasteDetailType.OTHER,
+ TlCutPasteDetailType.LINK
+ ].includes(type)){
+ tlConsoleError(TableName, "请求service参数type不合法")
+ return {}
+ }
+
+ const info = await TlCutPasteDetailDao.addInfo({
+ [TlCutPasteDetailDef.code]: code,
+ [TlCutPasteDetailDef.cutPasteId]: cutPasteId,
+ [TlCutPasteDetailDef.flag]: flag,
+ [TlCutPasteDetailDef.content]: content,
+ [TlCutPasteDetailDef.type]: type
+ });
+
+ if (info === null) {
+ tlConsoleError(TableName, "请求dao异常")
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 删除剪贴板详情
+ * @param {*} id
+ * @param {*} companyId
+ */
+const deleteInfoById = async function ({ id }) {
+ // 参数校验
+ if (!id) {
+ tlConsoleError(TableName, "请求service参数id为空")
+ return 0
+ }
+
+ const info = await TlCutPasteDetailDao.deleteInfo({
+ [TlCutPasteDetailDef.id]: id
+ });
+
+ if (info === null) {
+ tlConsoleError(TableName, "请求dao异常")
+ return 0
+ }
+
+ return info
+}
+
+/**
+ * 获取剪贴板详情内容
+ * @param {*} id
+ * @param {*} fields
+ */
+const getInfoById = async function ({ id }, fields) {
+ // 参数校验
+ if (!id) {
+ tlConsoleError(TableName, "请求service参数id为空")
+ return {}
+ }
+
+ const info = await TlCutPasteDetailDao.getInfo({
+ [TlCutPasteDetailDef.id]: id
+ }, fields)
+
+ if (info === null) {
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 获取某个剪贴板的剪贴板详情列表
+ * @param {*} typeList
+ * @param {*} cutPasteId
+ * @param {*} fields
+ */
+const getListByCutPasteIdAndTypeList = async function ({
+ cutPasteId, typeList
+}, fields) {
+ // 参数校验
+ if(!cutPasteId){
+ tlConsoleError(TableName, "请求service参数cutPasteId为空")
+ return []
+ }
+
+ let query = {
+ [TlCutPasteDetailDef.cutPasteId]: cutPasteId,
+ }
+
+ if(typeList && typeList.length > 0){
+ query[TlCutPasteDetailDef.type] = typeList
+ }
+
+ const infoList = await TlCutPasteDetailDao.getList(query, fields, [
+ [TlCutPasteDetailDef.createdAt, "DESC"]
+ ]);
+
+ if (infoList === null) {
+ return []
+ }
+
+ return infoList
+}
+
+/**
+ * 通过cutPasteIdList获取剪贴板详情数量
+ * @param {*} cutPasteIdList
+ * @param {*} companyId
+ */
+const getCountByCutPasteIdList = async function ({ cutPasteIdList }) {
+ // 参数校验
+ if(!cutPasteIdList){
+ tlConsoleError(TableName, "请求service参数cutPasteIdList为空")
+ return {}
+ }
+
+ const counts = await TlCutPasteDetailDao.getGroupCount({
+ [TlCutPasteDetailDef.cutPasteId]: cutPasteIdList
+ }, TlCutPasteDetailDef.cutPasteId);
+
+ if (counts === null) {
+ return {}
+ }
+
+ return counts
+}
+
+
+module.exports = {
+ addInfo,
+ deleteInfoById,
+ getInfoById,
+
+ getListByCutPasteIdAndTypeList,
+
+ getCountByCutPasteIdList
+}
\ No newline at end of file
diff --git a/src/service/cut_paste/tl_cut_paste_service.js b/src/service/cut_paste/tl_cut_paste_service.js
new file mode 100644
index 0000000..3b8db07
--- /dev/null
+++ b/src/service/cut_paste/tl_cut_paste_service.js
@@ -0,0 +1,373 @@
+const { fields } = require('../../tables/tl_cut_paste')
+const TlCutPasteDao = require('../../dao/tl_cut_paste_dao')
+const TlCutPasteDef = fields.Def
+const TlCutPasteStatus = fields.Status
+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')
+
+
+/**
+ * 创建剪贴板
+ * @param {*} data
+ */
+const addInfo = async function ({
+ companyId, userId, code, password, flag, title
+}) {
+ // 参数校验
+ if(!code){
+ tlConsoleError(TableName, "请求service参数code为空")
+ return {}
+ }
+
+ if(!companyId){
+ tlConsoleError(TableName, "请求service参数companyId为空")
+ return {}
+ }
+
+ if(!userId){
+ tlConsoleError(TableName, "请求service参数userId为空")
+ return {}
+ }
+
+ if(!title){
+ tlConsoleError(TableName, "请求service参数title为空")
+ return {}
+ }
+
+ if(flag === undefined || flag === null){
+ tlConsoleError(TableName, "请求service参数flag为空")
+ return {}
+ }
+
+ const info = await TlCutPasteDao.addInfo({
+ [TlCutPasteDef.companyId]: companyId,
+ [TlCutPasteDef.userId]: userId,
+ [TlCutPasteDef.code]: code,
+ [TlCutPasteDef.status]: TlCutPasteStatus.USEED,
+ [TlCutPasteDef.password]: password,
+ [TlCutPasteDef.flag]: flag,
+ [TlCutPasteDef.title]: title
+ });
+
+ if (info === null) {
+ tlConsoleError(TableName, "请求dao异常")
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 删除剪贴板
+ * @param {*} id
+ * @param {*} companyId
+ */
+const deleteInfoById = async function ({ companyId, id }) {
+ // 参数校验
+ if (!id) {
+ tlConsoleError(TableName, "请求service参数id为空")
+ return 0
+ }
+
+ if(!companyId){
+ tlConsoleError(TableName, "请求service参数companyId为空")
+ return 0
+ }
+
+ const info = await TlCutPasteDao.deleteInfo({
+ [TlCutPasteDef.companyId]: companyId,
+ [TlCutPasteDef.id]: id
+ });
+
+ if (info === null) {
+ tlConsoleError(TableName, "请求dao异常")
+ return 0
+ }
+
+ return info
+}
+
+/**
+ * 更新剪贴板
+ * @param {*} data
+ * @param {*} companyId
+ * @param {*} id
+ */
+const updateInfoById = async function ({ companyId, id }, data) {
+ // 参数校验
+ if (Object.keys(data).length === 0) {
+ tlConsoleError(TableName, "请求service参数为空")
+ return {}
+ }
+
+ if (!id) {
+ tlConsoleError(TableName, "请求service参数id为空")
+ return {}
+ }
+
+ if(!companyId){
+ tlConsoleError(TableName, "请求service参数companyId为空")
+ return {}
+ }
+
+ const info = await TlCutPasteDao.updateInfo({
+ [TlCutPasteDef.companyId]: companyId,
+ [TlCutPasteDef.id]: id
+ }, data);
+
+ if (info === null) {
+ tlConsoleError(TableName, "请求dao异常")
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 获取用户的剪贴板列表
+ * @param {*} companyId
+ * @param {*} userId
+ * @param {*} fields
+ */
+const getListByUserId = async function ({ companyId, userId }, fields) {
+ // 参数校验
+ if(!companyId){
+ tlConsoleError(TableName, "请求service参数companyId为空")
+ return []
+ }
+
+ if(!userId){
+ tlConsoleError(TableName, "请求service参数userId为空")
+ return []
+ }
+
+ const infoList = await TlCutPasteDao.getList({
+ [TlCutPasteDef.companyId]: companyId,
+ [TlCutPasteDef.userId]: userId
+ }, fields, [
+ [TlCutPasteDef.createdAt, "DESC"]
+ ]);
+
+ if (infoList === null) {
+ return []
+ }
+
+ return infoList
+}
+
+/**
+ * 获取剪贴板
+ * @param {*} companyId
+ * @param {*} code
+ * @param {*} fields
+ */
+const getInfoByCode = async function ({ code }, fields) {
+ // 参数校验
+ if(!code){
+ tlConsoleError(TableName, "请求service参数code为空")
+ return {}
+ }
+
+ const info = await TlCutPasteDao.getInfo({
+ [TlCutPasteDef.code]: code
+ }, fields);
+
+ if (info === null) {
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 获取剪贴板
+ * @param {*} companyId
+ * @param {*} id
+ * @param {*} fields
+ */
+const getInfoById = async function ({ companyId, id }, fields) {
+ // 参数校验
+ if (!id) {
+ tlConsoleError(TableName, "请求service参数id为空")
+ return {}
+ }
+
+ if(!companyId){
+ tlConsoleError(TableName, "请求service参数companyId为空")
+ return {}
+ }
+
+ const info = await TlCutPasteDao.getInfo({
+ [TlCutPasteDef.companyId]: companyId,
+ [TlCutPasteDef.id]: id
+ }, fields)
+
+ if (info === null) {
+ return {}
+ }
+
+ return info
+}
+
+/**
+ * 获取剪贴板列表
+ * @param {*} fields
+ * @param {*} page
+ * @param {*} pageSize
+ */
+const getListForPage = async function ({ }, fields, page, pageSize) {
+ // 参数校验
+ if(!page){
+ tlConsoleError(TableName, "请求service参数page为空")
+ return []
+ }
+
+ if(!pageSize){
+ tlConsoleError(TableName, "请求service参数pageSize为空")
+ return []
+ }
+
+ if(page <= 0){
+ tlConsoleError(TableName, "请求service参数page不合法")
+ return []
+ }
+
+ if(pageSize <= 0){
+ tlConsoleError(TableName, "请求service参数pageSize不合法")
+ return []
+ }
+
+ if(pageSize > 1000){
+ tlConsoleError(TableName, "请求service参数pageSize过大")
+ return []
+ }
+
+ const infoList = await TlCutPasteDao.getListForPage({
+ [TlCutPasteDef.id]: {
+ [Op.gte]: 0
+ }
+ }, fields, [
+ [TlCutPasteDef.createdAt, "DESC"]
+ ], page, pageSize);
+
+ if (infoList === null) {
+ return []
+ }
+
+ return infoList
+}
+
+
+/**
+ * 获取剪贴板列表
+ * @param {*} keyword
+ * @param {*} fields
+ * @param {*} page
+ * @param {*} pageSize
+ */
+const getListByKeywordForPage = async function ({ keyword }, fields, page, pageSize) {
+ // 参数校验
+ if(!keyword){
+ tlConsoleError(TableName, "请求service参数keyword为空")
+ return []
+ }
+
+ if(!page){
+ tlConsoleError(TableName, "请求service参数page为空")
+ return []
+ }
+
+ if(!pageSize){
+ tlConsoleError(TableName, "请求service参数pageSize为空")
+ return []
+ }
+
+ if(page <= 0){
+ tlConsoleError(TableName, "请求service参数page不合法")
+ return []
+ }
+
+ if(pageSize <= 0){
+ tlConsoleError(TableName, "请求service参数pageSize不合法")
+ return []
+ }
+
+ if(pageSize > 1000){
+ tlConsoleError(TableName, "请求service参数pageSize过大")
+ return []
+ }
+
+ const infoList = await TlCutPasteDao.getListForPage({
+ [TlCutPasteDef.title]: {
+ [Op.like]: `%${keyword}%`
+ }
+ }, fields, [
+ [TlCutPasteDef.createdAt, "DESC"]
+ ], page, pageSize);
+
+ if (infoList === null) {
+ return []
+ }
+
+ return infoList
+}
+
+
+/**
+ * 获取剪贴板数量
+ */
+const getCount = async function ({ }) {
+ // 参数校验
+ const count = await TlCutPasteDao.getCount({
+ [TlCutPasteDef.id]: {
+ [Op.gte]: 0
+ }
+ });
+
+ if (count === null) {
+ return 0
+ }
+
+ return count
+}
+
+/**
+ * 获取剪贴板数量
+ * @param {*} keyword
+ */
+const getCountByKeyword = async function ({ keyword }) {
+ // 参数校验
+ if(!keyword){
+ tlConsoleError(TableName, "请求service参数keyword为空")
+ return 0
+ }
+
+ const count = await TlCutPasteDao.getCount({
+ [TlCutPasteDef.title]: {
+ [Op.like]: `%${keyword}%`
+ }
+ });
+
+ if (count === null) {
+ return 0
+ }
+
+ return count
+}
+
+
+module.exports = {
+ addInfo,
+ deleteInfoById,
+ updateInfoById,
+ getInfoById,
+ getInfoByCode,
+
+ getListByUserId,
+ getListForPage,
+ getListByKeywordForPage,
+ getCount,
+ getCountByKeyword
+}
\ No newline at end of file
diff --git a/src/service/user/tl_user_config_service.js b/src/service/user/tl_user_config_service.js
index e1e4765..834e0b1 100644
--- a/src/service/user/tl_user_config_service.js
+++ b/src/service/user/tl_user_config_service.js
@@ -94,6 +94,7 @@ const addDefaultInfo = async function({companyId, userId}){
normal: JSON.stringify({
sidebarChannelOpen: true,
sidebarContactOpen: true,
+ sidebarCutPasteOpen: true,
sidebarSettingOpen: true,
homePage: 'channel',
}),
diff --git a/src/tables/tl_cut_paste.js b/src/tables/tl_cut_paste.js
new file mode 100644
index 0000000..ab783a3
--- /dev/null
+++ b/src/tables/tl_cut_paste.js
@@ -0,0 +1,98 @@
+const tl_cut_paste_fields = {
+ Name: 'tl_cut_paste',
+ Description: '剪贴板表',
+ Def: {
+ id : 'id',
+ companyId : 'company_id',
+ userId: 'user_id',
+ title: 'title',
+ code: 'code',
+ flag: 'flag',
+ status: 'status',
+ password: 'password',
+ createdAt : 'createdAt',
+ updatedAt : 'updatedAt',
+ deletedAt : 'deletedAt',
+ },
+ Flag: {
+ HAS_PASSWORD: 0x1, // 有密码
+ },
+ Status: {
+ USEED: 1, // 使用中
+ CLOSE: 2, // 关闭
+
+ toStr: function(status){
+ switch(status){
+ case this.USEED: return '使用中';
+ case this.CLOSE: return '关闭';
+ default: return '未知';
+ }
+ }
+ }
+}
+
+const tl_cut_paste_model = function(DataTypes){
+ return {
+ model : {
+ id: {
+ type: DataTypes.INTEGER,
+ comment: '剪贴板id',
+ primaryKey: true,
+ autoIncrement: true
+ },
+ company_id: {
+ type: DataTypes.INTEGER,
+ comment: '企业id'
+ },
+ user_id:{
+ type: DataTypes.INTEGER,
+ comment: '属于的用户id',
+ defaultValue: 0
+ },
+ title: {
+ type: DataTypes.STRING(32),
+ comment: '剪贴板标题'
+ },
+ code: {
+ type: DataTypes.STRING(32),
+ comment: '剪贴板码'
+ },
+ password: {
+ type: DataTypes.STRING(32),
+ comment: '剪贴板密码'
+ },
+ flag: {
+ type: DataTypes.INTEGER,
+ comment: '标志位',
+ defaultValue: 0,
+ },
+ status: {
+ type: DataTypes.INTEGER,
+ comment: '状态',
+ defaultValue: tl_cut_paste_fields.Status.USEED
+ },
+ },
+ options : {
+ timestamps: true,
+ comment: '剪贴板表',
+ indexes: [{
+ name: 'created_at_index',
+ method: 'BTREE',
+ fields: ['created_at']
+ }]
+ }
+ }
+}
+
+module.exports = {
+ model: function(sequelize, DataTypes){
+ return {
+ TlCutPaste: sequelize.define(
+ 'tl_cut_paste',
+ tl_cut_paste_model(DataTypes).model,
+ tl_cut_paste_model(DataTypes).options
+ )
+ }
+ },
+ fields: tl_cut_paste_fields
+}
\ No newline at end of file
diff --git a/src/tables/tl_cut_paste_detail.js b/src/tables/tl_cut_paste_detail.js
new file mode 100644
index 0000000..cfee0f6
--- /dev/null
+++ b/src/tables/tl_cut_paste_detail.js
@@ -0,0 +1,96 @@
+const tl_cut_paste_detail_fields = {
+ Name: 'tl_cut_paste_detail',
+ Description: '剪贴板详情表',
+ Def: {
+ id : 'id',
+ code: 'code',
+ cutPasteId: 'cut_paste_id',
+ flag: 'flag',
+ content: 'content',
+ type: 'type',
+ createdAt : 'createdAt',
+ updatedAt : 'updatedAt',
+ deletedAt : 'deletedAt',
+ },
+ Flag: {
+
+ },
+ Type: {
+ IMAGE: 'image', // 图片
+ AUDIO: 'audio', // 音频
+ VIDEO: 'video', // 视频
+ FILE: 'file', // 文档
+ TEXT: 'text', // 文本
+ RICH_TEXT: 'rich_text', // 富文本
+ LINK: 'link', // 链接
+ OTHER: 'other', // 其他
+
+ toStr: {
+ 'image': '图片',
+ 'audio': '音频',
+ 'video': '视频',
+ 'file': '文档',
+ 'text': '文本',
+ 'rich_text': '富文本',
+ 'link': '链接',
+ 'other': '其他',
+ }
+ }
+}
+
+const tl_cut_paste_detail_model = function(DataTypes){
+ return {
+ model : {
+ id: {
+ type: DataTypes.INTEGER,
+ comment: '剪贴板详情id',
+ primaryKey: true,
+ autoIncrement: true
+ },
+ code: {
+ type: DataTypes.STRING(32),
+ comment: '剪贴板码'
+ },
+ cut_paste_id: {
+ type: DataTypes.INTEGER,
+ comment: '剪贴板id'
+ },
+ type: {
+ type: DataTypes.STRING(32),
+ comment: '类型',
+ defaultValue: tl_cut_paste_detail_fields.Type.TEXT
+ },
+ flag: {
+ type: DataTypes.INTEGER,
+ comment: '标志位',
+ defaultValue: 0,
+ },
+ content: {
+ type: DataTypes.TEXT,
+ comment: '剪贴板内容'
+ },
+ },
+ options : {
+ timestamps: true,
+ comment: '剪贴板详情记录表',
+ indexes: [{
+ name: 'created_at_index',
+ method: 'BTREE',
+ fields: ['created_at']
+ }]
+ }
+ }
+}
+
+module.exports = {
+ model: function(sequelize, DataTypes){
+ return {
+ TlCutPasteDetail: sequelize.define(
+ 'tl_cut_paste_detail',
+ tl_cut_paste_detail_model(DataTypes).model,
+ tl_cut_paste_detail_model(DataTypes).options
+ )
+ }
+ },
+ fields: tl_cut_paste_detail_fields
+}
\ No newline at end of file
diff --git a/src/tables/tl_user_config.js b/src/tables/tl_user_config.js
index 347878e..8547e67 100644
--- a/src/tables/tl_user_config.js
+++ b/src/tables/tl_user_config.js
@@ -28,6 +28,8 @@ const tl_user_config_fields = {
sidebarChannelOpen: 'sidebarChannelOpen',
// 侧边栏-联系人
sidebarContactOpen: 'sidebarContactOpen',
+ // 侧边栏-剪贴板
+ sidebarCutPasteOpen: 'sidebarCutPasteOpen',
// 侧边栏-设置
sidebarSettingOpen: 'sidebarSettingOpen',
// 首页
diff --git a/tlrtcapp.env b/tlrtcapp.env
index 6409527..069baf7 100644
--- a/tlrtcapp.env
+++ b/tlrtcapp.env
@@ -1,5 +1,5 @@
#-----------------以下为基础配置-----------------#
-tl_rtc_app_version=0.0.2
+tl_rtc_app_version=0.0.3
## 后台管理端口
tl_rtc_app_super_api_port=9098
## api服务端口
diff --git a/web-res/css/cut-paste/cut-paste-detail.css b/web-res/css/cut-paste/cut-paste-detail.css
new file mode 100644
index 0000000..78cdd32
--- /dev/null
+++ b/web-res/css/cut-paste/cut-paste-detail.css
@@ -0,0 +1,230 @@
+/***********************************************************************************
+************************************************************************************
+ 剪贴板详情 start
+************************************************************************************
+************************************************************************************/
+.tl-rtc-app-right-cut-paste-content{
+ height: 100%;
+ width: 100%;
+}
+
+.tl-rtc-app-layer-cut-paste-share{
+ background: var(--skin-body-background) !important;
+ color: var(--skin-body-color) !important;
+}
+
+.tl-rtc-app-layer-cut-paste-share .layui-layer-title{
+ background: var(--skin-body-background) !important;
+ color: var(--skin-body-color) !important;
+ border-radius: 6px;
+}
+
+.tl-rtc-app-right-cut-paste-content-top{
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: center;
+ border-bottom: 1px solid var(--skin-body-border-color);
+ padding: 5px 10px 5px 10px;
+ height: 40px;
+}
+
+.tl-rtc-app-right-cut-paste-content-top-title{
+ font-size: 15px;
+ font-weight: 700;
+ user-select: none;
+ width: 40%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ white-space: nowrap;
+}
+
+.tl-rtc-app-right-cut-paste-content-top-tool{
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: flex-end;
+ font-size: 12px;
+ width: 60%;
+ align-items: center;
+}
+
+.tl-rtc-app-right-cut-paste-content-top-tool-item{
+ padding: 2px 5px;
+ cursor: pointer;
+ transition: all 0.2s;
+ border-radius: 4px;
+ user-select: none;
+ margin-left: 6px;
+ border: 0.5px solid var(--skin-body-border-color);
+
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ align-items: center;
+}
+
+.tl-rtc-app-right-cut-paste-content-top-tool-item svg{
+ width: 18px;
+ height: 18px;
+}
+
+.tl-rtc-app-right-cut-paste-content-body{
+ width: calc(100% - 10px);
+ height: calc(100% - 56px);
+ padding: 0px 5px 5px 5px;
+ overflow: auto;
+}
+
+.tl-rtc-app-right-cut-paste-content-title{
+ line-height: 40px;
+ font-weight: 700;
+ user-select: none;
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ margin-top: 10px;
+ color: #a2a8ac;
+}
+
+.tl-rtc-app-right-cut-paste-content-time{
+ color: #9ba8a4;
+ font-size: 12px;
+ margin-left: 20px;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-textarea{
+ width: calc(100% - 32.5px);
+ height: calc(100% - 61.5px);
+ padding: 5px 15px;
+ border: unset;
+ border-radius: 4px;
+ background: var(--skin-body-background);
+ color: var(--skin-body-color);
+ font-size: 14px;
+ resize: none;
+ letter-spacing: 0.5px;
+ overflow: auto;
+ outline: unset;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-textarea-view{
+ width: calc(100% - 32.5px);
+ padding: 15px;
+ margin: 10px 0;
+ font-size: 14px;
+ resize: none;
+ letter-spacing: .5px;
+ overflow: hidden;
+ word-break: break-all;
+
+ border: 1px solid var(--skin-body-border-color);
+ background: var(--skin-meeting-content-history-item-background);
+ border-radius: 2px;
+ color: var(--skin-body-color);
+}
+
+.tl-rtc-app-right-cut-paste-content-body-time{
+ font-weight: bold;
+ margin-bottom: 5px;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-time svg{
+ margin-left: 5px;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-title{
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-info{
+ padding: 5px 0;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: center;
+ align-items: center;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-info svg{
+ width: 20px;
+ height: 20px;
+ padding-left: 5px;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-tools svg{
+ margin-right: 5px;
+ cursor: pointer;
+ transition: all 0.2s;
+ scale: 1.1;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-tools svg:hover{
+ scale: 1.2;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-detail{
+ padding: 5px 0;
+ cursor: pointer;
+}
+
+.tl-rtc-app-right-cut-paste-content-body-no-history{
+ text-align: center;
+ margin-top: 50px;
+ font-size: 16px;
+ color: #c1bac7;
+}
+
+
+.tl-rtc-app-layer-cut-paste-share{
+ background: var(--skin-body-background) !important;
+ color: var(--skin-body-color) !important;
+}
+
+
+.tl-rtc-app-layer-cut-paste-share .layui-layer-title{
+ color: var(--skin-body-color) !important;
+ border-color: var(--skin-body-border-color) !important;
+ border-radius: 6px;
+}
+
+.tl-rtc-app-layer-cut-paste-share #tl-rtc-app-cut-paste-share-image{
+ text-align: center;
+ user-select: none;
+}
+
+.tl-rtc-app-layer-cut-paste-share #tl-rtc-app-cut-paste-share-image img{
+ width: 70%;
+ height: 70%;
+ margin-left: 15%;
+ margin-top: 7%;
+ -webkit-user-drag: none;
+}
+
+.tl-rtc-app-layer-cut-paste-share .tl-rtc-app-cut-paste-share-tools{
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ margin-top: 8%;
+}
+
+.tl-rtc-app-layer-cut-paste-share .tl-rtc-app-cut-paste-share-tools-item{
+ padding: 5px 10px;
+ border-radius: 4px;
+ cursor: pointer;
+ transition: all 0.2s;
+ margin: 0 10px;
+ border: 1px solid var(--skin-body-border-color);
+}
+/***********************************************************************************
+************************************************************************************
+ 剪贴板详情 end
+************************************************************************************
+************************************************************************************/
\ No newline at end of file
diff --git a/web-res/css/cut-paste/cut-paste-list.css b/web-res/css/cut-paste/cut-paste-list.css
new file mode 100644
index 0000000..b337a80
--- /dev/null
+++ b/web-res/css/cut-paste/cut-paste-list.css
@@ -0,0 +1,239 @@
+
+/***********************************************************************************
+************************************************************************************
+ 剪贴板列表 start
+************************************************************************************
+************************************************************************************/
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste .tl-rtc-app-left-panel-no-cut-paste{
+ text-align: center;
+ line-height: 70px;
+ font-size: 14px;
+ font-weight: bold;
+ color: var(--skin-body-color); /** TODO **/
+}
+
+.tl-rtc-app-left-panel-no-cut-paste button{
+ color: var(--skin-body-color); /** TODO **/
+}
+
+.tl-rtc-app-left-panel-no-cut-paste button:hover{
+ color: var(--skin-body-color); /** TODO **/
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top{
+ height: var(--left-cut-paste-top);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header{
+ display: flex;
+ padding: 15px 10px 15px 0px;
+ flex-direction: row;
+ justify-content: space-between;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header-title{
+ font-size: 16px;
+ font-weight: bold;
+ color: var(--skin-top-header-title-color);
+ margin-right: 10px;
+ margin-left: 20px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ white-space: nowrap;
+ width: 70%;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header-tool{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ cursor: pointer;
+ transition: all 0.3s;
+ background: var(--skin-top-header-tool-background);
+ padding: 2px 5px;
+ border-radius: 4px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header-tool svg{
+ width: 14px;
+ height: 14px;
+ fill: #959595;
+ transition: all 0.3s;
+ scale: 1.5;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header-tool:hover{
+ box-shadow: 0 4px 40px #00000026;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-header-tool:hover svg{
+ fill: #333333;
+ scale: 1.7;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-search{
+ padding: 5px 0;
+ line-height: 0px;
+ width: 96%;
+ margin-left: 2%;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-search i{
+ position: relative;
+ margin-left: 8px;
+ top: 16px;
+ color: var(--skin-cut-paste-top-search-i-color);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-search svg{
+ color: var(--skin-cut-paste-top-search-i-color);
+ position: relative;
+ float: right;
+ right: 8px;
+ margin-top: -22px;
+ cursor: pointer;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-top-search input{
+ width: 100%;
+ height: 30px;
+ padding-left: 30px !important;
+ border-radius: 4px;
+ background: var(--skin-cut-paste-top-search-input-background);
+ color: var(--skin-cut-paste-top-search-input-color);
+ font-size: 13px;
+ letter-spacing: 1px;
+ border-width: 0.5px;
+ border-color: var(--skin-cut-paste-top-search-input-background);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste{
+ height: calc(100% - var(--left-cut-paste-top));
+}
+
+#tl-rtc-app .tl-rtc-app-left #cutPasteListSwiper{
+ height: calc(100% - 180px);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item{
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ border-radius: 2px;
+ transition: all 0.1s;
+}
+
+.tl-rtc-app-left-panel-cut-paste-item-actions{
+ display: flex;
+ position: absolute;
+ right: 10px;
+ top: 50%;
+ transform: translateY(-50%);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item:hover{
+ background: var(--skin-cut-paste-list-item-hover-background);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-active{
+ background: var(--skin-cut-paste-list-item-hover-background);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-top{
+ background: var(--skin-cut-paste-list-item-top-background);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-img{
+ width: 64px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-img img{
+ height: 32px;
+ width: 32px;
+ margin: 25% 20%;
+ -webkit-user-drag: none;
+ border-radius: 3px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content{
+ width: calc(100% - 64px);
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content div{
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ white-space: nowrap;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content-nickname{
+ font-weight: bold;
+ font-size: 13px;
+ margin-top: 5px;
+ letter-spacing: 0.5px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content-message{
+ font-size: 12px;
+ margin-top: 10px;
+ color: var(--skin-cut-paste-list-item-time-color);
+ letter-spacing: 0.5px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content-message svg{
+ height: 15px;
+ width: 14px;
+ margin-right: 3px;
+ margin-left: -4px;
+ fill: #6bd16b;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content-message
+.tl-rtc-app-left-panel-cut-paste-item-content-message-file{
+ display: flex;
+ align-items: center;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-content-message img{
+ width: 24px !important;
+ height: 24px !important;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-other{
+ width: 25%;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-other div{
+ text-align: right;
+ font-size: 12px;
+ scale: 0.9;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-other-time{
+ margin-top: 10px;
+ color: #b8b8b8;
+ padding-right: 8px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-other-unread{
+ margin-top: 10px;
+ padding-right: 8px;
+}
+
+#tl-rtc-app .tl-rtc-app-left .tl-rtc-app-left-panel-cut-paste-item-other-unread div{
+ width: 10px !important;
+ line-height: 16px !important;
+ height: 16px !important;
+ border-radius: 12px;
+ padding-left: 2px;
+ padding-right: 5px;
+}
+/***********************************************************************************
+************************************************************************************
+ 剪贴板列表 end
+************************************************************************************
+************************************************************************************/
diff --git a/web-res/css/mobile.css b/web-res/css/mobile.css
index 9b77f9f..a52f976 100644
--- a/web-res/css/mobile.css
+++ b/web-res/css/mobile.css
@@ -254,6 +254,11 @@
.tl-rtc-app-right-channel-content-body-reply-content-block{
width: calc(100% - 20px) !important;
}
+
+ .tl-rtc-app-right-cut-paste-content-top-title
+ {
+ margin-left: 30px;
+ }
/***********************************************************************************
************************************************************************************
主界面布局 end
diff --git a/web-res/css/pc.css b/web-res/css/pc.css
index 519143c..afb7261 100644
--- a/web-res/css/pc.css
+++ b/web-res/css/pc.css
@@ -8,7 +8,6 @@ html {
--sidebar-width: 65px;
--left-width: 315px;
--left-channel-top: 130px;
- --left-p2p-channel-top: 90px;
--left-contact-top: 100px;
--left-cut-paste-top: 90px;
--left-login-top: 30px;
@@ -217,6 +216,16 @@ html {
--skin-face-search-input-background: #F8F9FB;
--skin-face-search-input-color: #3333339e;
--skin-face-content-title-color: #999;
+
+ /* 剪贴板相关配色 */
+ --skin-cut-paste-top-search-i-color: #c8c8c8;
+ --skin-cut-paste-top-search-input-background: #F8F9FB;
+ --skin-cut-paste-top-search-input-color: #3333339e;
+ --skin-cut-paste-list-item-hover-background: #d2deff96;
+ --skin-cut-paste-list-item-top-background: #e5ebfc96;
+ --skin-cut-paste-list-item-message-color: #777777;
+ --skin-cut-paste-list-item-time-color: #b8b8b8;
+
}
diff --git a/web-res/cut-paste.html b/web-res/cut-paste.html
new file mode 100644
index 0000000..0994ab4
--- /dev/null
+++ b/web-res/cut-paste.html
@@ -0,0 +1,557 @@
+
+
+
+
+
+
+
+ ++ +