update to 2.0.0-b3

This commit is contained in:
jerry 2020-11-22 19:18:23 +08:00
parent c460b37d14
commit 8edc3f337b
11 changed files with 53 additions and 71 deletions

4
.gitignore vendored
View File

@ -6,3 +6,7 @@ zm.json
/zm_data/
composer.lock
/resources/server.phar
/distribute/
/bin/.phpunit.result.cache
/resources/zhamao.service
.phpunit.result.cache

View File

@ -1,28 +1,3 @@
FROM ubuntu:18.04
WORKDIR /app/
RUN echo "Asia/Shanghai" > /etc/timezone
ENV LANG C.UTF_8
ENV LC_ALL C.UTF-8
ENV LANGUAGE C.UTF-8
FROM zmbot/swoole:latest
RUN apt-get update && apt-get install -y software-properties-common tzdata
RUN dpkg-reconfigure -f noninteractive tzdata
VOLUME ["/app/zhamao-framework/"]
RUN add-apt-repository ppa:ondrej/php &&
apt-get update && \
apt-get install php php-dev php-mbstring gcc make openssl php-mbstring php-json php-curl php-mysql -y && \
apt-get install wget composer -y && \
wget https://github.com/swoole/swoole-src/archive/v4.5.0.tar.gz && \
tar -zxvf v4.5.0.tar.gz && \
cd swoole-src-4.5.0/ && \
phpize && ./configure --enable-openssl --enable-mysqlnd && make -j2 && make install && \
(echo "extension=swoole.so" >> $(php -i | grep "Loaded Configuration File" | awk '{print $5}'))
ADD . /app/zhamao-framework
ADD . /app/zhamao-framework-bak
#RUN cd /app/zhamao-framework && composer update && composer clearcache
#RUN mv zhamao-framework-master zhamao-framework
WORKDIR /app/zhamao-framework
CMD ["/bin/bash", "-i", "/app/zhamao-framework-bak/.entry.sh"]
# TODO: auto-setup entrypoint

View File

@ -4,8 +4,9 @@
| Version | Supported |
| ------- | ------------------ |
| 1.2.x | :white_check_mark: |
| 1.1.x | :x: |
| 2.0 | :white_check_mark: |
| 1.6.x | :white_check_mark: |
| 1.1.x | :x: |
| 1.0.x | :x: |
## Reporting a Vulnerability

View File

@ -3,7 +3,7 @@
"description": "High performance QQ robot and web server development framework",
"minimum-stability": "stable",
"license": "Apache-2.0",
"version": "2.0.0-b1",
"version": "2.0.0-b3",
"authors": [
{
"name": "whale",
@ -66,10 +66,6 @@
{
"type": "path",
"url": "/Users/jerry/project/git-project/zhamao-console"
},
{
"type": "path",
"url": "/Users/jerry/project/git-project/zhamao-lock"
}
]
}

View File

@ -1,17 +0,0 @@
FROM richardchien/cqhttp:latest
RUN apt-get update && apt-get install -y software-properties-common tzdata
RUN dpkg-reconfigure -f noninteractive tzdata
RUN add-apt-repository ppa:ondrej/php && \
apt-get update && \
apt-get install php php-dev php-mbstring gcc make openssl php-mbstring php-json php-curl php-mysql -y && \
apt-get install wget composer -y && \
wget https://github.com/swoole/swoole-src/archive/v4.5.0.tar.gz && \
tar -zxvf v4.5.0.tar.gz && \
cd swoole-src-4.5.0/ && \
phpize && ./configure --enable-openssl --enable-mysqlnd && make -j2 && make install && \
(echo "extension=swoole.so" >> $(php -i | grep "Loaded Configuration File" | awk '{print $5}'))
ADD start.sh /home/user/start.sh
RUN chown user:user /home/user/start.sh && chmod +x /home/user/start.sh
ADD https://github.com/zhamao-robot/zhamao-framework/archive/master.zip /home/user/master.zip
RUN chown user:user /home/user/master.zip && chmod 777 /home/user/master.zip
VOLUME ["/home/user/coolq","/home/user/zhamao-framework"]

View File

@ -1,6 +0,0 @@
#!/bin/bash
unzip master.zip
mv zhamao-framework-master/* zhamao-framework/
cd zhamao-framework
php bin/start

View File

@ -1,3 +0,0 @@
# 我需要做什么
文档还在写,不急!!

View File

@ -1,22 +1,39 @@
# 介绍
炸毛框架由 php-swoole 构建而来,主要面向 API 服务聊天机器人CQHTTP 对接),包含 websocket、http 等监听和请求库,用户代码采用模块化处理,可以方便地编写各类功能。
炸毛框架使用 PHP 编写,采用 Swoole 扩展为基础,主要面向 API 服务聊天机器人CQHTTP 对接),包含 websocket、http 等监听和请求库,用户代码采用模块化处理,使用注解可以方便地编写各类功能。
框架主要用途为 HTTP 服务器,机器人搭建框架。尤其对于 QQ 机器人消息处理较为方便和全面,提供了众多会话机制和内部调用机制,可以以各种方式设计你自己的模块。
在 HTTP 和 WebSocket 服务器上PHP 的扩展 Swoole 提供了高性能的支持,使其效率可媲美 nginx 静态网页处理的效率。
此外QQ 机器人方面此框架基于 OneBot 标准 的反向 WebSocket 连接,比传统 HTTP 通信更快,未来也会兼容微信公众号开发者模式。
此外QQ 机器人方面此框架基于 OneBot 标准的反向 WebSocket 连接,比传统 HTTP 通信更快,未来也会兼容微信公众号开发者模式。
```php
/**
* @CQCommand("你好")
*/
public function hello() {
ctx()->reply("你好,我是炸毛!");
}
/**
* @RequestMapping("/index")
*/
public function index() {
return "<h1>hello!</h1>";
}
```
## 开始前
因为框架采用的是 Swoole 的方式来运作的,所以和传统的 php-fpm 处理机制 **完全不同**。你可以参考 Python 的 [aiocqhttp](https://github.com/richardchien/python-aiocqhttp) SDK运行方式为 cli 环境。
在项目运行过程中,会启动 Master、Reactor、Worker 和 TaskWorker 多个进程,在一般情况下,**你不需要知道这些进程是什么,有什么区别**,除非想学习进程间通信和将框架设为多进程运行模式(框架默认采用单进程多协程运行)。
首先,你需要了解你需要知道哪些事情才能开始着手使用框架:
若使用本框架只作为机器人框架的话,建议将本框架部署到和 OneBot 标准的客户端同一台服务器上,以减少延迟和断链等网络问题带来的效率影响。
1. Linux 命令行基础
2. php 7.2+ 开发环境
3. HTTP 协议(可选)
4. OneBot 机器人聊天接口标准(可选)
!!! note "给开发者的提示"
本文档的 **指南** 部分是对框架内各个部分的详细说明,请仔细阅读指南的各个部分后,根据自己的需要选择阅读 **框架组件****注解事件** 部分。如果对框架还迷糊,可以在阅读完 **指南** 部分后阅读 **进阶** 篇,去了解怎么完成一个功能。
需要值得注意的是,本教程中所涉及的内容均为尽可能翻译为白话的方式进行描述,但对于框架的组件或事件等需要单独拆分说明文档的部分则需要足够详细,所以本教程提供一个快速上手的教程,并且会将最典型的安装方式写到快速教程篇。
## 框架特色

View File

@ -1,2 +1,9 @@
hljs.initHighlighting()
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3d2aafad13637de271f50351e873b776";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();

View File

@ -18,14 +18,23 @@ extra_css:
markdown_extensions:
- admonition
- pymdownx.tabbed
- pymdownx.superfences
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.highlight:
linenums: true
linenums_style: pymdownx.inline
copyright: 'Copyright &copy; 2019 - 2020 CrazyBot Team'
nav:
- 指南:
- 介绍: index.md
- 我需要做什么: guide/我需要做什么.md
- 安装框架: guide/安装.md
- 快速上手(机器人篇): guide/快速上手-机器人.md
- 快速上手HTTP篇: guide/快速上手-http.md
- 选择聊天机器人实例: guide/OneBot实例.md
- 基本配置: guide/基本配置.md
- 事件和注解:
- 事件和注解: event/index.md
- 框架组件:

View File

@ -38,8 +38,7 @@ class Terminal
case 'psysh':
if (Framework::$argv["disable-coroutine"]) {
(new Shell())->run();
}
else
} else
Console::error("Only \"--disable-coroutine\" mode can use psysh!!!");
return true;
case 'bc':