mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 00:25:35 +08:00
update to 2.2.2 version
fix QQBot error clean code
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"description": "High performance QQ robot and web server development framework",
|
"description": "High performance QQ robot and web server development framework",
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"extra": {
|
"extra": {
|
||||||
"exclude_annotate": [
|
"exclude_annotate": [
|
||||||
"src/ZM"
|
"src/ZM"
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ use ZM\Console\Console;
|
|||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use ReflectionMethod;
|
use ReflectionMethod;
|
||||||
use ZM\Annotation\Http\{HandleAfter, HandleBefore, Controller, HandleException, Middleware, MiddlewareClass, RequestMapping};
|
use ZM\Annotation\Http\{HandleAfter, HandleBefore, HandleException, Middleware, MiddlewareClass, RequestMapping};
|
||||||
use ZM\Annotation\Interfaces\Level;
|
use ZM\Annotation\Interfaces\Level;
|
||||||
use ZM\Annotation\Module\Closed;
|
use ZM\Annotation\Module\Closed;
|
||||||
use ZM\Http\RouteManager;
|
use ZM\Http\RouteManager;
|
||||||
use ZM\Utils\DataProvider;
|
|
||||||
|
|
||||||
class AnnotationParser
|
class AnnotationParser
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
namespace ZM\Annotation\CQ;
|
namespace ZM\Annotation\CQ;
|
||||||
|
|
||||||
use Doctrine\Common\Annotations\Annotation\Required;
|
|
||||||
use Doctrine\Common\Annotations\Annotation\Target;
|
use Doctrine\Common\Annotations\Annotation\Target;
|
||||||
use ZM\Annotation\AnnotationBase;
|
use ZM\Annotation\AnnotationBase;
|
||||||
use ZM\Annotation\Interfaces\Level;
|
use ZM\Annotation\Interfaces\Level;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
namespace ZM\Annotation\Http;
|
namespace ZM\Annotation\Http;
|
||||||
|
|
||||||
|
|
||||||
use Doctrine\Common\Annotations\Annotation\Required;
|
|
||||||
use Doctrine\Common\Annotations\Annotation\Target;
|
use Doctrine\Common\Annotations\Annotation\Target;
|
||||||
use ZM\Annotation\AnnotationBase;
|
use ZM\Annotation\AnnotationBase;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace ZM\Annotation\Swoole;
|
|||||||
|
|
||||||
|
|
||||||
use Doctrine\Common\Annotations\Annotation\Target;
|
use Doctrine\Common\Annotations\Annotation\Target;
|
||||||
use ZM\Annotation\Interfaces\Rule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Annotation
|
* @Annotation
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ namespace ZM\Command;
|
|||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use ZM\Utils\DataProvider;
|
|
||||||
|
|
||||||
class DaemonStatusCommand extends DaemonCommand
|
class DaemonStatusCommand extends DaemonCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,10 +104,7 @@ class EventDispatcher
|
|||||||
} catch (InterruptException $e) {
|
} catch (InterruptException $e) {
|
||||||
$this->store = $e->return_var;
|
$this->store = $e->return_var;
|
||||||
$this->status = self::STATUS_INTERRUPTED;
|
$this->status = self::STATUS_INTERRUPTED;
|
||||||
} catch (Exception $e) {
|
} catch (Exception | Error $e) {
|
||||||
$this->status = self::STATUS_EXCEPTION;
|
|
||||||
throw $e;
|
|
||||||
} catch (Error $e) {
|
|
||||||
$this->status = self::STATUS_EXCEPTION;
|
$this->status = self::STATUS_EXCEPTION;
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -501,6 +501,10 @@ class ServerEventHandler
|
|||||||
//unset(Context::$context[Co::getCid()]);
|
//unset(Context::$context[Co::getCid()]);
|
||||||
$data = json_decode($data, true);
|
$data = json_decode($data, true);
|
||||||
switch ($data["action"] ?? '') {
|
switch ($data["action"] ?? '') {
|
||||||
|
case "resume_ws_message":
|
||||||
|
$obj = $data["data"];
|
||||||
|
Co::resume($obj["coroutine"]);
|
||||||
|
break;
|
||||||
case "getWorkerCache":
|
case "getWorkerCache":
|
||||||
$r = WorkerCache::get($data["key"]);
|
$r = WorkerCache::get($data["key"]);
|
||||||
$action = ["action" => "returnWorkerCache", "cid" => $data["cid"], "value" => $r];
|
$action = ["action" => "returnWorkerCache", "cid" => $data["cid"], "value" => $r];
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
namespace ZM\Http;
|
namespace ZM\Http;
|
||||||
|
|
||||||
|
|
||||||
use ZM\Console\Console;
|
|
||||||
|
|
||||||
class Response
|
class Response
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,4 +48,34 @@ class CoMessage
|
|||||||
if ($result === null) return false;
|
if ($result === null) return false;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function resumeByWS() {
|
||||||
|
$dat = ctx()->getData();
|
||||||
|
$last = null;
|
||||||
|
SpinLock::lock("wait_api");
|
||||||
|
$all = LightCacheInside::get("wait_api", "wait_api") ?? [];
|
||||||
|
foreach ($all as $k => $v) {
|
||||||
|
if(!isset($v["compare"])) continue;
|
||||||
|
foreach ($v["compare"] as $vs) {
|
||||||
|
if ($v[$vs] != ($dat[$vs] ?? null)) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$last = $k;
|
||||||
|
}
|
||||||
|
if($last !== null) {
|
||||||
|
$all[$last]["result"] = $dat;
|
||||||
|
LightCacheInside::set("wait_api", "wait_api", $all);
|
||||||
|
SpinLock::unlock("wait_api");
|
||||||
|
if ($all[$last]["worker_id"] != server()->worker_id) {
|
||||||
|
ZMUtil::sendActionToWorker($all[$k]["worker_id"], "resume_ws_message", $all[$last]);
|
||||||
|
} else {
|
||||||
|
Co::resume($all[$last]["coroutine"]);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
SpinLock::unlock("wait_api");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,4 +51,8 @@ class ZMUtil
|
|||||||
return ZMBuf::$instance[$class];
|
return ZMBuf::$instance[$class];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sendActionToWorker($target_id, $action, $data) {
|
||||||
|
server()->sendMessage(json_encode(["action" => $action, "data" => $data]), $target_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user