mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 12:42:51 +00:00
no message
This commit is contained in:
parent
5660be12f6
commit
2ebaeb3453
@ -113,8 +113,11 @@ class ComplaintController extends AbstractController
|
|||||||
->each(function ($adminUser) use ($reason, $botUser) {
|
->each(function ($adminUser) use ($reason, $botUser) {
|
||||||
$dialog = WebSocketDialog::checkUserDialog($botUser, $adminUser->userid);
|
$dialog = WebSocketDialog::checkUserDialog($botUser, $adminUser->userid);
|
||||||
if ($dialog) {
|
if ($dialog) {
|
||||||
$text = "<p>收到新的举报信息:{$reason} (请前往应用查看详情)</p>";
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid); // todo 未能在任务end事件来发送任务
|
'type' => 'content',
|
||||||
|
'title' => '收到新的举报信息',
|
||||||
|
'content' => "收到新的举报信息:{$reason} (请前往应用查看详情)"
|
||||||
|
], $botUser->userid); // todo 未能在任务end事件来发送任务
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
|
|||||||
@ -1324,7 +1324,10 @@ class DialogController extends AbstractController
|
|||||||
if (empty($dialog)) {
|
if (empty($dialog)) {
|
||||||
return Base::retError('匿名机器人会话不存在');
|
return Base::retError('匿名机器人会话不存在');
|
||||||
}
|
}
|
||||||
return WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "<p>{$text}</p>"], $botUser->userid, true);
|
return WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
|
'type' => 'content',
|
||||||
|
'content' => $text,
|
||||||
|
], $botUser->userid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1229,8 +1229,11 @@ class ProjectController extends AbstractController
|
|||||||
$headings[] = '状态';
|
$headings[] = '状态';
|
||||||
$datas = [];
|
$datas = [];
|
||||||
//
|
//
|
||||||
$text = '<b>导出任务统计已完成。</b>';
|
$content = [];
|
||||||
$text .= "\n\n";
|
$content[] = [
|
||||||
|
'content' => '导出任务统计已完成',
|
||||||
|
'style' => 'font-weight: bold;padding-bottom: 4px;',
|
||||||
|
];
|
||||||
//
|
//
|
||||||
$builder = ProjectTask::select(['project_tasks.*', 'project_task_users.userid as ownerid'])
|
$builder = ProjectTask::select(['project_tasks.*', 'project_task_users.userid as ownerid'])
|
||||||
->join('project_task_users', 'project_tasks.id', '=', 'project_task_users.task_id')
|
->join('project_task_users', 'project_tasks.id', '=', 'project_task_users.task_id')
|
||||||
@ -1329,8 +1332,15 @@ class ProjectController extends AbstractController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (empty($datas)) {
|
if (empty($datas)) {
|
||||||
$text .= '没有任何数据';
|
$content[] = [
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true);
|
'content' => '没有任何数据',
|
||||||
|
'style' => 'color: #ff0000;',
|
||||||
|
];
|
||||||
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
|
'type' => 'content',
|
||||||
|
'title' => $content[0]['content'],
|
||||||
|
'content' => $content,
|
||||||
|
], $botUser->userid, false, false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1354,8 +1364,15 @@ class ProjectController extends AbstractController
|
|||||||
$export = new BillMultipleExport($sheets);
|
$export = new BillMultipleExport($sheets);
|
||||||
$res = $export->store($filePath . "/" . $fileName);
|
$res = $export->store($filePath . "/" . $fileName);
|
||||||
if ($res != 1) {
|
if ($res != 1) {
|
||||||
$text .= "导出失败,{$fileName}!";
|
$content[] = [
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true);
|
'content' => "导出失败,{$fileName}!",
|
||||||
|
'style' => 'color: #ff0000;',
|
||||||
|
];
|
||||||
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
|
'type' => 'content',
|
||||||
|
'title' => $content[0]['content'],
|
||||||
|
'content' => $content,
|
||||||
|
], $botUser->userid, false, false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1376,17 +1393,26 @@ class ProjectController extends AbstractController
|
|||||||
]));
|
]));
|
||||||
$fileUrl = Base::fillUrl('api/project/task/down?key=' . urlencode($base64));
|
$fileUrl = Base::fillUrl('api/project/task/down?key=' . urlencode($base64));
|
||||||
Session::put('task::export:userid', $user->userid);
|
Session::put('task::export:userid', $user->userid);
|
||||||
$text .= "文件名:{$fileName}";
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
$text .= "\n";
|
'type' => 'file_download',
|
||||||
$text .= "文件大小:" . Base::twoFloat(filesize($zipPath) / 1024, true) . "KB";
|
'title' => '导出任务统计已完成',
|
||||||
$text .= "\n";
|
'name' => $fileName,
|
||||||
$text .= '<a href="' . $fileUrl . '" target="_blank"><button type="button" class="ivu-btn ivu-btn-warning" style="margin-top: 10px;"><span>立即下载</span></button></a>';
|
'size' => filesize($zipPath),
|
||||||
|
'url' => $fileUrl,
|
||||||
|
], $botUser->userid, false, false, true);
|
||||||
} else {
|
} else {
|
||||||
$text .= '打包失败,请稍后再试...';
|
$content[] = [
|
||||||
|
'content' => "打包失败,请稍后再试...",
|
||||||
|
'style' => 'color: #ff0000;',
|
||||||
|
];
|
||||||
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', [
|
||||||
|
'type' => 'content',
|
||||||
|
'title' => $content[0]['content'],
|
||||||
|
'content' => $content,
|
||||||
|
], $botUser->userid, false, false, true);
|
||||||
}
|
}
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true);
|
|
||||||
});
|
});
|
||||||
return Base::retSuccess('success', ['msg' => '正在打包,请留意系统消息。']);
|
return Base::retSuccess('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -306,41 +306,45 @@ class SystemController extends AbstractController
|
|||||||
}
|
}
|
||||||
$backup = $setting;
|
$backup = $setting;
|
||||||
$setting = Base::setting('aibotSetting', Base::newTrim($all));
|
$setting = Base::setting('aibotSetting', Base::newTrim($all));
|
||||||
|
$tempMsg = [
|
||||||
|
'type' => 'content',
|
||||||
|
'content' => '设置成功'
|
||||||
|
];
|
||||||
//
|
//
|
||||||
if ($backup['openai_key'] != $setting['openai_key']) {
|
if ($backup['openai_key'] != $setting['openai_key']) {
|
||||||
$botUser = User::botGetOrCreate('ai-openai');
|
$botUser = User::botGetOrCreate('ai-openai');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backup['claude_token'] != $setting['claude_token']) {
|
if ($backup['claude_token'] != $setting['claude_token']) {
|
||||||
$botUser = User::botGetOrCreate('ai-claude');
|
$botUser = User::botGetOrCreate('ai-claude');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backup['wenxin_key'] != $setting['wenxin_key']) {
|
if ($backup['wenxin_key'] != $setting['wenxin_key']) {
|
||||||
$botUser = User::botGetOrCreate('ai-wenxin');
|
$botUser = User::botGetOrCreate('ai-wenxin');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backup['qianwen_key'] != $setting['qianwen_key']) {
|
if ($backup['qianwen_key'] != $setting['qianwen_key']) {
|
||||||
$botUser = User::botGetOrCreate('ai-qianwen');
|
$botUser = User::botGetOrCreate('ai-qianwen');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backup['gemini_key'] != $setting['gemini_key']) {
|
if ($backup['gemini_key'] != $setting['gemini_key']) {
|
||||||
$botUser = User::botGetOrCreate('ai-gemini');
|
$botUser = User::botGetOrCreate('ai-gemini');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backup['zhipu_key'] != $setting['zhipu_key']) {
|
if ($backup['zhipu_key'] != $setting['zhipu_key']) {
|
||||||
$botUser = User::botGetOrCreate('ai-zhipu');
|
$botUser = User::botGetOrCreate('ai-zhipu');
|
||||||
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
if ($botUser && $dialog = WebSocketDialog::checkUserDialog($botUser, $user->userid)) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => "设置成功"], $botUser->userid, true, false, true);
|
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'template', $tempMsg, $botUser->userid, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1095,7 +1099,7 @@ class SystemController extends AbstractController
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// 一般是请求超时
|
// 一般是请求超时
|
||||||
if (str_contains($e->getMessage(), "Timed Out")) {
|
if (str_contains($e->getMessage(), "Timed Out")) {
|
||||||
return Base::retError("language.TimedOut");
|
return Base::retError("邮件发送超时,请检查邮箱配置是否正确");
|
||||||
} elseif ($e->getCode() === 550) {
|
} elseif ($e->getCode() === 550) {
|
||||||
return Base::retError('邮件内容被拒绝,请检查邮箱是否开启接收功能');
|
return Base::retError('邮件内容被拒绝,请检查邮箱是否开启接收功能');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -300,14 +300,20 @@ class UserBot extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 隐私机器人
|
* 隐私机器人
|
||||||
* @param $command
|
* @param $command
|
||||||
* @return string
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function anonBotQuickMsg($command)
|
public static function anonBotQuickMsg($command)
|
||||||
{
|
{
|
||||||
return match ($command) {
|
return match ($command) {
|
||||||
"help" => "使用说明:打开你想要发匿名消息的个人对话,点击输入框右边的 ⊕ 号,选择 <u>匿名消息</u> 即可输入你想要发送的匿名消息内容。",
|
"help" => [
|
||||||
"privacy" => "匿名消息将通过 <u>匿名消息(机器人)</u> 发送给对方,不会记录你的身份信息。",
|
"title" => "匿名消息使用说明",
|
||||||
default => '',
|
"content" => "使用说明:打开你想要发匿名消息的个人对话,点击输入框右边的 ⊕ 号,选择「匿名消息」即可输入你想要发送的匿名消息内容。"
|
||||||
|
],
|
||||||
|
"privacy" => [
|
||||||
|
"title" => "匿名消息隐私说明",
|
||||||
|
"content" => "匿名消息将通过「匿名消息(机器人)」发送给对方,不会记录你的身份信息。"
|
||||||
|
],
|
||||||
|
default => [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class UserEmailVerification extends AbstractModel
|
|||||||
->send();
|
->send();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
if (str_contains($e->getMessage(), "Timed Out")) {
|
if (str_contains($e->getMessage(), "Timed Out")) {
|
||||||
throw new ApiException("language.TimedOut");
|
throw new ApiException("邮件发送超时,请检查邮箱配置是否正确");
|
||||||
} elseif ($e->getCode() === 550) {
|
} elseif ($e->getCode() === 550) {
|
||||||
throw new ApiException('邮件内容被拒绝,请检查邮箱是否开启接收功能');
|
throw new ApiException('邮件内容被拒绝,请检查邮箱是否开启接收功能');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -93,21 +93,22 @@ class BotReceiveMsgTask extends AbstractTask
|
|||||||
}
|
}
|
||||||
// 签到机器人
|
// 签到机器人
|
||||||
if ($botUser->email === 'check-in@bot.system') {
|
if ($botUser->email === 'check-in@bot.system') {
|
||||||
$text = UserBot::checkinBotQuickMsg($command, $msg->userid);
|
$content = UserBot::checkinBotQuickMsg($command, $msg->userid);
|
||||||
if ($text) {
|
if ($content) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
||||||
'type' => 'content',
|
'type' => 'content',
|
||||||
'content' => $text,
|
'content' => $content,
|
||||||
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 隐私机器人
|
// 隐私机器人
|
||||||
if ($botUser->email === 'anon-msg@bot.system') {
|
if ($botUser->email === 'anon-msg@bot.system') {
|
||||||
$text = UserBot::anonBotQuickMsg($command);
|
$array = UserBot::anonBotQuickMsg($command);
|
||||||
if ($text) {
|
if ($array) {
|
||||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
||||||
'type' => 'content',
|
'type' => 'content',
|
||||||
'content' => $text,
|
'title' => $array['title'],
|
||||||
|
'content' => $array['content'],
|
||||||
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,10 +119,9 @@ class BotReceiveMsgTask extends AbstractTask
|
|||||||
} elseif (UserBot::whereBotId($botUser->userid)->whereUserid($msg->userid)->exists()) {
|
} elseif (UserBot::whereBotId($botUser->userid)->whereUserid($msg->userid)->exists()) {
|
||||||
$isManager = false;
|
$isManager = false;
|
||||||
} else {
|
} else {
|
||||||
$text = "非常抱歉,我不是你的机器人,无法完成你的指令。";
|
|
||||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'template', [
|
||||||
'type' => 'content',
|
'type' => 'content',
|
||||||
'content' => $text,
|
'content' => "非常抱歉,我不是你的机器人,无法完成你的指令。",
|
||||||
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="source.type === 'notice'" class="dialog-notice">
|
<div v-else-if="source.type === 'notice'" class="dialog-notice">
|
||||||
{{source.msg.notice}}
|
{{$L(source.msg.notice)}}
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="dialog-avatar">
|
<div class="dialog-avatar">
|
||||||
|
|||||||
@ -106,9 +106,9 @@ export default {
|
|||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'project/task/export',
|
url: 'project/task/export',
|
||||||
data: this.formData,
|
data: this.formData,
|
||||||
}).then(({data}) => {
|
}).then(() => {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
$A.modalSuccess(data.msg);
|
$A.modalSuccess('正在打包,请留意系统消息。');
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user