mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
no message
This commit is contained in:
parent
d6ddc5ff88
commit
01feacfe54
@ -1008,30 +1008,26 @@ class ApproveController extends AbstractController
|
||||
$msgAction = 'change-' . $toUser['msg_id'];
|
||||
}
|
||||
//
|
||||
try {
|
||||
$msg = WebSocketDialogMsg::sendMsg($msgAction, $dialog->id, 'template', $msgData, $process['start_user_id'], false, false, true);
|
||||
// 关联信息
|
||||
if ($action == 'start') {
|
||||
$proc_msg = new ApproveProcMsg();
|
||||
$proc_msg->proc_inst_id = $process['id'];
|
||||
$proc_msg->msg_id = $msg['data']->id;
|
||||
$proc_msg->userid = $toUser['userid'];
|
||||
$proc_msg->save();
|
||||
}
|
||||
// 更新审批 未读数量
|
||||
if ($type == 'approve_reviewer' && $toUser['userid']) {
|
||||
$params = [
|
||||
'userid' => [$toUser['userid'], User::auth()->userid()],
|
||||
'msg' => [
|
||||
'type' => 'approve',
|
||||
'action' => 'unread',
|
||||
'userid' => $toUser['userid'],
|
||||
]
|
||||
];
|
||||
Task::deliver(new PushTask($params, false));
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
info($th->getMessage());
|
||||
$msg = WebSocketDialogMsg::sendMsg($msgAction, $dialog->id, 'template', $msgData, $process['start_user_id'], false, false, true);
|
||||
// 关联信息
|
||||
if ($action == 'start') {
|
||||
$proc_msg = new ApproveProcMsg();
|
||||
$proc_msg->proc_inst_id = $process['id'];
|
||||
$proc_msg->msg_id = $msg['data']->id;
|
||||
$proc_msg->userid = $toUser['userid'];
|
||||
$proc_msg->save();
|
||||
}
|
||||
// 更新审批 未读数量
|
||||
if ($type == 'approve_reviewer' && $toUser['userid']) {
|
||||
$params = [
|
||||
'userid' => [$toUser['userid'], User::auth()->userid()],
|
||||
'msg' => [
|
||||
'type' => 'approve',
|
||||
'action' => 'unread',
|
||||
'userid' => $toUser['userid'],
|
||||
]
|
||||
];
|
||||
Task::deliver(new PushTask($params, false));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -985,6 +985,7 @@ class DialogController extends AbstractController
|
||||
*
|
||||
* @apiParam {Number} dialog_id 对话ID
|
||||
* @apiParam {String} text 消息内容
|
||||
* @apiParam {String} [key] 搜索关键词 (不设置根据内容自动生成)
|
||||
* @apiParam {String} [text_type] 消息类型
|
||||
* - html: HTML(默认)
|
||||
* - md: MARKDOWN
|
||||
@ -1012,6 +1013,7 @@ class DialogController extends AbstractController
|
||||
$update_mark = !($user->bot && in_array(strtolower(trim(Request::input('update_mark'))), ['no', 'false', '0']));
|
||||
$reply_id = intval(Request::input('reply_id'));
|
||||
$text = trim(Request::input('text'));
|
||||
$key = trim(Request::input('key'));
|
||||
$text_type = strtolower(trim(Request::input('text_type')));
|
||||
$silence = in_array(strtolower(trim(Request::input('silence'))), ['yes', 'true', '1']);
|
||||
$markdown = in_array($text_type, ['md', 'markdown']);
|
||||
@ -1064,13 +1066,16 @@ class DialogController extends AbstractController
|
||||
'height' => -1,
|
||||
'ext' => $ext,
|
||||
];
|
||||
$result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid, false, false, $silence);
|
||||
if (empty($key)) {
|
||||
$key = mb_substr(strip_tags($text), 0, 200);
|
||||
}
|
||||
$result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid, false, false, $silence, $key);
|
||||
} else {
|
||||
$msgData = ['text' => $text];
|
||||
if ($markdown) {
|
||||
$msgData['type'] = 'md';
|
||||
}
|
||||
$result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'text', $msgData, $user->userid, false, false, $silence);
|
||||
$result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'text', $msgData, $user->userid, false, false, $silence, $key);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -640,27 +640,35 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
|
||||
/**
|
||||
* 生成关键词并保存
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function generateKeyAndSave(): void
|
||||
public function generateKeyAndSave(string $key = ''): void
|
||||
{
|
||||
$key = '';
|
||||
switch ($this->type) {
|
||||
case 'text':
|
||||
case 'vote':
|
||||
case 'word-chain':
|
||||
$key = strip_tags($this->msg['text']);
|
||||
break;
|
||||
if (empty($key)) {
|
||||
$key = '';
|
||||
switch ($this->type) {
|
||||
case 'text':
|
||||
if (!preg_match("/<span[^>]*?data-quick-key=([\"'])(.*?)\\1[^>]*?>/is", $this->msg['text'])) {
|
||||
$key = strip_tags($this->msg['text']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'file':
|
||||
$key = $this->msg['name'];
|
||||
$key = preg_replace("/^(image|\d+)\.(png|jpg|jpeg|webp|gif)$/i", "", $key);
|
||||
$key = preg_replace("/^LongText-(.*?)/i", "", $key);
|
||||
break;
|
||||
case 'vote':
|
||||
case 'word-chain':
|
||||
$key = strip_tags($this->msg['text']);
|
||||
break;
|
||||
|
||||
case 'meeting':
|
||||
$key = $this->msg['name'];
|
||||
break;
|
||||
case 'file':
|
||||
$key = $this->msg['name'];
|
||||
$key = preg_replace("/^(image|\d+)\.(png|jpg|jpeg|webp|gif)$/i", "", $key);
|
||||
$key = preg_replace("/^LongText-(.*?)/i", "", $key);
|
||||
break;
|
||||
|
||||
case 'meeting':
|
||||
$key = $this->msg['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$key = str_replace([""", "&", "<", ">"], "", $key);
|
||||
$key = str_replace(["\r", "\n", "\t", " "], " ", $key);
|
||||
@ -940,9 +948,10 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
* @param bool $push_retry 推送-失败后重试1次(有时候在事务里执行,数据还没生成时会出现找不到消息的情况)
|
||||
* @param bool|null $push_silence 推送-静默
|
||||
* - type = [text|file|record|meeting] 默认为:false
|
||||
* @param string|null $search_key 搜索关键词(用于搜索,留空则自动生成)
|
||||
* @return array
|
||||
*/
|
||||
public static function sendMsg($action, $dialog_id, $type, $msg, $sender = null, $push_self = false, $push_retry = false, $push_silence = null)
|
||||
public static function sendMsg($action, $dialog_id, $type, $msg, $sender = null, $push_self = false, $push_retry = false, $push_silence = null, $search_key = null)
|
||||
{
|
||||
$link = 0;
|
||||
$mtype = $type;
|
||||
@ -1017,7 +1026,7 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
'modify' => $modify,
|
||||
];
|
||||
$dialogMsg->updateInstance($updateData);
|
||||
$dialogMsg->generateKeyAndSave();
|
||||
$dialogMsg->generateKeyAndSave($search_key);
|
||||
//
|
||||
WebSocketDialogUser::whereDialogId($dialog->id)->whereUserid($sender)->whereHide(1)->change([
|
||||
'hide' => 0, // 修改消息时,显示会话(仅自己)
|
||||
@ -1064,7 +1073,7 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
]);
|
||||
AbstractModel::transaction(function () use ($dialogMsg) {
|
||||
$dialogMsg->send = 1;
|
||||
$dialogMsg->generateKeyAndSave();
|
||||
$dialogMsg->generateKeyAndSave($search_key);
|
||||
//
|
||||
if ($dialogMsg->type === 'meeting') {
|
||||
MeetingMsg::createInstance([
|
||||
|
||||
@ -526,13 +526,19 @@ class BotReceiveMsgTask extends AbstractTask
|
||||
$userBot->webhook_num++;
|
||||
$userBot->save();
|
||||
}
|
||||
if ($res['data'] && $data = json_decode($res['data'])) {
|
||||
if ($res['data'] && $data = Base::json2array($res['data'])) {
|
||||
if ($data['code'] != 200 && $data['message']) {
|
||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'text', ['text' => $res['data']['message']], $botUser->userid, false, false, true);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
info($th->getMessage());
|
||||
info(Base::array2json([
|
||||
'bot_userid' => $botUser->userid,
|
||||
'dialog' => $dialog->id,
|
||||
'msg' => $msg->id,
|
||||
'webhook_url' => $webhookUrl,
|
||||
'error' => $th->getMessage(),
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Models\WebSocketDialog;
|
||||
use App\Models\WebSocketDialogMsg;
|
||||
use App\Models\WebSocketDialogMsgRead;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddWebSocketDialogMsgReadsLive2 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
WebSocketDialogMsg::whereType('text')->where('key', 'like', "LongText-%")->update(['key' => '']);
|
||||
WebSocketDialogMsg::whereType('file')->where('key', 'like', "image.%")->update(['key' => '']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -528,10 +528,10 @@ webhook地址最长仅支持255个字符。
|
||||
操作频繁!
|
||||
暂未开启签到功能。
|
||||
暂未开放手动签到。
|
||||
上班打卡成功,打卡时间:(*)(手动签到)
|
||||
上班打卡成功,打卡时间:(*)
|
||||
下班打卡成功,打卡时间:(*)(手动签到)
|
||||
下班打卡成功,打卡时间:(*)
|
||||
今日已上班打卡,无需重复打卡。(*)
|
||||
今日已下班打卡,无需重复打卡。(*)
|
||||
今日已上班打卡,无需重复打卡。
|
||||
今日已下班打卡,无需重复打卡。
|
||||
上班时间到了,你还没有打卡哦~
|
||||
|
||||
@ -198,7 +198,6 @@
|
||||
错误的类型参数
|
||||
项目未完成任务
|
||||
上传/浏览 图片
|
||||
签到设置 (Beta)
|
||||
不能对话自己
|
||||
任务完成时间
|
||||
修改任务时间
|
||||
@ -1624,10 +1623,10 @@ Token
|
||||
操作频繁!
|
||||
暂未开启签到功能。
|
||||
暂未开放手动签到。
|
||||
上班打卡成功,打卡时间:(*)(手动签到)
|
||||
上班打卡成功,打卡时间:(*)
|
||||
下班打卡成功,打卡时间:(*)(手动签到)
|
||||
下班打卡成功,打卡时间:(*)
|
||||
今日已上班打卡,无需重复打卡。(*)
|
||||
今日已下班打卡,无需重复打卡。(*)
|
||||
今日已上班打卡,无需重复打卡。
|
||||
今日已下班打卡,无需重复打卡。
|
||||
缺卡提醒
|
||||
@ -1696,3 +1695,6 @@ WiFi签到延迟时长为±1分钟。
|
||||
|
||||
群内成员
|
||||
群外成员
|
||||
|
||||
该任务尚未被领取,点击这里
|
||||
搜索词 (留空自动生成)
|
||||
|
||||
@ -3203,18 +3203,6 @@
|
||||
"id": "Unggah\/Jelajahi gambar",
|
||||
"ru": "Загрузить\/Просмотреть изображения"
|
||||
},
|
||||
{
|
||||
"key": "签到设置 (Beta)",
|
||||
"zh": "",
|
||||
"zh-CHT": "簽到設置 (Beta)",
|
||||
"en": "Check-in settings (Beta)",
|
||||
"ko": "체크인 설정 (베타)",
|
||||
"ja": "チェックイン設定(ベータ)",
|
||||
"de": "Check-in-Einstellungen (Beta)",
|
||||
"fr": "Paramètres d'enregistrement (Bêta)",
|
||||
"id": "Pengaturan check-in (Beta)",
|
||||
"ru": "Настройки регистрации (Бета)"
|
||||
},
|
||||
{
|
||||
"key": "不能对话自己",
|
||||
"zh": "",
|
||||
@ -3327,13 +3315,13 @@
|
||||
"key": "启用 LDAP 认证",
|
||||
"zh": "",
|
||||
"zh-CHT": "啟用 LDAP 認證",
|
||||
"en": "Enable LDAP authentication",
|
||||
"ko": "LDAP 인증 활성화",
|
||||
"ja": "LDAP認証を有効にする",
|
||||
"de": "LDAP-Authentifizierung aktivieren",
|
||||
"fr": "Activer l'authentification LDAP",
|
||||
"id": "Aktifkan autentikasi LDAP",
|
||||
"ru": "Включить аутентификацию LDAP"
|
||||
"en": "Enable LDAP",
|
||||
"ko": "LDAP 활성화",
|
||||
"ja": "LDAPを有効にする",
|
||||
"de": "LDAP aktivieren",
|
||||
"fr": "Activer LDAP",
|
||||
"id": "Aktifkan LDAP",
|
||||
"ru": "Включить LDAP"
|
||||
},
|
||||
{
|
||||
"key": "导出任务统计",
|
||||
@ -19331,6 +19319,30 @@
|
||||
"id": "Check-in manual belum tersedia.",
|
||||
"ru": "Ручная регистрация пока недоступна."
|
||||
},
|
||||
{
|
||||
"key": "今日已上班打卡,无需重复打卡。(*)",
|
||||
"zh": "",
|
||||
"zh-CHT": "今日已上班打卡,無需重複打卡。(*)",
|
||||
"en": "You have already clocked in today. No need to clock in again (*).",
|
||||
"ko": "오늘 이미 출근 체크인 완료입니다. 다시 체크인할 필요 없습니다.(*))",
|
||||
"ja": "今日はすでに出勤打刻済みです。再度打刻する必要はありません。(*)",
|
||||
"de": "Sie haben heute bereits eingecheckt. Es ist kein erneutes Einchecken notwendig.(*))",
|
||||
"fr": "Vous avez déjà pointé aujourd'hui. Pas besoin de pointez à nouveau.(*))",
|
||||
"id": "Anda telah melakukan absensi hari ini. Tidak perlu absen lagi.(*))",
|
||||
"ru": "Вы уже отметились сегодня. Нет необходимости отмечаться снова.(*))"
|
||||
},
|
||||
{
|
||||
"key": "今日已下班打卡,无需重复打卡。(*)",
|
||||
"zh": "",
|
||||
"zh-CHT": "今日已下班打卡,無需重複打卡。(*)",
|
||||
"en": "You have already clocked out today. No need to clock out again (*).",
|
||||
"ko": "오늘 이미 퇴근 체크인 완료입니다. 다시 체크아웃할 필요 없습니다.(*))",
|
||||
"ja": "今日はすでに退勤打刻済みです。再度打刻する必要はありません。(*)",
|
||||
"de": "Sie haben heute bereits ausgecheckt. Es ist kein erneutes Auschecken notwendig.(*))",
|
||||
"fr": "Vous avez déjà pointé de sortie aujourd'hui. Pas besoin de pointer à nouveau.(*))",
|
||||
"id": "Anda telah melakukan absensi keluar hari ini. Tidak perlu absen lagi.(*))",
|
||||
"ru": "Вы уже отметились сегодня на выход. Нет необходимости отмечаться снова.(*))"
|
||||
},
|
||||
{
|
||||
"key": "今日已上班打卡,无需重复打卡。",
|
||||
"zh": "",
|
||||
@ -24035,18 +24047,6 @@
|
||||
"id": "Berhasil disematkan",
|
||||
"ru": "Успешно закреплено"
|
||||
},
|
||||
{
|
||||
"key": "上班打卡成功,打卡时间:(*)(手动签到)",
|
||||
"zh": "",
|
||||
"zh-CHT": "上班打卡成功,打卡時間:(*)(手動簽到)",
|
||||
"en": "Clock-in successful, time: (*) (Manual check-in)",
|
||||
"ko": "출근 체크인 성공, 시간: (*) (수동 체크인)",
|
||||
"ja": "出勤打刻成功、時間:(*) (手動チェックイン)",
|
||||
"de": "Erfolgreich eingestempelt, Zeit: (*) (Manuelles Check-in)",
|
||||
"fr": "Pointage réussi, heure : (*) (Enregistrement manuel)",
|
||||
"id": "Berhasil absen masuk, waktu: (*) (Check-in manual)",
|
||||
"ru": "Успешная регистрация прихода, время: (*) (Ручная регистрация)"
|
||||
},
|
||||
{
|
||||
"key": "上班打卡成功,打卡时间:(*)",
|
||||
"zh": "",
|
||||
@ -24059,18 +24059,6 @@
|
||||
"id": "Berhasil absen masuk, waktu: (*)",
|
||||
"ru": "Успешная регистрация прихода, время: (*)"
|
||||
},
|
||||
{
|
||||
"key": "下班打卡成功,打卡时间:(*)(手动签到)",
|
||||
"zh": "",
|
||||
"zh-CHT": "下班打卡成功,打卡時間:(*)(手動簽到)",
|
||||
"en": "Clock-out successful, time: (*) (Manual check-out)",
|
||||
"ko": "퇴근 체크아웃 성공, 시간: (*) (수동 체크아웃)",
|
||||
"ja": "退勤打刻成功、時間:(*) (手動チェックアウト)",
|
||||
"de": "Erfolgreich ausgestempelt, Zeit: (*) (Manuelles Check-out)",
|
||||
"fr": "Pointage de sortie réussi, heure : (*) (Enregistrement manuel)",
|
||||
"id": "Berhasil absen keluar, waktu: (*) (Check-out manual)",
|
||||
"ru": "Успешная регистрация ухода, время: (*) (Ручная регистрация)"
|
||||
},
|
||||
{
|
||||
"key": "下班打卡成功,打卡时间:(*)",
|
||||
"zh": "",
|
||||
@ -24718,5 +24706,29 @@
|
||||
"fr": "Membres externes",
|
||||
"id": "Anggota luar grup",
|
||||
"ru": "Внешние участники"
|
||||
},
|
||||
{
|
||||
"key": "该任务尚未被领取,点击这里",
|
||||
"zh": "",
|
||||
"zh-CHT": "該任務尚未被領取,點擊這裡",
|
||||
"en": "This task has not been claimed yet, click here.",
|
||||
"ko": "이 작업은 아직 수령되지 않았습니다. 여기 클릭하세요.",
|
||||
"ja": "このタスクはまだ受け取られていません。ここをクリックしてください。",
|
||||
"de": "Diese Aufgabe wurde noch nicht angenommen. Klicken Sie hier.",
|
||||
"fr": "Cette tâche n'a pas encore été réclamée, cliquez ici.",
|
||||
"id": "Tugas ini belum diambil, klik di sini.",
|
||||
"ru": "Эта задача еще не была принята, нажмите здесь."
|
||||
},
|
||||
{
|
||||
"key": "搜索词 (留空自动生成)",
|
||||
"zh": "",
|
||||
"zh-CHT": "搜索詞 (留空自動生成)",
|
||||
"en": "Search term (auto-generated if left blank)",
|
||||
"ko": "검색어 (비워 두면 자동 생성됨)",
|
||||
"ja": "検索語 (空白の場合は自動生成)",
|
||||
"de": "Suchbegriff (automatisch generiert, wenn leer gelassen)",
|
||||
"fr": "Terme de recherche (généré automatiquement si laissé vide)",
|
||||
"id": "Kata kunci (otomatis dihasilkan jika kosong)",
|
||||
"ru": "Поисковой термин (автоматически сгенерирован, если оставлено пустым)"
|
||||
}
|
||||
]
|
||||
|
||||
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
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
2
public/language/web/de.js
vendored
2
public/language/web/de.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/en.js
vendored
2
public/language/web/en.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/fr.js
vendored
2
public/language/web/fr.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/id.js
vendored
2
public/language/web/id.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/ja.js
vendored
2
public/language/web/ja.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/key.js
vendored
2
public/language/web/key.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/ko.js
vendored
2
public/language/web/ko.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/ru.js
vendored
2
public/language/web/ru.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/zh-CHT.js
vendored
2
public/language/web/zh-CHT.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/zh.js
vendored
2
public/language/web/zh.js
vendored
File diff suppressed because one or more lines are too long
4
resources/assets/js/functions/common.js
vendored
4
resources/assets/js/functions/common.js
vendored
@ -503,7 +503,7 @@ const timezone = require("dayjs/plugin/timezone");
|
||||
return 0;
|
||||
}
|
||||
if (typeof obj === "number") {
|
||||
obj+= "";
|
||||
obj += "";
|
||||
}
|
||||
if (typeof obj.length === 'number') {
|
||||
return obj.length;
|
||||
@ -514,7 +514,7 @@ const timezone = require("dayjs/plugin/timezone");
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}catch (e) {
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
<p>--form 'dialog_id="<span class="mark-color">{{$L("对话ID")}}</span>"' \</p>
|
||||
<p>--form 'text="<span class="mark-color">{{$L("消息内容")}}</span>"'</p>
|
||||
<p>--form 'text_type="<span class="mark-color">[html|md]</span>"'</p>
|
||||
<p>--form 'key="<span class="mark-color">{{$L("搜索词 (留空自动生成)")}}</span>"'</p>
|
||||
<p>--form 'silence="<span class="mark-color">[yes|no]</span>"'</p>
|
||||
<p>--form 'reply_id="<span class="mark-color">{{$L("回复指定消息ID")}}</span>"'</p>
|
||||
<p> </p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user