Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	public/js/app.js
#	public/js/build/423.js
#	public/js/build/726.js
#	public/js/build/93.js
This commit is contained in:
韦荣超 2022-02-15 09:05:20 +08:00
commit 54dd90fc4a
19 changed files with 87 additions and 57 deletions

View File

@ -189,7 +189,7 @@ class DialogController extends AbstractController
} }
/** /**
* @api {get} api/dialog/msg/sendtext 06. 发送消息 * @api {post} api/dialog/msg/sendtext 06. 发送消息
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -205,6 +205,7 @@ class DialogController extends AbstractController
*/ */
public function msg__sendtext() public function msg__sendtext()
{ {
Base::checkClientVersion('0.8.1');
$user = User::auth(); $user = User::auth();
// //
$chat_nickname = Base::settingFind('system', 'chat_nickname'); $chat_nickname = Base::settingFind('system', 'chat_nickname');
@ -215,8 +216,8 @@ class DialogController extends AbstractController
} }
} }
// //
$dialog_id = intval(Request::input('dialog_id')); $dialog_id = Base::getPostInt('dialog_id');
$text = trim(Request::input('text')); $text = trim(Base::getPostValue('text'));
// //
if (mb_strlen($text) < 1) { if (mb_strlen($text) < 1) {
return Base::retError('消息内容不能为空'); return Base::retError('消息内容不能为空');
@ -226,11 +227,21 @@ class DialogController extends AbstractController
// //
WebSocketDialog::checkDialog($dialog_id); WebSocketDialog::checkDialog($dialog_id);
// //
$msg = [ if (mb_strlen($text) > 2000) {
'text' => $text $array = mb_str_split($text, 2000);
]; } else {
$array = [$text];
}
// //
return WebSocketDialogMsg::sendMsg($dialog_id, 'text', $msg, $user->userid); $list = [];
foreach ($array as $item) {
$res = WebSocketDialogMsg::sendMsg($dialog_id, 'text', ['text' => $item], $user->userid);
if (Base::isSuccess($res)) {
$list[] = $res['data'];
}
}
//
return Base::retSuccess('发送成功', $list);
} }
/** /**

View File

@ -150,7 +150,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {post} api/system/column/template 03. 创建项目模板 * @api {post} api/system/column/template 04. 创建项目模板
* *
* @apiDescription 获取创建项目模板、保存创建项目模板 * @apiDescription 获取创建项目模板、保存创建项目模板
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -197,7 +197,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/info 04. 获取终端详细信息 * @api {get} api/system/get/info 05. 获取终端详细信息
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup system * @apiGroup system
@ -226,7 +226,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/ip 05. 获取IP地址 * @api {get} api/system/get/ip 06. 获取IP地址
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup system * @apiGroup system
@ -241,7 +241,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/cnip 06. 是否中国IP地址 * @api {get} api/system/get/cnip 07. 是否中国IP地址
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup system * @apiGroup system
@ -258,7 +258,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/ipgcj02 07. 获取IP地址经纬度 * @api {get} api/system/get/ipgcj02 08. 获取IP地址经纬度
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup system * @apiGroup system
@ -275,7 +275,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/ipinfo 08. 获取IP地址详细信息 * @api {get} api/system/get/ipinfo 09. 获取IP地址详细信息
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup system * @apiGroup system
@ -292,7 +292,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {post} api/system/imgupload 09. 上传图片 * @api {post} api/system/imgupload 10. 上传图片
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -342,7 +342,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {get} api/system/get/imgview 10. 浏览图片空间 * @api {get} api/system/get/imgview 11. 浏览图片空间
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -438,7 +438,7 @@ class SystemController extends AbstractController
} }
/** /**
* @api {post} api/system/fileupload 11. 上传文件 * @api {post} api/system/fileupload 12. 上传文件
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0

View File

@ -33,6 +33,9 @@ class VerifyCsrfToken extends Middleware
// 修改任务 // 修改任务
'api/project/task/update/', 'api/project/task/update/',
// 聊天发文本
'api/dialog/msg/sendtext/',
// 聊天发文件 // 聊天发文件
'api/dialog/msg/sendfile/', 'api/dialog/msg/sendfile/',

View File

@ -508,9 +508,7 @@ class ProjectTask extends AbstractModel
{ {
AbstractModel::transaction(function () use ($data, &$updateMarking) { AbstractModel::transaction(function () use ($data, &$updateMarking) {
// 判断版本 // 判断版本
if (version_compare(Base::getClientVersion(), '0.6.0', '<')) { Base::checkClientVersion('0.6.0');
throw new ApiException('当前版本过低');
}
// 主任务 // 主任务
$mainTask = $this->parent_id > 0 ? self::find($this->parent_id) : null; $mainTask = $this->parent_id > 0 ? self::find($this->parent_id) : null;
// 工作流 // 工作流

View File

@ -2,6 +2,7 @@
namespace App\Module; namespace App\Module;
use App\Exceptions\ApiException;
use App\Models\Setting; use App\Models\Setting;
use App\Models\Tmp; use App\Models\Tmp;
use Cache; use Cache;
@ -87,6 +88,18 @@ class Base
return $_A["__static_client_version"]; return $_A["__static_client_version"];
} }
/**
* 检查客户端版本
* @param string $min 最小版本
* @return void
*/
public static function checkClientVersion($min)
{
if (version_compare(Base::getClientVersion(), $min, '<')) {
throw new ApiException('当前版本 (v' . Base::getClientVersion() . ') 过低');
}
}
/** /**
* 判断是否域名格式 * 判断是否域名格式
* @param $domain * @param $domain

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.8.0", "version": "0.8.2",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"main": "main.js", "main": "main.js",
"license": "MIT", "license": "MIT",

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.8.0", "version": "0.8.2",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"scripts": { "scripts": {
"start": "./cmd dev", "start": "./cmd dev",

File diff suppressed because one or more lines are too long

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* html2canvas 1.4.0 <https://html2canvas.hertzen.com> * html2canvas 1.3.4 <https://html2canvas.hertzen.com>
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com> * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License * Released under MIT License
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
{ {
"/js/app.js": "/js/app.js", "/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css", "/css/app.css": "/css/app.css",
"/.DS_Store": "/.DS_Store",
"/favicon.ico": "/favicon.ico" "/favicon.ico": "/favicon.ico"
} }

View File

@ -69,7 +69,7 @@
type="textarea" type="textarea"
:rows="1" :rows="1"
:autosize="{ minRows: 1, maxRows: 3 }" :autosize="{ minRows: 1, maxRows: 3 }"
:maxlength="255" :maxlength="20000"
@on-focus="onEventFocus" @on-focus="onEventFocus"
@on-blur="onEventblur" @on-blur="onEventblur"
@on-keydown="chatKeydown" @on-keydown="chatKeydown"
@ -280,6 +280,7 @@ export default {
dialog_id: this.dialogId, dialog_id: this.dialogId,
text: this.msgText, text: this.msgText,
}, },
method: 'post'
}).then(({data}) => { }).then(({data}) => {
this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId) this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
this.sendSuccess(data); this.sendSuccess(data);
@ -387,6 +388,12 @@ export default {
}, },
sendSuccess(data) { sendSuccess(data) {
if ($A.isArray(data)) {
data.some(item => {
this.sendSuccess(item)
})
return;
}
this.$store.dispatch("saveDialogMsg", data); this.$store.dispatch("saveDialogMsg", data);
this.$store.dispatch("increaseTaskMsgNum", this.dialogId); this.$store.dispatch("increaseTaskMsgNum", this.dialogId);
this.$store.dispatch("updateDialogLastMsg", data); this.$store.dispatch("updateDialogLastMsg", data);

View File

@ -393,7 +393,7 @@
:disabled="sendLoad > 0" :disabled="sendLoad > 0"
:rows="1" :rows="1"
:autosize="{ minRows: 1, maxRows: 3 }" :autosize="{ minRows: 1, maxRows: 3 }"
:maxlength="255" :maxlength="20000"
:placeholder="$L('输入消息...')" :placeholder="$L('输入消息...')"
@on-keydown="msgKeydown" @on-keydown="msgKeydown"
@on-input-paste="msgPasteDrag"/> @on-input-paste="msgPasteDrag"/>