mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-14 04:05:35 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c20e3324d4 | ||
| 303f44cd2b | |||
| 66b73973b4 |
@@ -29,25 +29,15 @@ trait CQAPI
|
|||||||
public function processWebsocketAPI($connection, $reply, $function = false) {
|
public function processWebsocketAPI($connection, $reply, $function = false) {
|
||||||
$api_id = ZMAtomic::get("wait_msg_id")->add(1);
|
$api_id = ZMAtomic::get("wait_msg_id")->add(1);
|
||||||
$reply["echo"] = $api_id;
|
$reply["echo"] = $api_id;
|
||||||
SpinLock::lock("wait_api");
|
|
||||||
$r = LightCacheInside::get("wait_api", "wait_api");
|
|
||||||
$r[$api_id] = [
|
|
||||||
"data" => $reply,
|
|
||||||
"time" => microtime(true),
|
|
||||||
"self_id" => $connection->getOption("connect_id"),
|
|
||||||
"echo" => $api_id
|
|
||||||
];
|
|
||||||
LightCacheInside::set("wait_api", "wait_api", $r);
|
|
||||||
SpinLock::unlock("wait_api");
|
|
||||||
if (server()->push($connection->getFd(), json_encode($reply))) {
|
if (server()->push($connection->getFd(), json_encode($reply))) {
|
||||||
if ($function === true) {
|
if ($function === true) {
|
||||||
return CoMessage::yieldByWS($r[$api_id], ["echo"], 60);
|
$obj = [
|
||||||
} else {
|
"data" => $reply,
|
||||||
SpinLock::lock("wait_api");
|
"time" => microtime(true),
|
||||||
$r = LightCacheInside::get("wait_api", "wait_api");
|
"self_id" => $connection->getOption("connect_id"),
|
||||||
unset($r[$api_id]);
|
"echo" => $api_id
|
||||||
LightCacheInside::set("wait_api", "wait_api", $r);
|
];
|
||||||
SpinLock::unlock("wait_api");
|
return CoMessage::yieldByWS($obj, ["echo"], 60);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ use ZM\Utils\DataProvider;
|
|||||||
|
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
const VERSION_ID = 388;
|
const VERSION_ID = 395;
|
||||||
const VERSION = "2.3.1";
|
const VERSION = "2.3.2";
|
||||||
|
|
||||||
public function __construct(string $name = 'UNKNOWN') {
|
public function __construct(string $name = 'UNKNOWN') {
|
||||||
define("ZM_VERSION_ID", self::VERSION_ID);
|
define("ZM_VERSION_ID", self::VERSION_ID);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class Table
|
|||||||
if ($msg == "") {
|
if ($msg == "") {
|
||||||
$msg .= $k . " $operator ? ";
|
$msg .= $k . " $operator ? ";
|
||||||
} else {
|
} else {
|
||||||
$msg .= "AND " . $k . " $operator ?";
|
$msg .= " AND " . $k . " $operator ?";
|
||||||
}
|
}
|
||||||
$param[] = $v;
|
$param[] = $v;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user