no message

This commit is contained in:
kuaifan 2023-02-20 10:16:37 +08:00
parent 1a5f472030
commit 8a83015118
4 changed files with 17 additions and 6 deletions

View File

@ -1561,8 +1561,7 @@ class UsersController extends AbstractController
*/ */
public function socket__status() public function socket__status()
{ {
$fd = Request::exists('fd') ? Request::input('fd') : Request::header('fd'); $row = WebSocket::select(['id', 'fd', 'userid', 'updated_at'])->whereFd(Base::headerOrInput('fd'))->first();
$row = WebSocket::select(['id', 'fd', 'userid', 'updated_at'])->whereFd($fd)->first();
if (empty($row)) { if (empty($row)) {
return Base::retError('error'); return Base::retError('error');
} }

View File

@ -254,7 +254,7 @@ class WebSocketDialogMsg extends AbstractModel
$dialog = WebSocketDialog::find($this->dialog_id); $dialog = WebSocketDialog::find($this->dialog_id);
$dialog?->pushMsg('update', $resData); $dialog?->pushMsg('update', $resData);
// //
return Base::retSuccess('sucess', $resData); return Base::retSuccess('success', $resData);
} }
/** /**

View File

@ -76,6 +76,16 @@ class Base
}); });
} }
/**
* 如果header没有则通过input读取
* @param $key
* @return mixed|string
*/
public static function headerOrInput($key)
{
return Base::nullShow(Request::header($key), Request::input($key));
}
/** /**
* 获取版本号 * 获取版本号
* @return string * @return string
@ -94,7 +104,7 @@ class Base
{ {
global $_A; global $_A;
if (!isset($_A["__static_client_version"])) { if (!isset($_A["__static_client_version"])) {
$_A["__static_client_version"] = Request::header('version') ?: '0.0.1'; $_A["__static_client_version"] = self::headerOrInput('version') ?: '0.0.1';
} }
return $_A["__static_client_version"]; return $_A["__static_client_version"];
} }
@ -1484,7 +1494,7 @@ class Base
public static function langData() public static function langData()
{ {
global $_A; global $_A;
$language = trim(Request::header('language')); $language = trim(self::headerOrInput('language'));
if (!isset($_A["__static_langdata_" . $language])) { if (!isset($_A["__static_langdata_" . $language])) {
$_A["__static_langdata_" . $language] = []; $_A["__static_langdata_" . $language] = [];
$langpath = resource_path('lang/' . $language . '.php'); $langpath = resource_path('lang/' . $language . '.php');
@ -2174,7 +2184,7 @@ class Base
{ {
global $_A; global $_A;
if (!isset($_A["__static_token"])) { if (!isset($_A["__static_token"])) {
$_A["__static_token"] = Base::nullShow(Request::header('token'), Request::input('token')); $_A["__static_token"] = self::headerOrInput('token');
} }
return $_A["__static_token"]; return $_A["__static_token"];
} }

View File

@ -330,6 +330,8 @@ class BotReceiveMsgTask extends AbstractTask
'bot_uid' => $botUser->userid, 'bot_uid' => $botUser->userid,
'version' => Base::getVersion(), 'version' => Base::getVersion(),
], 10); ], 10);
$userBot->webhook_num++;
$userBot->save();
} }
} }
} }