mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-03 06:45:36 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3d64c8f06 | ||
|
|
f0cba01bd7 | ||
|
|
ea83ea2cce | ||
|
|
21f310852a | ||
|
|
6173cf2e37 | ||
|
|
4791099a78 | ||
|
|
9d1952f5f8 | ||
|
|
6543574695 | ||
|
|
5b1c771a2d | ||
|
|
29d7d07c8e | ||
|
|
e85e1e57b1 | ||
|
|
90a4c6803e |
@@ -50,6 +50,8 @@ $config['runtime'] = [
|
||||
],
|
||||
'namespace' => [],
|
||||
],
|
||||
'inside_table_size' => 65536 // 内部表字符串最大长度(需要2的倍数)
|
||||
// 正常不要低于65536,如果群数量过多可能出现会size不够。若swoole日志出现WARNING TableRow::set_value(): [key=wait_api,field=value]string value is too long可以将该值往大设置。
|
||||
];
|
||||
|
||||
/* 轻量字符串缓存,默认开启 */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const apiConfig = require('./api')
|
||||
|
||||
module.exports = {
|
||||
title: '炸毛框架',
|
||||
title: '炸毛框架(v2 旧版)',
|
||||
description: '一个高性能聊天机器人 + Web 框架',
|
||||
theme: 'antdocs',
|
||||
markdown: {
|
||||
@@ -34,7 +34,7 @@ module.exports = {
|
||||
{ text: 'API', link: '/api/' },
|
||||
{ text: 'FAQ', link: '/faq/' },
|
||||
{ text: '更新日志', link: '/update/v2/' },
|
||||
{ text: '炸毛框架 v1', link: 'https://docs-v1.zhamao.xin/' }
|
||||
{ text: '炸毛框架 v3(最新版)', link: 'https://framework.zhamao.xin/' }
|
||||
],
|
||||
sidebar: {
|
||||
'/guide/': [
|
||||
|
||||
@@ -1 +1 @@
|
||||
framework.zhamao.me
|
||||
docs-v2.zhamao.me
|
||||
|
||||
@@ -105,6 +105,8 @@ class AnnotationParser
|
||||
}
|
||||
*/
|
||||
|
||||
// 保留ergodic注解
|
||||
$append_ergodics = [];
|
||||
// 生成主树
|
||||
$this->annotation_map[$v]['class_annotations'] = $class_annotations;
|
||||
$this->annotation_map[$v]['methods'] = $methods;
|
||||
@@ -120,7 +122,8 @@ class AnnotationParser
|
||||
foreach (($this->annotation_map[$v]['methods'] ?? []) as $method) {
|
||||
$copy = clone $vs;
|
||||
$copy->method = $method->getName();
|
||||
$this->annotation_map[$v]['methods_annotations'][$method->getName()][] = $copy;
|
||||
$append_ergodics[$method->getName()][] = $copy;
|
||||
// $this->annotation_map[$v]['methods_annotations'][$method->getName()][] = $copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +142,13 @@ class AnnotationParser
|
||||
|
||||
$inserted = [];
|
||||
|
||||
// 预处理:将Class的ergodic注解拼接到每个方法的注解列表前面,且按照顺序(修复 #365)
|
||||
foreach (($this->annotation_map[$v]['methods_annotations'] ?? []) as $method_name => $annos) {
|
||||
if (isset($append_ergodics[$method_name])) {
|
||||
$this->annotation_map[$v]['methods_annotations'][$method_name] = array_merge($append_ergodics[$method_name], $annos);
|
||||
}
|
||||
}
|
||||
|
||||
// 预处理3:处理每个函数上面的特殊注解,就是需要操作一些东西的
|
||||
foreach (($this->annotation_map[$v]['methods_annotations'] ?? []) as $method_name => $methods_annotations) {
|
||||
foreach ($methods_annotations as $method_anno) {
|
||||
|
||||
@@ -28,9 +28,9 @@ use ZM\Exception\InitException;
|
||||
|
||||
class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION_ID = 479;
|
||||
public const VERSION_ID = 480;
|
||||
|
||||
public const VERSION = '2.8.5';
|
||||
public const VERSION = '2.8.10';
|
||||
|
||||
private static $obj;
|
||||
|
||||
|
||||
@@ -130,6 +130,15 @@ class OnWorkerStart implements SwooleEvent
|
||||
Framework::saveProcessState(ZM_PROCESS_TASKWORKER, $server->worker_pid, ['worker_id' => $worker_id]);
|
||||
try {
|
||||
Framework::$server = $server;
|
||||
$this->initMySQLPool();
|
||||
$redis = ZMConfig::get('global', 'redis_config');
|
||||
if ($redis !== null && $redis['host'] != '') {
|
||||
if (!extension_loaded('redis')) {
|
||||
Console::error(zm_internal_errcode('E00029') . "Can not find redis extension.\n");
|
||||
} else {
|
||||
ZMRedisPool::init($redis);
|
||||
}
|
||||
}
|
||||
$this->loadAnnotations();
|
||||
Console::success('TaskWorker #' . $server->worker_id . ' started');
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class LightCache
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$result = self::$kv_table->set($k, [
|
||||
$result = self::$kv_table->set((string) $k, [
|
||||
'value' => $value,
|
||||
'expire' => $v['expire'],
|
||||
'data_type' => $data_type,
|
||||
@@ -188,6 +188,9 @@ class LightCache
|
||||
$data_type = '';
|
||||
} elseif (is_int($value)) {
|
||||
$data_type = 'int';
|
||||
} elseif (is_bool($value)) {
|
||||
$data_type = 'bool';
|
||||
$value = json_encode($value);
|
||||
} else {
|
||||
throw new LightCacheException('E00048', 'Only can set string, array and int');
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace ZM\Store;
|
||||
|
||||
use Exception;
|
||||
use Swoole\Table;
|
||||
use ZM\Config\ZMConfig;
|
||||
use ZM\Exception\LightCacheException;
|
||||
use ZM\Exception\ZMException;
|
||||
|
||||
@@ -17,7 +18,8 @@ class LightCacheInside
|
||||
public static function init(): bool
|
||||
{
|
||||
try {
|
||||
self::createTable('wait_api', 3, 65536);
|
||||
$size = ZMConfig::get('global', 'runtime')['inside_table_size'] ?? 65536;
|
||||
self::createTable('wait_api', 3, $size);
|
||||
self::createTable('connect', 3, 64); // 用于存单机器人模式下的机器人fd的
|
||||
self::createTable('static_route', 64, 256); // 用于存储
|
||||
self::createTable('light_array', 8, 512, 0.6);
|
||||
|
||||
Reference in New Issue
Block a user