Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 154d9d74d6 | |||
| 2c61abff01 | |||
| b4ce762cf3 | |||
| 4b3c2234af | |||
| 7ee78a9642 | |||
| f9838f781d | |||
| 848416af4f | |||
| 0216e761be | |||
| acf6631c5c | |||
| 64e4307a57 | |||
| ab672127e6 | |||
| 6e5b545a1e | |||
| 8229395e6d |
+843
-820
File diff suppressed because it is too large
Load Diff
+25
-6
@@ -24,10 +24,13 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
public static function setContext($id, $context, $coroutineId = null): mixed
|
public static function setContext($id, $context, $coroutineId = null): mixed
|
||||||
{
|
{
|
||||||
if (Coroutine::getCid() === -1) {
|
if (is_null($coroutineId)) {
|
||||||
return static::$_contents[$id] = $context;
|
$coroutineId = Coroutine::getCid();
|
||||||
}
|
}
|
||||||
return Coroutine::getContext($coroutineId)[$id] = $context;
|
if (Coroutine::getCid() !== -1) {
|
||||||
|
return Coroutine::getContext($coroutineId)[$id] = $context;
|
||||||
|
}
|
||||||
|
return static::$_contents[$id] = $context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,6 +41,9 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
public static function increment($id, int $value = 1, $coroutineId = null): bool|int
|
public static function increment($id, int $value = 1, $coroutineId = null): bool|int
|
||||||
{
|
{
|
||||||
|
if (is_null($coroutineId)) {
|
||||||
|
$coroutineId = Coroutine::getCid();
|
||||||
|
}
|
||||||
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
||||||
Coroutine::getContext($coroutineId)[$id] = 0;
|
Coroutine::getContext($coroutineId)[$id] = 0;
|
||||||
}
|
}
|
||||||
@@ -52,6 +58,9 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
public static function decrement($id, int $value = 1, $coroutineId = null): bool|int
|
public static function decrement($id, int $value = 1, $coroutineId = null): bool|int
|
||||||
{
|
{
|
||||||
|
if (is_null($coroutineId)) {
|
||||||
|
$coroutineId = Coroutine::getCid();
|
||||||
|
}
|
||||||
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
||||||
Coroutine::getContext($coroutineId)[$id] = 0;
|
Coroutine::getContext($coroutineId)[$id] = 0;
|
||||||
}
|
}
|
||||||
@@ -81,6 +90,9 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
private static function loadByContext($id, $default = null, $coroutineId = null): mixed
|
private static function loadByContext($id, $default = null, $coroutineId = null): mixed
|
||||||
{
|
{
|
||||||
|
if (is_null($coroutineId)) {
|
||||||
|
$coroutineId = Coroutine::getCid();
|
||||||
|
}
|
||||||
return Coroutine::getContext($coroutineId)[$id] ?? $default;
|
return Coroutine::getContext($coroutineId)[$id] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +127,9 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
public static function remove(string $id, $coroutineId = null)
|
public static function remove(string $id, $coroutineId = null)
|
||||||
{
|
{
|
||||||
|
if (is_null($coroutineId)) {
|
||||||
|
$coroutineId = Coroutine::getCid();
|
||||||
|
}
|
||||||
if (!static::hasContext($id, $coroutineId)) {
|
if (!static::hasContext($id, $coroutineId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -165,11 +180,15 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
private static function searchByCoroutine($id, $key = null, $coroutineId = null): bool
|
private static function searchByCoroutine($id, $key = null, $coroutineId = null): bool
|
||||||
{
|
{
|
||||||
|
if (is_null($coroutineId)) {
|
||||||
|
$coroutineId = Coroutine::getCid();
|
||||||
|
}
|
||||||
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($key !== null) {
|
$value = Coroutine::getContext($coroutineId)[$id];
|
||||||
return isset((Coroutine::getContext($coroutineId)[$id] ?? [])[$key]);
|
if ($key !== null && is_array($value)) {
|
||||||
|
return isset($value[$key]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ class Json
|
|||||||
{
|
{
|
||||||
$params['code'] = $code;
|
$params['code'] = $code;
|
||||||
if (!is_string($message)) {
|
if (!is_string($message)) {
|
||||||
$params['param'] = $message;
|
$params['message'] = 'System success.';
|
||||||
if (!empty($data)) {
|
$params['param'] = $message;
|
||||||
$params['exPageInfo'] = $data;
|
if (!empty($data)) {
|
||||||
}
|
$params['exPageInfo'] = $data;
|
||||||
$params['message'] = 'System success.';
|
}
|
||||||
} else {
|
} else {
|
||||||
$params['message'] = $message;
|
$params['message'] = $message;
|
||||||
$params['param'] = $data;
|
$params['param'] = $data;
|
||||||
|
|||||||
+3
-3
@@ -68,7 +68,7 @@ class Gii
|
|||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$make = $this->input->getArgument('action');
|
$make = $this->input->getOption('make');
|
||||||
if (empty($make)) {
|
if (empty($make)) {
|
||||||
throw new Exception('构建类型不能为空~');
|
throw new Exception('构建类型不能为空~');
|
||||||
}
|
}
|
||||||
@@ -120,8 +120,8 @@ class Gii
|
|||||||
private function makeByDatabases($make, InputInterface $input): array
|
private function makeByDatabases($make, InputInterface $input): array
|
||||||
{
|
{
|
||||||
$redis = Kiri::getDi()->get(Redis::class);
|
$redis = Kiri::getDi()->get(Redis::class);
|
||||||
if ($input->hasArgument('name')) {
|
if ($input->hasOption('name')) {
|
||||||
$this->tableName = $input->getArgument('name');
|
$this->tableName = $input->getOption('name');
|
||||||
$redis->del('column:' . $this->tableName);
|
$redis->del('column:' . $this->tableName);
|
||||||
}
|
}
|
||||||
return match ($make) {
|
return match ($make) {
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ class GiiCommand extends Command
|
|||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('sw:gii')
|
$this->setName('sw:gii')
|
||||||
->addArgument('action', InputArgument::REQUIRED)
|
->addOption('make','m', InputArgument::OPTIONAL)
|
||||||
->addArgument('name', InputArgument::OPTIONAL)
|
->addOption('name','t', InputArgument::OPTIONAL)
|
||||||
->addArgument('databases', InputArgument::OPTIONAL)
|
->addOption('databases','d', InputArgument::OPTIONAL)
|
||||||
->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx');
|
->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,12 +52,12 @@ class GiiCommand extends Command
|
|||||||
$gii = Kiri::app()->get('gii');
|
$gii = Kiri::app()->get('gii');
|
||||||
|
|
||||||
$connections = Kiri::app()->get('db');
|
$connections = Kiri::app()->get('db');
|
||||||
if (($db = $input->getArgument('databases')) != null) {
|
if (($db = $input->getOption('databases')) != null) {
|
||||||
$gii->run($connections->get($db), $input);
|
$gii->run($connections->get($db), $input);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $input->getArgument('action');
|
$action = $input->getOption('make');
|
||||||
if (!in_array($action, ['model', 'controller'])) {
|
if (!in_array($action, ['model', 'controller'])) {
|
||||||
$gii->run(null, $input);
|
$gii->run(null, $input);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ abstract class Attribute implements INote
|
|||||||
* @param mixed|string $method
|
* @param mixed|string $method
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function execute(mixed $class, mixed $method = ''): mixed
|
public function execute(mixed $class, mixed $method = ''): mixed
|
||||||
{
|
{
|
||||||
// TODO: Implement execute() method.
|
// TODO: Implement execute() method.
|
||||||
|
|||||||
Reference in New Issue
Block a user