mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-04 12:23:26 +00:00
no message
This commit is contained in:
parent
4625ae7548
commit
eda9eb08d5
@ -1493,7 +1493,7 @@ class DialogController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function msg__voice2text()
|
public function msg__voice2text()
|
||||||
{
|
{
|
||||||
User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$msg_id = intval(Request::input("msg_id"));
|
$msg_id = intval(Request::input("msg_id"));
|
||||||
$msg = WebSocketDialogMsg::whereId($msg_id)->first();
|
$msg = WebSocketDialogMsg::whereId($msg_id)->first();
|
||||||
@ -1503,19 +1503,27 @@ class DialogController extends AbstractController
|
|||||||
if ($msg->type !== 'record') {
|
if ($msg->type !== 'record') {
|
||||||
return Base::retError("仅支持语音消息");
|
return Base::retError("仅支持语音消息");
|
||||||
}
|
}
|
||||||
if ($msg['msg']['text']) {
|
$msgData = Base::json2array($msg->getRawOriginal('msg'));
|
||||||
|
if ($msgData['text']) {
|
||||||
|
$textUserid = is_array($msgData['text_userid']) ? $msgData['text_userid'] : [];
|
||||||
|
if (!in_array($user->userid, $textUserid)) {
|
||||||
|
$textUserid[] = $user->userid;
|
||||||
|
$msg->updateInstance([
|
||||||
|
'msg' => array_merge($msgData, ['text_userid' => $textUserid]),
|
||||||
|
]);
|
||||||
|
$msg->save();
|
||||||
|
}
|
||||||
return Base::retSuccess("success", $msg);
|
return Base::retSuccess("success", $msg);
|
||||||
}
|
}
|
||||||
WebSocketDialog::checkDialog($msg->dialog_id);
|
WebSocketDialog::checkDialog($msg->dialog_id);
|
||||||
//
|
//
|
||||||
$msgData = Base::json2array($msg->getRawOriginal('msg'));
|
|
||||||
$res = Extranet::openAItranscriptions(public_path($msgData['path']));
|
$res = Extranet::openAItranscriptions(public_path($msgData['path']));
|
||||||
if (Base::isError($res)) {
|
if (Base::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$msg->updateInstance([
|
$msg->updateInstance([
|
||||||
'msg' => array_merge($msgData, ['text' => $res['data']]),
|
'msg' => array_merge($msgData, ['text' => $res['data'], 'text_userid' => [$user->userid]]),
|
||||||
]);
|
]);
|
||||||
$msg->save();
|
$msg->save();
|
||||||
return Base::retSuccess("success", $msg);
|
return Base::retSuccess("success", $msg);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
|
use App\Module\Doo;
|
||||||
use App\Module\Image;
|
use App\Module\Image;
|
||||||
use App\Tasks\PushTask;
|
use App\Tasks\PushTask;
|
||||||
use App\Exceptions\ApiException;
|
use App\Exceptions\ApiException;
|
||||||
@ -154,6 +155,13 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
$msg['thumb'] = Base::fillUrl($msg['thumb'] ?: Base::extIcon($msg['ext']));
|
$msg['thumb'] = Base::fillUrl($msg['thumb'] ?: Base::extIcon($msg['ext']));
|
||||||
} else if ($type === 'record') {
|
} else if ($type === 'record') {
|
||||||
$msg['path'] = Base::fillUrl($msg['path']);
|
$msg['path'] = Base::fillUrl($msg['path']);
|
||||||
|
$textUserid = is_array($msg['text_userid']) ? $msg['text_userid'] : [];
|
||||||
|
if (isset($msg['text_userid'])) {
|
||||||
|
unset($msg['text_userid']);
|
||||||
|
}
|
||||||
|
if ($msg['text'] && !in_array(Doo::userId(), $textUserid)) {
|
||||||
|
$msg['text'] = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user