mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 12:02:51 +00:00
fix:1. 修改消息时@成员不会拉进群 2. @的时候,会话以外成员排序更改为前5名为最近联系的人 3. 审批中心时间后面加周几 4.审批拒绝不能输入表情的bug修复
This commit is contained in:
parent
5b1fc8af84
commit
9944dc4693
@ -29,7 +29,7 @@ class ApproveController extends AbstractController
|
||||
private $flow_url = '';
|
||||
public function __construct()
|
||||
{
|
||||
$this->flow_url = env('FLOW_URL') ?: 'http://dootask-approve-'.env('APP_ID');
|
||||
$this->flow_url = env('FLOW_URL') ?: 'http://approve';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,6 +74,7 @@ class ApproveController extends AbstractController
|
||||
$ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/procdef/findAll', json_encode($data));
|
||||
$procdef = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true);
|
||||
if (!$procdef || $procdef['status'] != 200 || $ret['ret'] == 0) {
|
||||
info($ret);
|
||||
return Base::retError($procdef['message'] ?? '查询失败');
|
||||
}
|
||||
return Base::retSuccess('success', Base::arrayKeyToUnderline($procdef['data']));
|
||||
|
||||
@ -849,6 +849,8 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
$dialogMsg->updateInstance($updateData);
|
||||
$dialogMsg->key = $dialogMsg->generateMsgKey();
|
||||
$dialogMsg->save();
|
||||
//
|
||||
$dialogMsg->msgJoinGroup($dialog, $dialogMsg);
|
||||
//
|
||||
$dialog->pushMsg('update', array_merge($updateData, [
|
||||
'id' => $dialogMsg->id
|
||||
@ -896,4 +898,41 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
return Base::retSuccess('发送成功', $dialogMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将被@的人加入群
|
||||
* @param $dialogMsg 发送的消息
|
||||
* @param $dialog 对话
|
||||
* @return array
|
||||
*/
|
||||
public static function msgJoinGroup($dialog, $dialogMsg)
|
||||
{
|
||||
$updateds = [];
|
||||
$silences = [];
|
||||
foreach ($dialog->dialogUser as $dialogUser) {
|
||||
$updateds[$dialogUser->userid] = $dialogUser->updated_at;
|
||||
$silences[$dialogUser->userid] = $dialogUser->silence;
|
||||
}
|
||||
$userids = array_keys($silences);
|
||||
// 提及会员
|
||||
$mentions = [];
|
||||
if ($dialogMsg->type === 'text') {
|
||||
preg_match_all("/<span class=\"mention user\" data-id=\"(\d+)\">/", $dialogMsg->msg['text'], $matchs);
|
||||
if ($matchs) {
|
||||
$mentions = array_values(array_filter(array_unique($matchs[1])));
|
||||
}
|
||||
}
|
||||
// 将会话以外的成员加入会话内
|
||||
$diffids = array_values(array_diff($mentions, $userids));
|
||||
if ($diffids) {
|
||||
// 仅(群聊)且(是群主或没有群主)才可以@成员以外的人
|
||||
if ($dialog->type === 'group' && in_array($dialog->owner_id, [0, $dialogMsg->userid])) {
|
||||
$dialog->joinGroup($diffids, $dialogMsg->userid);
|
||||
$dialog->pushMsg("groupJoin", null, $diffids);
|
||||
$userids = array_values(array_unique(array_merge($mentions, $userids)));
|
||||
}
|
||||
}
|
||||
|
||||
return compact('updateds', 'silences', 'userids', 'mentions');
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,33 +91,13 @@ class WebSocketDialogMsgTask extends AbstractTask
|
||||
if (empty($dialog)) {
|
||||
return;
|
||||
}
|
||||
$updateds = [];
|
||||
$silences = [];
|
||||
foreach ($dialog->dialogUser as $dialogUser) {
|
||||
$updateds[$dialogUser->userid] = $dialogUser->updated_at;
|
||||
$silences[$dialogUser->userid] = $dialogUser->silence;
|
||||
}
|
||||
$userids = array_keys($silences);
|
||||
|
||||
// 提及会员
|
||||
$mentions = [];
|
||||
if ($msg->type === 'text') {
|
||||
preg_match_all("/<span class=\"mention user\" data-id=\"(\d+)\">/", $msg->msg['text'], $matchs);
|
||||
if ($matchs) {
|
||||
$mentions = array_values(array_filter(array_unique($matchs[1])));
|
||||
}
|
||||
}
|
||||
|
||||
// 将会话以外的成员加入会话内
|
||||
$diffids = array_values(array_diff($mentions, $userids));
|
||||
if ($diffids) {
|
||||
// 仅(群聊)且(是群主或没有群主)才可以@成员以外的人
|
||||
if ($dialog->type === 'group' && in_array($dialog->owner_id, [0, $msg->userid])) {
|
||||
$dialog->joinGroup($diffids, $msg->userid);
|
||||
$dialog->pushMsg("groupJoin", null, $diffids);
|
||||
$userids = array_values(array_unique(array_merge($mentions, $userids)));
|
||||
}
|
||||
}
|
||||
$msgJoinGroupResult = $msg->msgJoinGroup($dialog, $msg);
|
||||
$updateds = $msgJoinGroupResult['updateds'];
|
||||
$silences = $msgJoinGroupResult['silences'];
|
||||
$userids = $msgJoinGroupResult['userids'];
|
||||
$mentions = $msgJoinGroupResult['mentions'];
|
||||
|
||||
// 推送目标①:会话成员/群成员
|
||||
$array = [];
|
||||
|
||||
@ -149,7 +149,7 @@ services:
|
||||
|
||||
approve:
|
||||
container_name: "dootask-approve-${APP_ID}"
|
||||
image: "hitosea2020/go-approve:0.1.3"
|
||||
image: "hitosea2020/go-approve:0.1.4"
|
||||
environment:
|
||||
TZ: "${TIMEZONE:-PRC}"
|
||||
MYSQL_HOST: "${DB_HOST}"
|
||||
|
||||
@ -20,11 +20,17 @@
|
||||
</div>
|
||||
<div class="approve-details-text">
|
||||
<h4>{{$L('开始时间')}}</h4>
|
||||
<p>{{datas.var?.start_time}}</p>
|
||||
<div>
|
||||
<span>{{datas.var?.start_time}}</span>
|
||||
<span> ({{getWeekday(datas.var?.start_time)}})</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="approve-details-text">
|
||||
<h4>{{$L('结束时间')}}</h4>
|
||||
<p>{{datas.var?.end_time}}</p>
|
||||
<div>
|
||||
<span>{{datas.var?.end_time}}</span>
|
||||
<span> ({{getWeekday(datas.var?.end_time)}})</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="approve-details-text">
|
||||
<h4>{{ $L('时长') }}({{getTimeDifference(datas.var?.start_time,datas.var?.end_time)['unit']}})</h4>
|
||||
@ -273,6 +279,10 @@ export default {
|
||||
return type == 2 ? `${days+1}${this.$L('天')}` : `${days+1} ${this.$L('天')}`;
|
||||
}
|
||||
},
|
||||
// 时间转为周几
|
||||
getWeekday(dateString) {
|
||||
return ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][new Date(dateString).getDay()];
|
||||
},
|
||||
// 获取时间差
|
||||
getTimeDifference(startTime,endTime) {
|
||||
const currentTime = new Date((endTime + '').replace(/-/g,"/"));
|
||||
|
||||
@ -1297,6 +1297,20 @@ export default {
|
||||
this.mentionMode = "user-mention";
|
||||
const atCallback = (list) => {
|
||||
this.getMoreUser(searchTerm, list.map(item => item.id)).then(moreUser => {
|
||||
// 会话以外成员 排序 -> 前5名为最近联系的人
|
||||
let cacheDialogs = this.cacheDialogs.filter((h, index) => h.type == "user" && h.bot == 0 && h.last_at)
|
||||
cacheDialogs.sort((a, b) => a.last_at > b.last_at ? -1 : (a.last_at < b.last_at ? 1 : 0));
|
||||
cacheDialogs = cacheDialogs.filter((h, index) => index < 5)
|
||||
moreUser.forEach(user => {
|
||||
user.last_at = "1990-01-01 00:00:00";
|
||||
cacheDialogs.forEach(dialog => {
|
||||
if (dialog.dialog_user?.userid == user.id) {
|
||||
user.last_at = dialog.last_at;
|
||||
}
|
||||
})
|
||||
})
|
||||
moreUser.sort((a, b) => a.last_at > b.last_at ? -1 : (a.last_at < b.last_at ? 1 : 0));
|
||||
//
|
||||
this.userList = list
|
||||
this.userCache = [];
|
||||
if (moreUser.length > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user