作者 吴子俊

创建项目

  1 +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn
  1 +/.idea
  2 +/.vscode
  3 +/vendor
  4 +*.log
  5 +.env
  1 +sudo: false
  2 +
  3 +language: php
  4 +
  5 +branches:
  6 + only:
  7 + - stable
  8 +
  9 +cache:
  10 + directories:
  11 + - $HOME/.composer/cache
  12 +
  13 +before_install:
  14 + - composer self-update
  15 +
  16 +install:
  17 + - composer install --no-dev --no-interaction --ignore-platform-reqs
  18 + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
  19 + - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
  20 + - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
  21 + - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
  22 + - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
  23 + - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
  24 + - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
  25 + - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
  26 + - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
  27 + - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
  28 + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
  29 +
  30 +script:
  31 + - php think unit
  32 +
  33 +deploy:
  34 + provider: releases
  35 + api_key:
  36 + secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
  37 + file:
  38 + - ThinkPHP_Core.zip
  39 + - ThinkPHP_Full.zip
  40 + skip_cleanup: true
  41 + on:
  42 + tags: true
  1 +
  2 +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
  3 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
  4 +All rights reserved。
  5 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
  6 +
  7 +Apache Licence是著名的非盈利开源组织Apache采用的协议。
  8 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
  9 +允许代码修改,再作为开源或商业软件发布。需要满足
  10 +的条件:
  11 +1. 需要给代码的用户一份Apache Licence ;
  12 +2. 如果你修改了代码,需要在被修改的文件中说明;
  13 +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
  14 +带有原来代码中的协议,商标,专利声明和其他原来作者规
  15 +定需要包含的说明;
  16 +4. 如果再发布的产品中包含一个Notice文件,则在Notice文
  17 +件中需要带有本协议内容。你可以在Notice中增加自己的
  18 +许可,但不可以表现为对Apache Licence构成更改。
  19 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
  20 +
  21 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24 +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25 +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26 +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27 +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28 +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30 +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31 +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32 +POSSIBILITY OF SUCH DAMAGE.
  1 +ThinkPHP 6.0
  2 +===============
  3 +
  4 +> 运行环境要求PHP7.1+。
  5 +
  6 +## 主要新特性
  7 +
  8 +* 采用`PHP7`强类型(严格模式)
  9 +* 支持更多的`PSR`规范
  10 +* 原生多应用支持
  11 +* 更强大和易用的查询
  12 +* 全新的事件系统
  13 +* 模型事件和数据库事件统一纳入事件系统
  14 +* 模板引擎分离出核心
  15 +* 内部功能中间件化
  16 +* SESSION/Cookie机制改进
  17 +* 对Swoole以及协程支持改进
  18 +* 对IDE更加友好
  19 +* 统一和精简大量用法
  20 +
  21 +## 安装
  22 +
  23 +~~~
  24 +composer create-project topthink/think tp 6.0.*
  25 +~~~
  26 +
  27 +如果需要更新框架使用
  28 +~~~
  29 +composer update topthink/framework
  30 +~~~
  31 +
  32 +## 文档
  33 +
  34 +[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
  35 +
  36 +## 参与开发
  37 +
  38 +请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)
  39 +
  40 +## 版权信息
  41 +
  42 +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
  43 +
  44 +本项目包含的第三方源码和二进制文件之版权信息另行标注。
  45 +
  46 +版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
  47 +
  48 +All rights reserved。
  49 +
  50 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
  51 +
  52 +更多细节参阅 [LICENSE.txt](LICENSE.txt)
  1 +deny from all
  1 +<?php
  2 +declare (strict_types = 1);
  3 +
  4 +namespace app;
  5 +
  6 +use think\Service;
  7 +
  8 +/**
  9 + * 应用服务类
  10 + */
  11 +class AppService extends Service
  12 +{
  13 + public function register()
  14 + {
  15 + // 服务注册
  16 + }
  17 +
  18 + public function boot()
  19 + {
  20 + // 服务启动
  21 + }
  22 +}
  1 +<?php
  2 +declare (strict_types = 1);
  3 +
  4 +namespace app;
  5 +
  6 +use think\App;
  7 +use think\exception\ValidateException;
  8 +use think\Validate;
  9 +
  10 +/**
  11 + * 控制器基础类
  12 + */
  13 +abstract class BaseController
  14 +{
  15 + /**
  16 + * Request实例
  17 + * @var \think\Request
  18 + */
  19 + protected $request;
  20 +
  21 + /**
  22 + * 应用实例
  23 + * @var \think\App
  24 + */
  25 + protected $app;
  26 +
  27 + /**
  28 + * 是否批量验证
  29 + * @var bool
  30 + */
  31 + protected $batchValidate = false;
  32 +
  33 + /**
  34 + * 控制器中间件
  35 + * @var array
  36 + */
  37 + protected $middleware = [];
  38 +
  39 + /**
  40 + * 构造方法
  41 + * @access public
  42 + * @param App $app 应用对象
  43 + */
  44 + public function __construct(App $app)
  45 + {
  46 + $this->app = $app;
  47 + $this->request = $this->app->request;
  48 +
  49 + // 控制器初始化
  50 + $this->initialize();
  51 + }
  52 +
  53 + // 初始化
  54 + protected function initialize()
  55 + {}
  56 +
  57 + /**
  58 + * 验证数据
  59 + * @access protected
  60 + * @param array $data 数据
  61 + * @param string|array $validate 验证器名或者验证规则数组
  62 + * @param array $message 提示信息
  63 + * @param bool $batch 是否批量验证
  64 + * @return array|string|true
  65 + * @throws ValidateException
  66 + */
  67 + protected function validate(array $data, $validate, array $message = [], bool $batch = false)
  68 + {
  69 + if (is_array($validate)) {
  70 + $v = new Validate();
  71 + $v->rule($validate);
  72 + } else {
  73 + if (strpos($validate, '.')) {
  74 + // 支持场景
  75 + [$validate, $scene] = explode('.', $validate);
  76 + }
  77 + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
  78 + $v = new $class();
  79 + if (!empty($scene)) {
  80 + $v->scene($scene);
  81 + }
  82 + }
  83 +
  84 + $v->message($message);
  85 +
  86 + // 是否批量验证
  87 + if ($batch || $this->batchValidate) {
  88 + $v->batch(true);
  89 + }
  90 +
  91 + return $v->failException(true)->check($data);
  92 + }
  93 +
  94 +}
  1 +<?php
  2 +namespace app;
  3 +
  4 +use think\db\exception\DataNotFoundException;
  5 +use think\db\exception\ModelNotFoundException;
  6 +use think\exception\Handle;
  7 +use think\exception\HttpException;
  8 +use think\exception\HttpResponseException;
  9 +use think\exception\ValidateException;
  10 +use think\Response;
  11 +use Throwable;
  12 +
  13 +/**
  14 + * 应用异常处理类
  15 + */
  16 +class ExceptionHandle extends Handle
  17 +{
  18 + /**
  19 + * 不需要记录信息(日志)的异常类列表
  20 + * @var array
  21 + */
  22 + protected $ignoreReport = [
  23 + HttpException::class,
  24 + HttpResponseException::class,
  25 + ModelNotFoundException::class,
  26 + DataNotFoundException::class,
  27 + ValidateException::class,
  28 + ];
  29 +
  30 + /**
  31 + * 记录异常信息(包括日志或者其它方式记录)
  32 + *
  33 + * @access public
  34 + * @param Throwable $exception
  35 + * @return void
  36 + */
  37 + public function report(Throwable $exception): void
  38 + {
  39 + // 使用内置的方式记录异常日志
  40 + parent::report($exception);
  41 + }
  42 +
  43 + /**
  44 + * Render an exception into an HTTP response.
  45 + *
  46 + * @access public
  47 + * @param \think\Request $request
  48 + * @param Throwable $e
  49 + * @return Response
  50 + */
  51 + public function render($request, Throwable $e): Response
  52 + {
  53 + // 添加自定义异常处理机制
  54 +
  55 + // 其他错误交给系统处理
  56 + return parent::render($request, $e);
  57 + }
  58 +}
  1 +<?php
  2 +namespace app;
  3 +
  4 +// 应用请求对象类
  5 +class Request extends \think\Request
  6 +{
  7 +
  8 +}
  1 +<?php
  2 +// 应用公共文件
  1 +<?php
  2 +namespace app\controller;
  3 +use app\BaseController;
  4 +use GatewayClient\Gateway;
  5 +use Workerman\Worker;
  6 +use think\facade\Log;
  7 +use think\facade\Cache;
  8 +
  9 +class Index extends BaseController
  10 +{
  11 + public function index(){
  12 + $data_data_data = array('ownwe' => 'group_9','auto_login' => false,'password' => '密码', 'login_type' => '2', 'data62' => '62xxxxxxxxxxxxxxxxxxxxxxx', 'json' => '长环境', 'device_type' => '1', 'type' => 0, 'username' => '账号', 'lateset' =>false );
  13 + $data_data = array('data' => json_encode($data_data_data),'task_id' => '1', 'wxid' => '账号', 'timeInMillis' => time(), 'type' => 'login' );
  14 + $data = array('data' => json_encode(array($data_data)),'type' => 'task' );
  15 +
  16 +
  17 + //登录包
  18 + $data = array('type' => 'login', 'username' => '0085585623604', 'password' => 'bfefebf45e','json' => 'https://android-1257892566.cos.ap-guangzhou.myqcloud.com/android%5Fenv/0085585623604.txt','a16' => 'Adac9e7360d9731d','uuid' => 'aa002247ac3334e7a8c66561d39a5205');
  19 + //下线包
  20 + $data = array('type' => 'logout', 'username' => '0085585623604');
  21 + // 发送消息
  22 + $data = array('type' => 'textMsg', 'wxid' => '0085585623604', 'data' => '{"to":"wuzijun6647","content":"99999","msgSource":null}','msgId' => '4207702845635483641','agreement' => 1,"sign" => 'ng_send_services',"theme" => 'chat');
  23 + print_r(json_encode($data));
  24 + // print_r(cache('taskId_13'));
  25 + }
  26 +
  27 + public function hello($name = 'ThinkPHP6'){
  28 + return 'hello,' . $name;
  29 + }
  30 +
  31 + // test队列kafka消费者挂载
  32 + public function kafka_test(){
  33 + //设置消费分组名称kafka地址
  34 + $conf = new \RdKafka\Conf();
  35 + $conf->set('group.id', 'group_1');
  36 + $conf->set('metadata.broker.list', '47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092');
  37 + //运行消费者队列
  38 + $consumer = new \RdKafka\KafkaConsumer($conf);
  39 + $consumer->subscribe(['text']);
  40 + //开启循环
  41 + while (true) {
  42 + $message = $consumer->consume(3e3);
  43 + switch ($message->err) {
  44 + case RD_KAFKA_RESP_ERR_NO_ERROR:
  45 + // 打印成功接收的消费者消息log
  46 + trace($message->payload,'consumer');
  47 + // 获取到消息发送到workerman
  48 + $res = $this->send_ws($message->payload);
  49 + break;
  50 + case RD_KAFKA_RESP_ERR__PARTITION_EOF:
  51 + sleep(2);
  52 + case RD_KAFKA_RESP_ERR__TIMED_OUT:
  53 + // 超时不做操作
  54 + // echo $message->errstr() . PHP_EOL;
  55 + break;
  56 + default:
  57 + //补获异常
  58 + throw new \Exception($message->errstr(), $message->err);
  59 + break;
  60 + }
  61 + }
  62 + }
  63 +
  64 + // test队列kafka消费者挂载
  65 + public function kafka_login(){
  66 + //设置消费分组名称kafka地址
  67 + $conf = new \RdKafka\Conf();
  68 + $conf->set('group.id', 'group_1');
  69 + $conf->set('metadata.broker.list', '47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092');
  70 + //运行消费者队列
  71 + $consumer = new \RdKafka\KafkaConsumer($conf);
  72 + $consumer->subscribe(['login']);
  73 + //开启循环
  74 + while (true) {
  75 + $message = $consumer->consume(3e3);
  76 + switch ($message->err) {
  77 + case RD_KAFKA_RESP_ERR_NO_ERROR:
  78 + // 打印成功接收的消费者消息log
  79 + trace($message->payload,'consumer');
  80 + // 获取到消息发送到workerman
  81 + $res = $this->send_ws_login($message->payload);
  82 + break;
  83 + case RD_KAFKA_RESP_ERR__PARTITION_EOF:
  84 + sleep(2);
  85 + case RD_KAFKA_RESP_ERR__TIMED_OUT:
  86 + // 超时不做操作
  87 + // echo $message->errstr() . PHP_EOL;
  88 + break;
  89 + default:
  90 + //补获异常
  91 + throw new \Exception($message->errstr(), $message->err);
  92 + break;
  93 + }
  94 + }
  95 + }
  96 +
  97 + //发送消息到workerman
  98 + public function send_ws($data){
  99 + // 建立socket连接到内部推送端口
  100 + $client = stream_socket_client('tcp://127.0.0.1:5678', $errno, $errmsg, 1);
  101 + // 推送的数据,包含uid字段,表示是给这个uid推送
  102 + $send = array('id'=>1, 'message'=>$data);
  103 + // 发送数据,注意5678端口是Text协议的端口,Text协议需要在数据末尾加上换行符
  104 + fwrite($client, json_encode($send)."\n");
  105 + // 读取推送结果
  106 + $res = str_replace("\n","",fread($client, 8192));
  107 + // 打印发送消息返回LOG
  108 + trace($res,'consumer');
  109 + }
  110 +
  111 + //发送消息到workerman
  112 + public function send_ws_login($data){
  113 + // 建立socket连接到内部推送端口
  114 + $client = stream_socket_client('tcp://127.0.0.1:5678', $errno, $errmsg, 1);
  115 + // 推送的数据,包含uid字段,表示是给这个uid推送
  116 + $res = json_decode($data,true);
  117 + // 判断类型组包
  118 + if ($res['type'] == 'login') {
  119 + $data_data_data = array('ownwe' => 'group_9','auto_login' => false,'password' => md5($res['password']), 'login_type' => '2', 'a16' => $res['a16'], 'json' => $res['json'], 'device_type' => '0', 'type' => 0, 'username' => $res['username'], 'lateset' =>false );
  120 + $data_data = array('data' => json_encode($data_data_data),'task_id' => '1', 'wxid' => $res['username'], 'timeInMillis' => time(), 'type' => 'login' );
  121 + $data = array('data' => json_encode(array($data_data)),'type' => 'task' );
  122 + //取出uuid对应的服务端ID
  123 + $id = cache('ws_'.$res['uuid']);
  124 + }elseif ($res['type'] == 'logout') {
  125 + $id = cache('ws_'.$res['username']);
  126 + $data = array('type' => 'logout', 'data' => $res['username'], 'timeInMillis' => time());
  127 + }
  128 + trace(json_encode(array('id'=>$id, 'message'=>$data)),'consumer');
  129 + if($id){
  130 + // 发送数据,注意5678端口是Text协议的端口,Text协议需要在数据末尾加上换行符
  131 + fwrite($client, json_encode(array('id'=>$id, 'message'=>$data))."\n");
  132 + // 读取推送结果
  133 + $res = str_replace("\n","",fread($client, 8192));
  134 + }else{
  135 + $res = 'false';
  136 + }
  137 + // 打印发送消息返回LOG
  138 + trace($res,'consumer');
  139 + }
  140 +
  141 + //查看PHP版本是否有安装php-rdkafka,php-redis等插件
  142 + public function phpinfo(){
  143 + return phpinfo();
  144 + }
  145 +
  146 +
  147 + public function isOnline($uuid,$wxid){
  148 + //获取全部当前列表
  149 + $online = (array)cache($uuid.'_online');
  150 + return in_array($wxid,$online)?1:0;
  151 + }
  152 +}
  1 +<?php
  2 +namespace app\controller;
  3 +use app\BaseController;
  4 +use GatewayClient\Gateway;
  5 +use Workerman\Worker;
  6 +use think\facade\Log;
  7 +use think\facade\Cache;
  8 +
  9 +class KafkaCallback extends BaseController
  10 +{
  11 + public function kafka_callback(){
  12 + //设置消费分组名称kafka地址
  13 + $conf = new \RdKafka\Conf();
  14 + $conf->set('group.id', 'group_1');
  15 + $conf->set('metadata.broker.list', '47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092');
  16 + //运行消费者队列
  17 + $consumer = new \RdKafka\KafkaConsumer($conf);
  18 + $consumer->subscribe(['ng_chat_services']);
  19 + //开启循环
  20 + while (true) {
  21 + $message = $consumer->consume(3e3);
  22 + switch ($message->err) {
  23 + case RD_KAFKA_RESP_ERR_NO_ERROR:
  24 + // 打印成功接收的消费者消息log
  25 + trace($message->payload,'consumer');
  26 + // 获取到消息发送到workerman
  27 + $res = $this->send_ws_send($message->payload);
  28 + break;
  29 + case RD_KAFKA_RESP_ERR__PARTITION_EOF:
  30 + sleep(2);
  31 + case RD_KAFKA_RESP_ERR__TIMED_OUT:
  32 + // 超时不做操作
  33 + // echo $message->errstr() . PHP_EOL;
  34 + break;
  35 + default:
  36 + //补获异常
  37 + throw new \Exception($message->errstr(), $message->err);
  38 + break;
  39 + }
  40 + }
  41 + }
  42 +
  43 + //发送消息到workerman
  44 + public function send_ws_send($json_data){
  45 + }
  46 +
  47 + //判断在线状态
  48 + public function isOnline($uuid,$wxid){
  49 + //获取全部当前列表
  50 + $online = (array)cache($uuid.'_online');
  51 + return in_array($wxid,$online)?1:0;
  52 + }
  53 +}
  1 +<?php
  2 +namespace app\controller;
  3 +use app\BaseController;
  4 +use GatewayClient\Gateway;
  5 +use Workerman\Worker;
  6 +use think\facade\Log;
  7 +
  8 +class KafkaLogin extends BaseController
  9 +{
  10 + public function kafka_login(){
  11 + //设置消费分组名称kafka地址
  12 + $conf = new \RdKafka\Conf();
  13 + $conf->set('group.id', 'group_1');
  14 + $conf->set('metadata.broker.list', '47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092');
  15 + //运行消费者队列
  16 + $consumer = new \RdKafka\KafkaConsumer($conf);
  17 + $consumer->subscribe(['ng_login']);
  18 + //开启循环
  19 + while (true) {
  20 + $message = $consumer->consume(3e3);
  21 + switch ($message->err) {
  22 + case RD_KAFKA_RESP_ERR_NO_ERROR:
  23 + // 打印成功接收的消费者消息log
  24 + trace($message->payload,'consumer');
  25 + // 获取到消息发送到workerman
  26 + $res = $this->send_ws_login($message->payload);
  27 + break;
  28 + case RD_KAFKA_RESP_ERR__PARTITION_EOF:
  29 + sleep(2);
  30 + case RD_KAFKA_RESP_ERR__TIMED_OUT:
  31 + // 超时不做操作
  32 + // echo $message->errstr() . PHP_EOL;
  33 + break;
  34 + default:
  35 + //补获异常
  36 + throw new \Exception($message->errstr(), $message->err);
  37 + break;
  38 + }
  39 + }
  40 + }
  41 +
  42 + //发送消息到workerman
  43 + public function send_ws_login($data){
  44 + // 建立socket连接到内部推送端口
  45 + $client = stream_socket_client('tcp://127.0.0.1:5678', $errno, $errmsg, 1);
  46 + // 推送的数据,包含uid字段,表示是给这个uid推送
  47 + $res = json_decode($data,true);
  48 + // 判断类型组包
  49 + if ($res['type'] == 'login') {
  50 + //取出name对应的服务端ID
  51 + $id = cache($res['name']);
  52 + //组包安卓登录数据
  53 + $data_data_data = array('ownwe' => 'group_9','auto_login' => false,'password' => md5($res['password']), 'login_type' => '2', 'a16' => $res['a16'], 'json' => $res['json'], 'device_type' => '0', 'type' => 0, 'username' => $res['username'], 'lateset' =>false );
  54 + $data_data = array('data' => json_encode($data_data_data),'task_id' => '1', 'wxid' => $res['username'], 'timeInMillis' => time(), 'type' => 'login' );
  55 + $data = array('data' => json_encode(array($data_data)),'type' => 'task' );
  56 + }elseif ($res['type'] == 'logout') {
  57 + //判断是否存在用户
  58 + $name = cache($res['username']);
  59 + //判断在线
  60 + if($this->isOnline($name,$res['username'])){
  61 + $id = cache($name);
  62 + }else{
  63 + $id = '';
  64 + }
  65 + $data = array('type' => 'logout', 'data' => $res['username'], 'timeInMillis' => time());
  66 + }
  67 + trace(json_encode(array('id'=>$id, 'message'=>$data)),'consumer');
  68 + if($id){
  69 + // 发送数据,注意5678端口是Text协议的端口,Text协议需要在数据末尾加上换行符
  70 + fwrite($client, json_encode(array('id'=>$id, 'message'=>$data))."\n");
  71 + // 读取推送结果
  72 + $res = str_replace("\n","",fread($client, 8192));
  73 + }else{
  74 + $res = 'false';
  75 + }
  76 + // 打印发送消息返回LOG
  77 + trace($res,'consumer');
  78 + }
  79 +
  80 + //判断在线状态
  81 + public function isOnline($name,$wxid){
  82 + //获取全部当前列表
  83 + $online = (array)cache($name.'_online');
  84 + return in_array($wxid,$online)?1:0;
  85 + }
  86 +}
  1 +<?php
  2 +namespace app\controller;
  3 +use app\BaseController;
  4 +use GatewayClient\Gateway;
  5 +use Workerman\Worker;
  6 +use think\facade\Log;
  7 +use think\facade\Cache;
  8 +
  9 +class KafkaSend extends BaseController
  10 +{
  11 + public function kafka_send(){
  12 + //设置消费分组名称kafka地址
  13 + $conf = new \RdKafka\Conf();
  14 + $conf->set('group.id', 'group_1');
  15 + $conf->set('metadata.broker.list', '47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092');
  16 + //运行消费者队列
  17 + $consumer = new \RdKafka\KafkaConsumer($conf);
  18 + $consumer->subscribe(['ng_send_services']);
  19 + //开启循环
  20 + while (true) {
  21 + $message = $consumer->consume(3e3);
  22 + switch ($message->err) {
  23 + case RD_KAFKA_RESP_ERR_NO_ERROR:
  24 + // 打印成功接收的消费者消息log
  25 + trace($message->payload,'consumer');
  26 + // 获取到消息发送到workerman
  27 + $res = $this->send_ws_send($message->payload);
  28 + break;
  29 + case RD_KAFKA_RESP_ERR__PARTITION_EOF:
  30 + sleep(2);
  31 + case RD_KAFKA_RESP_ERR__TIMED_OUT:
  32 + // 超时不做操作
  33 + // echo $message->errstr() . PHP_EOL;
  34 + break;
  35 + default:
  36 + //补获异常
  37 + throw new \Exception($message->errstr(), $message->err);
  38 + break;
  39 + }
  40 + }
  41 + }
  42 +
  43 + //发送消息到workerman
  44 + public function send_ws_send($json_data){
  45 + // 建立socket连接到内部推送端口
  46 + $client = stream_socket_client('tcp://127.0.0.1:5678', $errno, $errmsg, 1);
  47 + // 推送的数据,包含uid字段,表示是给这个uid推送
  48 + $res = json_decode($json_data,true);
  49 + // 判断类型组包
  50 + if ($res['agreement'] == 1) {
  51 + // 获取当前taskId
  52 + $taskId = Cache::inc('taskId');
  53 + // 缓存taskId与消息ID
  54 + cache('taskId_'.$taskId,array($res['msgId'],$res['theme']), 300);
  55 + $data_data = array('type' => $res['type'], 'taskId' => $taskId, 'wxid' => $res['wxid'], 'date' => time(), 'data' => $res['data'], 'timeInMillis' => time());
  56 + $data = array('data' => json_encode(array($data_data)),'type' => 'task');
  57 + //取出name对应的服务端ID
  58 + //判断是否存在用户
  59 + $name = cache($res['wxid']);
  60 + //判断在线
  61 + if($this->isOnline($name,$res['wxid'])){
  62 + $id = cache($name);
  63 + }else{
  64 + $id = '';
  65 + }
  66 + trace(json_encode(array('id'=>$id, 'message'=>$data)),'consumer');
  67 + if($id){
  68 + // 发送数据,注意5678端口是Text协议的端口,Text协议需要在数据末尾加上换行符
  69 + fwrite($client, json_encode(array('id'=>$id, 'message'=>$data))."\n");
  70 + // 读取推送结果
  71 + $res = str_replace("\n","",fread($client, 8192));
  72 + }else{
  73 + $res = 'false';
  74 + }
  75 + // 打印发送消息返回LOG
  76 + trace($res,'consumer');
  77 + }else{
  78 + trace('协议暂未支持','consumer');
  79 + }
  80 + }
  81 +
  82 + //判断在线状态
  83 + public function isOnline($name,$wxid){
  84 + //获取全部当前列表
  85 + $online = (array)cache($name.'_online');
  86 + return in_array($wxid,$online)?1:0;
  87 + }
  88 +}
  1 +<?php
  2 +// 事件定义文件
  3 +return [
  4 + 'bind' => [
  5 + ],
  6 +
  7 + 'listen' => [
  8 + 'AppInit' => [],
  9 + 'HttpRun' => [],
  10 + 'HttpEnd' => [],
  11 + 'LogLevel' => [],
  12 + 'LogWrite' => [],
  13 + ],
  14 +
  15 + 'subscribe' => [
  16 + ],
  17 +];
  1 +<?php
  2 +namespace app\http;
  3 +
  4 +use think\worker\Server;
  5 +use think\facade\Env;
  6 +use think\facade\Queue;
  7 +
  8 +class Worker extends Server
  9 +{
  10 + protected $socket = 'websocket://0.0.0.0:8282';
  11 + protected $option = [
  12 + 'name' => 'thinkphp',
  13 + 'count' => 4,
  14 + ];
  15 + public $kafka;
  16 +
  17 + public function onWorkerStart($connection)
  18 + {
  19 + //开启kafka
  20 + $rk = new \RdKafka\Producer();
  21 + $rk->addBrokers("47.112.163.25:9092,47.112.185.243:9092,47.112.189.251:9092");
  22 + $this->kafka = $rk;
  23 +
  24 +
  25 + $server = $this->worker;
  26 + // 开启一个内部端口,方便内部系统推送数据,Text协议格式 文本+换行符
  27 + $inner_text_worker = new \Workerman\Worker('Text://0.0.0.0:5678');
  28 + // print_r($inner_text_worker);
  29 + $inner_text_worker->onMessage = function($connection, $buffer)use($server)
  30 + {
  31 + // $data数组格式,里面有uid,表示向那个uid的页面推送数据
  32 + $data = json_decode($buffer, true);
  33 + // 通过workerman,向id的页面推送数据
  34 + $ret = '';
  35 + if($server->connections){
  36 + foreach ($server->connections as $_connection ){
  37 + if ($data['id'] == $_connection->id) {
  38 + $ret = $_connection->send(json_encode($data['message']));
  39 + }
  40 + }
  41 + }
  42 + // 返回推送结果
  43 + $connection->send($ret ? 'ok' : 'fail');
  44 + };
  45 + $inner_text_worker->listen();
  46 + }
  47 +
  48 + public function onMessage($connection,$data)
  49 + {
  50 + $data = json_decode($data,true);
  51 + print_r($data);
  52 + //接收到发送的消息发送出去kafka
  53 + if(isset($data['sign']) && $data['sign'] == 'ng_send_services'){
  54 + // kafka推送->send类型
  55 + trace('producer->'.json_encode($data), 'producer');
  56 + $topic = $this->kafka->newTopic("ng_send_services");
  57 + $topic->produce(RD_KAFKA_PARTITION_UA, 0, json_encode($data));
  58 + //判断WebSocket初始化
  59 + }else if ($data['type'] == 'initialize') {
  60 + //记录接收到的所有数据
  61 + trace(json_encode($data), 'send');
  62 + //解析data中data数据
  63 + $data_data = json_decode($data['data'],true);
  64 + //缓存终端<->workerman_id
  65 + $cache = cache($data_data['name'], $connection->id);
  66 + $cache = cache($connection->id, $data_data['name']);
  67 + //缓存终端在线列表
  68 + $cache_online = cache($data_data['name'].'_online', $data_data['online']);
  69 + //缓存成功返回数据给廖总
  70 + if ($cache && $cache_online) {
  71 + $res = array('type' => 'initialize', 'data' => array('code' => 1,'disableSync' => false,'parseEmojiToHtml' => true,'encoding' => 'utf-8'));
  72 + $connection->send(json_encode($res,JSON_UNESCAPED_SLASHES));
  73 + }
  74 + }else if($data['type'] == 'login' || $data['type'] == 'logout') {
  75 + // kafka推送->login类型
  76 + trace('producer->'.json_encode($data), 'producer');
  77 + $topic = $this->kafka->newTopic("ng_login");
  78 + $topic->produce(RD_KAFKA_PARTITION_UA, 0, json_encode($data));
  79 + }else if($data['type'] == 'notify') {
  80 + //捕捉登录信息
  81 + $data_data = json_decode($data['data'],true);
  82 + if ($data_data['type'] == 'account') {
  83 + $body = json_decode($data_data['body'],true);
  84 + //登录成功记录redis
  85 + if ($body['event'] == 'onLoginSuccess') {
  86 + //取出当前终端数据进行绑定
  87 + $name = cache($connection->id);
  88 + cache($data_data['username'], $name);
  89 + //退出成功删除redis
  90 + }else if($body['event'] == 'onExit'){
  91 + cache($data_data['username'], NULL);
  92 + }
  93 + }else if($data_data['type'] == 'wm_task'){
  94 + trace('producer->'.json_encode($data), 'producer');
  95 + //判断消息是否超时5分钟
  96 + $data_data_body = json_decode($data_data['body'],true);
  97 + if ($data_data_body['code'] > 0) {
  98 + $msgId = cache('taskId_'.$data_data_body['taskId']);
  99 + if ($msgId) {
  100 + $data['msgId'] = $msgId[0];
  101 + //回调->回调kafka
  102 + $topic = $this->kafka->newTopic('ng_'.$msgId[1].'_services');
  103 + $topic->produce(RD_KAFKA_PARTITION_UA, 0, json_encode($data));
  104 + }
  105 + }
  106 + }else{
  107 + // kafka推送->type类型
  108 + trace('producer->'.json_encode($data), 'producer');
  109 + $topic = $this->kafka->newTopic('ng_'.$data_data['type']);
  110 + $topic->produce(RD_KAFKA_PARTITION_UA, 0, json_encode($data));
  111 + }
  112 + }else if($data['type'] == 'online'){
  113 + //捕捉在线信息进行即时更新
  114 + $data_data = json_decode($data['data'],true);
  115 + $cache_online = cache($data_data['name'].'_online', $data_data['online']);
  116 + }
  117 + // $isPushed = Queue::push('app\module\Job1' , $data, 'send');
  118 + // $connection->send(json_encode($data));
  119 + }
  120 +
  121 + // 针对id推送数据
  122 + function sendMessageById($id, $message)
  123 + {
  124 + foreach ( $this->worker->connections as $_connection ){
  125 + if ($id == $_connection->id) {
  126 + $_connection->send($message);
  127 + }
  128 + }
  129 + }
  130 +
  131 +}
  1 +<?php
  2 +// 全局中间件定义文件
  3 +return [
  4 + // 全局请求缓存
  5 + // \think\middleware\CheckRequestCache::class,
  6 + // 多语言加载
  7 + // \think\middleware\LoadLangPack::class,
  8 + // Session初始化
  9 + // \think\middleware\SessionInit::class
  10 +];
  1 +<?php
  2 +namespace app\module;
  3 +
  4 +use think\queue\Job;
  5 +
  6 +class Job1{
  7 +
  8 + public function fire(Job $job, $data){
  9 +
  10 + //....这里执行具体的任务
  11 +
  12 + if ($job->attempts() > 3) {
  13 + //通过这个方法可以检查这个任务已经重试了几次了
  14 + $job->delete();
  15 + }
  16 +
  17 +
  18 + //如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
  19 + // $job->delete();
  20 + print_r(123);
  21 + // 也可以重新发布这个任务
  22 + $job->release($delay); //$delay为延迟时间
  23 +
  24 + }
  25 +
  26 + public function failed($data){
  27 +
  28 + // ...任务达到最大重试次数后,失败了
  29 + }
  30 +
  31 +}
  1 +<?php
  2 +use app\ExceptionHandle;
  3 +use app\Request;
  4 +
  5 +// 容器Provider定义文件
  6 +return [
  7 + 'think\Request' => Request::class,
  8 + 'think\exception\Handle' => ExceptionHandle::class,
  9 +];
  1 +<?php
  2 +
  3 +use app\AppService;
  4 +
  5 +// 系统服务定义文件
  6 +// 服务在完成全局初始化之后执行
  7 +return [
  8 + AppService::class,
  9 +];
  1 +{
  2 + "name": "topthink/think",
  3 + "description": "the new thinkphp framework",
  4 + "type": "project",
  5 + "keywords": [
  6 + "framework",
  7 + "thinkphp",
  8 + "ORM"
  9 + ],
  10 + "homepage": "http://thinkphp.cn/",
  11 + "license": "Apache-2.0",
  12 + "authors": [
  13 + {
  14 + "name": "liu21st",
  15 + "email": "[email protected]"
  16 + },
  17 + {
  18 + "name": "yunwuxin",
  19 + "email": "[email protected]"
  20 + }
  21 + ],
  22 + "require": {
  23 + "php": ">=7.1.0",
  24 + "topthink/framework": "^6.0.0",
  25 + "topthink/think-orm": "^2.0",
  26 + "topthink/think-worker": "^3.0",
  27 + "topthink/think-queue": "^3.0",
  28 + },
  29 + "require-dev": {
  30 + "symfony/var-dumper": "^4.2",
  31 + "topthink/think-trace":"^1.0"
  32 + },
  33 + "autoload": {
  34 + "psr-4": {
  35 + "app\\": "app"
  36 + },
  37 + "psr-0": {
  38 + "": "extend/"
  39 + }
  40 + },
  41 + "config": {
  42 + "preferred-install": "dist"
  43 + },
  44 + "scripts": {
  45 + "post-autoload-dump": [
  46 + "@php think service:discover",
  47 + "@php think vendor:publish"
  48 + ]
  49 + }
  50 +}
  1 +{
  2 + "_readme": [
  3 + "This file locks the dependencies of your project to a known state",
  4 + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
  5 + "This file is @generated automatically"
  6 + ],
  7 + "content-hash": "ac205b20d442bc57c099a3e0efdfd83b",
  8 + "packages": [
  9 + {
  10 + "name": "league/flysystem",
  11 + "version": "1.0.66",
  12 + "source": {
  13 + "type": "git",
  14 + "url": "https://github.com/thephpleague/flysystem.git",
  15 + "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21"
  16 + },
  17 + "dist": {
  18 + "type": "zip",
  19 + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/021569195e15f8209b1c4bebb78bd66aa4f08c21",
  20 + "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21",
  21 + "shasum": "",
  22 + "mirrors": [
  23 + {
  24 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  25 + "preferred": true
  26 + }
  27 + ]
  28 + },
  29 + "require": {
  30 + "ext-fileinfo": "*",
  31 + "php": ">=5.5.9"
  32 + },
  33 + "conflict": {
  34 + "league/flysystem-sftp": "<1.0.6"
  35 + },
  36 + "require-dev": {
  37 + "phpspec/phpspec": "^3.4",
  38 + "phpunit/phpunit": "^5.7.26"
  39 + },
  40 + "suggest": {
  41 + "ext-fileinfo": "Required for MimeType",
  42 + "ext-ftp": "Allows you to use FTP server storage",
  43 + "ext-openssl": "Allows you to use FTPS server storage",
  44 + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
  45 + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3",
  46 + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
  47 + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
  48 + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
  49 + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
  50 + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib",
  51 + "league/flysystem-webdav": "Allows you to use WebDAV storage",
  52 + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
  53 + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
  54 + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
  55 + },
  56 + "type": "library",
  57 + "extra": {
  58 + "branch-alias": {
  59 + "dev-master": "1.1-dev"
  60 + }
  61 + },
  62 + "autoload": {
  63 + "psr-4": {
  64 + "League\\Flysystem\\": "src/"
  65 + }
  66 + },
  67 + "notification-url": "https://packagist.org/downloads/",
  68 + "license": [
  69 + "MIT"
  70 + ],
  71 + "authors": [
  72 + {
  73 + "name": "Frank de Jonge",
  74 + "email": "[email protected]"
  75 + }
  76 + ],
  77 + "description": "Filesystem abstraction: Many filesystems, one API.",
  78 + "keywords": [
  79 + "Cloud Files",
  80 + "WebDAV",
  81 + "abstraction",
  82 + "aws",
  83 + "cloud",
  84 + "copy.com",
  85 + "dropbox",
  86 + "file systems",
  87 + "files",
  88 + "filesystem",
  89 + "filesystems",
  90 + "ftp",
  91 + "rackspace",
  92 + "remote",
  93 + "s3",
  94 + "sftp",
  95 + "storage"
  96 + ],
  97 + "time": "2020-03-17T18:58:12+00:00"
  98 + },
  99 + {
  100 + "name": "league/flysystem-cached-adapter",
  101 + "version": "1.0.9",
  102 + "source": {
  103 + "type": "git",
  104 + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git",
  105 + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f"
  106 + },
  107 + "dist": {
  108 + "type": "zip",
  109 + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f",
  110 + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f",
  111 + "shasum": "",
  112 + "mirrors": [
  113 + {
  114 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  115 + "preferred": true
  116 + }
  117 + ]
  118 + },
  119 + "require": {
  120 + "league/flysystem": "~1.0",
  121 + "psr/cache": "^1.0.0"
  122 + },
  123 + "require-dev": {
  124 + "mockery/mockery": "~0.9",
  125 + "phpspec/phpspec": "^3.4",
  126 + "phpunit/phpunit": "^5.7",
  127 + "predis/predis": "~1.0",
  128 + "tedivm/stash": "~0.12"
  129 + },
  130 + "suggest": {
  131 + "ext-phpredis": "Pure C implemented extension for PHP"
  132 + },
  133 + "type": "library",
  134 + "autoload": {
  135 + "psr-4": {
  136 + "League\\Flysystem\\Cached\\": "src/"
  137 + }
  138 + },
  139 + "notification-url": "https://packagist.org/downloads/",
  140 + "license": [
  141 + "MIT"
  142 + ],
  143 + "authors": [
  144 + {
  145 + "name": "frankdejonge",
  146 + "email": "[email protected]"
  147 + }
  148 + ],
  149 + "description": "An adapter decorator to enable meta-data caching.",
  150 + "time": "2018-07-09T20:51:04+00:00"
  151 + },
  152 + {
  153 + "name": "nesbot/carbon",
  154 + "version": "2.32.1",
  155 + "source": {
  156 + "type": "git",
  157 + "url": "https://github.com/briannesbitt/Carbon.git",
  158 + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c"
  159 + },
  160 + "dist": {
  161 + "type": "zip",
  162 + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c",
  163 + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c",
  164 + "shasum": "",
  165 + "mirrors": [
  166 + {
  167 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  168 + "preferred": true
  169 + }
  170 + ]
  171 + },
  172 + "require": {
  173 + "ext-json": "*",
  174 + "php": "^7.1.8 || ^8.0",
  175 + "symfony/translation": "^3.4 || ^4.0 || ^5.0"
  176 + },
  177 + "require-dev": {
  178 + "doctrine/orm": "^2.7",
  179 + "friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
  180 + "kylekatarnls/multi-tester": "^1.1",
  181 + "phpmd/phpmd": "^2.8",
  182 + "phpstan/phpstan": "^0.11",
  183 + "phpunit/phpunit": "^7.5 || ^8.0",
  184 + "squizlabs/php_codesniffer": "^3.4"
  185 + },
  186 + "bin": [
  187 + "bin/carbon"
  188 + ],
  189 + "type": "library",
  190 + "extra": {
  191 + "branch-alias": {
  192 + "dev-master": "2.x-dev"
  193 + },
  194 + "laravel": {
  195 + "providers": [
  196 + "Carbon\\Laravel\\ServiceProvider"
  197 + ]
  198 + }
  199 + },
  200 + "autoload": {
  201 + "psr-4": {
  202 + "Carbon\\": "src/Carbon/"
  203 + }
  204 + },
  205 + "notification-url": "https://packagist.org/downloads/",
  206 + "license": [
  207 + "MIT"
  208 + ],
  209 + "authors": [
  210 + {
  211 + "name": "Brian Nesbitt",
  212 + "email": "[email protected]",
  213 + "homepage": "http://nesbot.com"
  214 + },
  215 + {
  216 + "name": "kylekatarnls",
  217 + "homepage": "http://github.com/kylekatarnls"
  218 + }
  219 + ],
  220 + "description": "An API extension for DateTime that supports 281 different languages.",
  221 + "homepage": "http://carbon.nesbot.com",
  222 + "keywords": [
  223 + "date",
  224 + "datetime",
  225 + "time"
  226 + ],
  227 + "time": "2020-03-26T13:04:10+00:00"
  228 + },
  229 + {
  230 + "name": "opis/closure",
  231 + "version": "3.5.1",
  232 + "source": {
  233 + "type": "git",
  234 + "url": "https://github.com/opis/closure.git",
  235 + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969"
  236 + },
  237 + "dist": {
  238 + "type": "zip",
  239 + "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969",
  240 + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969",
  241 + "shasum": "",
  242 + "mirrors": [
  243 + {
  244 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  245 + "preferred": true
  246 + }
  247 + ]
  248 + },
  249 + "require": {
  250 + "php": "^5.4 || ^7.0"
  251 + },
  252 + "require-dev": {
  253 + "jeremeamia/superclosure": "^2.0",
  254 + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
  255 + },
  256 + "type": "library",
  257 + "extra": {
  258 + "branch-alias": {
  259 + "dev-master": "3.5.x-dev"
  260 + }
  261 + },
  262 + "autoload": {
  263 + "psr-4": {
  264 + "Opis\\Closure\\": "src/"
  265 + },
  266 + "files": [
  267 + "functions.php"
  268 + ]
  269 + },
  270 + "notification-url": "https://packagist.org/downloads/",
  271 + "license": [
  272 + "MIT"
  273 + ],
  274 + "authors": [
  275 + {
  276 + "name": "Marius Sarca",
  277 + "email": "[email protected]"
  278 + },
  279 + {
  280 + "name": "Sorin Sarca",
  281 + "email": "[email protected]"
  282 + }
  283 + ],
  284 + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
  285 + "homepage": "https://opis.io/closure",
  286 + "keywords": [
  287 + "anonymous functions",
  288 + "closure",
  289 + "function",
  290 + "serializable",
  291 + "serialization",
  292 + "serialize"
  293 + ],
  294 + "time": "2019-11-29T22:36:02+00:00"
  295 + },
  296 + {
  297 + "name": "psr/cache",
  298 + "version": "1.0.1",
  299 + "source": {
  300 + "type": "git",
  301 + "url": "https://github.com/php-fig/cache.git",
  302 + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
  303 + },
  304 + "dist": {
  305 + "type": "zip",
  306 + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
  307 + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
  308 + "shasum": "",
  309 + "mirrors": [
  310 + {
  311 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  312 + "preferred": true
  313 + }
  314 + ]
  315 + },
  316 + "require": {
  317 + "php": ">=5.3.0"
  318 + },
  319 + "type": "library",
  320 + "extra": {
  321 + "branch-alias": {
  322 + "dev-master": "1.0.x-dev"
  323 + }
  324 + },
  325 + "autoload": {
  326 + "psr-4": {
  327 + "Psr\\Cache\\": "src/"
  328 + }
  329 + },
  330 + "notification-url": "https://packagist.org/downloads/",
  331 + "license": [
  332 + "MIT"
  333 + ],
  334 + "authors": [
  335 + {
  336 + "name": "PHP-FIG",
  337 + "homepage": "http://www.php-fig.org/"
  338 + }
  339 + ],
  340 + "description": "Common interface for caching libraries",
  341 + "keywords": [
  342 + "cache",
  343 + "psr",
  344 + "psr-6"
  345 + ],
  346 + "time": "2016-08-06T20:24:11+00:00"
  347 + },
  348 + {
  349 + "name": "psr/container",
  350 + "version": "1.0.0",
  351 + "source": {
  352 + "type": "git",
  353 + "url": "https://github.com/php-fig/container.git",
  354 + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
  355 + },
  356 + "dist": {
  357 + "type": "zip",
  358 + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
  359 + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
  360 + "shasum": "",
  361 + "mirrors": [
  362 + {
  363 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  364 + "preferred": true
  365 + }
  366 + ]
  367 + },
  368 + "require": {
  369 + "php": ">=5.3.0"
  370 + },
  371 + "type": "library",
  372 + "extra": {
  373 + "branch-alias": {
  374 + "dev-master": "1.0.x-dev"
  375 + }
  376 + },
  377 + "autoload": {
  378 + "psr-4": {
  379 + "Psr\\Container\\": "src/"
  380 + }
  381 + },
  382 + "notification-url": "https://packagist.org/downloads/",
  383 + "license": [
  384 + "MIT"
  385 + ],
  386 + "authors": [
  387 + {
  388 + "name": "PHP-FIG",
  389 + "homepage": "http://www.php-fig.org/"
  390 + }
  391 + ],
  392 + "description": "Common Container Interface (PHP FIG PSR-11)",
  393 + "homepage": "https://github.com/php-fig/container",
  394 + "keywords": [
  395 + "PSR-11",
  396 + "container",
  397 + "container-interface",
  398 + "container-interop",
  399 + "psr"
  400 + ],
  401 + "time": "2017-02-14T16:28:37+00:00"
  402 + },
  403 + {
  404 + "name": "psr/log",
  405 + "version": "1.1.3",
  406 + "source": {
  407 + "type": "git",
  408 + "url": "https://github.com/php-fig/log.git",
  409 + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
  410 + },
  411 + "dist": {
  412 + "type": "zip",
  413 + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
  414 + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
  415 + "shasum": "",
  416 + "mirrors": [
  417 + {
  418 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  419 + "preferred": true
  420 + }
  421 + ]
  422 + },
  423 + "require": {
  424 + "php": ">=5.3.0"
  425 + },
  426 + "type": "library",
  427 + "extra": {
  428 + "branch-alias": {
  429 + "dev-master": "1.1.x-dev"
  430 + }
  431 + },
  432 + "autoload": {
  433 + "psr-4": {
  434 + "Psr\\Log\\": "Psr/Log/"
  435 + }
  436 + },
  437 + "notification-url": "https://packagist.org/downloads/",
  438 + "license": [
  439 + "MIT"
  440 + ],
  441 + "authors": [
  442 + {
  443 + "name": "PHP-FIG",
  444 + "homepage": "http://www.php-fig.org/"
  445 + }
  446 + ],
  447 + "description": "Common interface for logging libraries",
  448 + "homepage": "https://github.com/php-fig/log",
  449 + "keywords": [
  450 + "log",
  451 + "psr",
  452 + "psr-3"
  453 + ],
  454 + "time": "2020-03-23T09:12:05+00:00"
  455 + },
  456 + {
  457 + "name": "psr/simple-cache",
  458 + "version": "1.0.1",
  459 + "source": {
  460 + "type": "git",
  461 + "url": "https://github.com/php-fig/simple-cache.git",
  462 + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
  463 + },
  464 + "dist": {
  465 + "type": "zip",
  466 + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
  467 + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
  468 + "shasum": "",
  469 + "mirrors": [
  470 + {
  471 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  472 + "preferred": true
  473 + }
  474 + ]
  475 + },
  476 + "require": {
  477 + "php": ">=5.3.0"
  478 + },
  479 + "type": "library",
  480 + "extra": {
  481 + "branch-alias": {
  482 + "dev-master": "1.0.x-dev"
  483 + }
  484 + },
  485 + "autoload": {
  486 + "psr-4": {
  487 + "Psr\\SimpleCache\\": "src/"
  488 + }
  489 + },
  490 + "notification-url": "https://packagist.org/downloads/",
  491 + "license": [
  492 + "MIT"
  493 + ],
  494 + "authors": [
  495 + {
  496 + "name": "PHP-FIG",
  497 + "homepage": "http://www.php-fig.org/"
  498 + }
  499 + ],
  500 + "description": "Common interfaces for simple caching",
  501 + "keywords": [
  502 + "cache",
  503 + "caching",
  504 + "psr",
  505 + "psr-16",
  506 + "simple-cache"
  507 + ],
  508 + "time": "2017-10-23T01:57:42+00:00"
  509 + },
  510 + {
  511 + "name": "symfony/polyfill-mbstring",
  512 + "version": "v1.15.0",
  513 + "source": {
  514 + "type": "git",
  515 + "url": "https://github.com/symfony/polyfill-mbstring.git",
  516 + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
  517 + },
  518 + "dist": {
  519 + "type": "zip",
  520 + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
  521 + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
  522 + "shasum": "",
  523 + "mirrors": [
  524 + {
  525 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  526 + "preferred": true
  527 + }
  528 + ]
  529 + },
  530 + "require": {
  531 + "php": ">=5.3.3"
  532 + },
  533 + "suggest": {
  534 + "ext-mbstring": "For best performance"
  535 + },
  536 + "type": "library",
  537 + "extra": {
  538 + "branch-alias": {
  539 + "dev-master": "1.15-dev"
  540 + }
  541 + },
  542 + "autoload": {
  543 + "psr-4": {
  544 + "Symfony\\Polyfill\\Mbstring\\": ""
  545 + },
  546 + "files": [
  547 + "bootstrap.php"
  548 + ]
  549 + },
  550 + "notification-url": "https://packagist.org/downloads/",
  551 + "license": [
  552 + "MIT"
  553 + ],
  554 + "authors": [
  555 + {
  556 + "name": "Nicolas Grekas",
  557 + "email": "[email protected]"
  558 + },
  559 + {
  560 + "name": "Symfony Community",
  561 + "homepage": "https://symfony.com/contributors"
  562 + }
  563 + ],
  564 + "description": "Symfony polyfill for the Mbstring extension",
  565 + "homepage": "https://symfony.com",
  566 + "keywords": [
  567 + "compatibility",
  568 + "mbstring",
  569 + "polyfill",
  570 + "portable",
  571 + "shim"
  572 + ],
  573 + "time": "2020-03-09T19:04:49+00:00"
  574 + },
  575 + {
  576 + "name": "symfony/process",
  577 + "version": "v4.4.6",
  578 + "source": {
  579 + "type": "git",
  580 + "url": "https://github.com/symfony/process.git",
  581 + "reference": "b9863d0f7b684d7c4c13e665325b5ff047de0aee"
  582 + },
  583 + "dist": {
  584 + "type": "zip",
  585 + "url": "https://api.github.com/repos/symfony/process/zipball/b9863d0f7b684d7c4c13e665325b5ff047de0aee",
  586 + "reference": "b9863d0f7b684d7c4c13e665325b5ff047de0aee",
  587 + "shasum": "",
  588 + "mirrors": [
  589 + {
  590 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  591 + "preferred": true
  592 + }
  593 + ]
  594 + },
  595 + "require": {
  596 + "php": "^7.1.3"
  597 + },
  598 + "type": "library",
  599 + "extra": {
  600 + "branch-alias": {
  601 + "dev-master": "4.4-dev"
  602 + }
  603 + },
  604 + "autoload": {
  605 + "psr-4": {
  606 + "Symfony\\Component\\Process\\": ""
  607 + },
  608 + "exclude-from-classmap": [
  609 + "/Tests/"
  610 + ]
  611 + },
  612 + "notification-url": "https://packagist.org/downloads/",
  613 + "license": [
  614 + "MIT"
  615 + ],
  616 + "authors": [
  617 + {
  618 + "name": "Fabien Potencier",
  619 + "email": "[email protected]"
  620 + },
  621 + {
  622 + "name": "Symfony Community",
  623 + "homepage": "https://symfony.com/contributors"
  624 + }
  625 + ],
  626 + "description": "Symfony Process Component",
  627 + "homepage": "https://symfony.com",
  628 + "time": "2020-03-23T12:37:11+00:00"
  629 + },
  630 + {
  631 + "name": "symfony/translation",
  632 + "version": "v5.0.6",
  633 + "source": {
  634 + "type": "git",
  635 + "url": "https://github.com/symfony/translation.git",
  636 + "reference": "91855689b557481ff2d3d97c535d74284e7b814a"
  637 + },
  638 + "dist": {
  639 + "type": "zip",
  640 + "url": "https://api.github.com/repos/symfony/translation/zipball/91855689b557481ff2d3d97c535d74284e7b814a",
  641 + "reference": "91855689b557481ff2d3d97c535d74284e7b814a",
  642 + "shasum": "",
  643 + "mirrors": [
  644 + {
  645 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  646 + "preferred": true
  647 + }
  648 + ]
  649 + },
  650 + "require": {
  651 + "php": "^7.2.5",
  652 + "symfony/polyfill-mbstring": "~1.0",
  653 + "symfony/translation-contracts": "^2"
  654 + },
  655 + "conflict": {
  656 + "symfony/config": "<4.4",
  657 + "symfony/dependency-injection": "<5.0",
  658 + "symfony/http-kernel": "<5.0",
  659 + "symfony/twig-bundle": "<5.0",
  660 + "symfony/yaml": "<4.4"
  661 + },
  662 + "provide": {
  663 + "symfony/translation-implementation": "2.0"
  664 + },
  665 + "require-dev": {
  666 + "psr/log": "~1.0",
  667 + "symfony/config": "^4.4|^5.0",
  668 + "symfony/console": "^4.4|^5.0",
  669 + "symfony/dependency-injection": "^5.0",
  670 + "symfony/finder": "^4.4|^5.0",
  671 + "symfony/http-kernel": "^5.0",
  672 + "symfony/intl": "^4.4|^5.0",
  673 + "symfony/service-contracts": "^1.1.2|^2",
  674 + "symfony/yaml": "^4.4|^5.0"
  675 + },
  676 + "suggest": {
  677 + "psr/log-implementation": "To use logging capability in translator",
  678 + "symfony/config": "",
  679 + "symfony/yaml": ""
  680 + },
  681 + "type": "library",
  682 + "extra": {
  683 + "branch-alias": {
  684 + "dev-master": "5.0-dev"
  685 + }
  686 + },
  687 + "autoload": {
  688 + "psr-4": {
  689 + "Symfony\\Component\\Translation\\": ""
  690 + },
  691 + "exclude-from-classmap": [
  692 + "/Tests/"
  693 + ]
  694 + },
  695 + "notification-url": "https://packagist.org/downloads/",
  696 + "license": [
  697 + "MIT"
  698 + ],
  699 + "authors": [
  700 + {
  701 + "name": "Fabien Potencier",
  702 + "email": "[email protected]"
  703 + },
  704 + {
  705 + "name": "Symfony Community",
  706 + "homepage": "https://symfony.com/contributors"
  707 + }
  708 + ],
  709 + "description": "Symfony Translation Component",
  710 + "homepage": "https://symfony.com",
  711 + "time": "2020-03-18T08:00:37+00:00"
  712 + },
  713 + {
  714 + "name": "symfony/translation-contracts",
  715 + "version": "v2.0.1",
  716 + "source": {
  717 + "type": "git",
  718 + "url": "https://github.com/symfony/translation-contracts.git",
  719 + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed"
  720 + },
  721 + "dist": {
  722 + "type": "zip",
  723 + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed",
  724 + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed",
  725 + "shasum": "",
  726 + "mirrors": [
  727 + {
  728 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  729 + "preferred": true
  730 + }
  731 + ]
  732 + },
  733 + "require": {
  734 + "php": "^7.2.5"
  735 + },
  736 + "suggest": {
  737 + "symfony/translation-implementation": ""
  738 + },
  739 + "type": "library",
  740 + "extra": {
  741 + "branch-alias": {
  742 + "dev-master": "2.0-dev"
  743 + }
  744 + },
  745 + "autoload": {
  746 + "psr-4": {
  747 + "Symfony\\Contracts\\Translation\\": ""
  748 + }
  749 + },
  750 + "notification-url": "https://packagist.org/downloads/",
  751 + "license": [
  752 + "MIT"
  753 + ],
  754 + "authors": [
  755 + {
  756 + "name": "Nicolas Grekas",
  757 + "email": "[email protected]"
  758 + },
  759 + {
  760 + "name": "Symfony Community",
  761 + "homepage": "https://symfony.com/contributors"
  762 + }
  763 + ],
  764 + "description": "Generic abstractions related to translation",
  765 + "homepage": "https://symfony.com",
  766 + "keywords": [
  767 + "abstractions",
  768 + "contracts",
  769 + "decoupling",
  770 + "interfaces",
  771 + "interoperability",
  772 + "standards"
  773 + ],
  774 + "time": "2019-11-18T17:27:11+00:00"
  775 + },
  776 + {
  777 + "name": "topthink/framework",
  778 + "version": "v6.0.2",
  779 + "source": {
  780 + "type": "git",
  781 + "url": "https://github.com/top-think/framework.git",
  782 + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf"
  783 + },
  784 + "dist": {
  785 + "type": "zip",
  786 + "url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf",
  787 + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf",
  788 + "shasum": "",
  789 + "mirrors": [
  790 + {
  791 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  792 + "preferred": true
  793 + }
  794 + ]
  795 + },
  796 + "require": {
  797 + "ext-json": "*",
  798 + "ext-mbstring": "*",
  799 + "league/flysystem": "^1.0",
  800 + "league/flysystem-cached-adapter": "^1.0",
  801 + "opis/closure": "^3.1",
  802 + "php": ">=7.1.0",
  803 + "psr/container": "~1.0",
  804 + "psr/log": "~1.0",
  805 + "psr/simple-cache": "^1.0",
  806 + "topthink/think-helper": "^3.1.1",
  807 + "topthink/think-orm": "^2.0"
  808 + },
  809 + "require-dev": {
  810 + "mikey179/vfsstream": "^1.6",
  811 + "mockery/mockery": "^1.2",
  812 + "phpunit/phpunit": "^7.0"
  813 + },
  814 + "type": "library",
  815 + "autoload": {
  816 + "files": [],
  817 + "psr-4": {
  818 + "think\\": "src/think/"
  819 + }
  820 + },
  821 + "notification-url": "https://packagist.org/downloads/",
  822 + "license": [
  823 + "Apache-2.0"
  824 + ],
  825 + "authors": [
  826 + {
  827 + "name": "liu21st",
  828 + "email": "[email protected]"
  829 + },
  830 + {
  831 + "name": "yunwuxin",
  832 + "email": "[email protected]"
  833 + }
  834 + ],
  835 + "description": "The ThinkPHP Framework.",
  836 + "homepage": "http://thinkphp.cn/",
  837 + "keywords": [
  838 + "framework",
  839 + "orm",
  840 + "thinkphp"
  841 + ],
  842 + "time": "2020-01-13T05:48:05+00:00"
  843 + },
  844 + {
  845 + "name": "topthink/think-factory",
  846 + "version": "v1.0.1",
  847 + "source": {
  848 + "type": "git",
  849 + "url": "https://github.com/top-think/think-factory.git",
  850 + "reference": "b8080a6472aae1cff47ceb8c30feec3c2835364b"
  851 + },
  852 + "dist": {
  853 + "type": "zip",
  854 + "url": "https://api.github.com/repos/top-think/think-factory/zipball/b8080a6472aae1cff47ceb8c30feec3c2835364b",
  855 + "reference": "b8080a6472aae1cff47ceb8c30feec3c2835364b",
  856 + "shasum": "",
  857 + "mirrors": [
  858 + {
  859 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  860 + "preferred": true
  861 + }
  862 + ]
  863 + },
  864 + "require": {
  865 + "topthink/framework": "^6.0.0",
  866 + "topthink/think-helper": "^3.0.0"
  867 + },
  868 + "type": "library",
  869 + "autoload": {
  870 + "psr-4": {
  871 + "think\\": "src"
  872 + }
  873 + },
  874 + "notification-url": "https://packagist.org/downloads/",
  875 + "license": [
  876 + "Apache-2.0"
  877 + ],
  878 + "authors": [
  879 + {
  880 + "name": "yunwuxin",
  881 + "email": "[email protected]"
  882 + }
  883 + ],
  884 + "time": "2019-04-15T06:55:28+00:00"
  885 + },
  886 + {
  887 + "name": "topthink/think-helper",
  888 + "version": "v3.1.3",
  889 + "source": {
  890 + "type": "git",
  891 + "url": "https://github.com/top-think/think-helper.git",
  892 + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4"
  893 + },
  894 + "dist": {
  895 + "type": "zip",
  896 + "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
  897 + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
  898 + "shasum": "",
  899 + "mirrors": [
  900 + {
  901 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  902 + "preferred": true
  903 + }
  904 + ]
  905 + },
  906 + "require": {
  907 + "php": ">=7.1.0"
  908 + },
  909 + "type": "library",
  910 + "autoload": {
  911 + "psr-4": {
  912 + "think\\": "src"
  913 + },
  914 + "files": [
  915 + "src/helper.php"
  916 + ]
  917 + },
  918 + "notification-url": "https://packagist.org/downloads/",
  919 + "license": [
  920 + "Apache-2.0"
  921 + ],
  922 + "authors": [
  923 + {
  924 + "name": "yunwuxin",
  925 + "email": "[email protected]"
  926 + }
  927 + ],
  928 + "description": "The ThinkPHP6 Helper Package",
  929 + "time": "2019-09-30T02:36:48+00:00"
  930 + },
  931 + {
  932 + "name": "topthink/think-orm",
  933 + "version": "v2.0.31",
  934 + "source": {
  935 + "type": "git",
  936 + "url": "https://github.com/top-think/think-orm.git",
  937 + "reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4"
  938 + },
  939 + "dist": {
  940 + "type": "zip",
  941 + "url": "https://api.github.com/repos/top-think/think-orm/zipball/d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
  942 + "reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
  943 + "shasum": "",
  944 + "mirrors": [
  945 + {
  946 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  947 + "preferred": true
  948 + }
  949 + ]
  950 + },
  951 + "require": {
  952 + "ext-json": "*",
  953 + "php": ">=7.1.0",
  954 + "psr/log": "~1.0",
  955 + "psr/simple-cache": "^1.0",
  956 + "topthink/think-helper": "^3.1"
  957 + },
  958 + "type": "library",
  959 + "autoload": {
  960 + "psr-4": {
  961 + "think\\": "src"
  962 + },
  963 + "files": []
  964 + },
  965 + "notification-url": "https://packagist.org/downloads/",
  966 + "license": [
  967 + "Apache-2.0"
  968 + ],
  969 + "authors": [
  970 + {
  971 + "name": "liu21st",
  972 + "email": "[email protected]"
  973 + }
  974 + ],
  975 + "description": "think orm",
  976 + "keywords": [
  977 + "database",
  978 + "orm"
  979 + ],
  980 + "time": "2020-01-07T10:05:10+00:00"
  981 + },
  982 + {
  983 + "name": "topthink/think-queue",
  984 + "version": "v3.0.4",
  985 + "source": {
  986 + "type": "git",
  987 + "url": "https://github.com/top-think/think-queue.git",
  988 + "reference": "a993295b68a483dc3cb2c0fee05683908fa2572e"
  989 + },
  990 + "dist": {
  991 + "type": "zip",
  992 + "url": "https://api.github.com/repos/top-think/think-queue/zipball/a993295b68a483dc3cb2c0fee05683908fa2572e",
  993 + "reference": "a993295b68a483dc3cb2c0fee05683908fa2572e",
  994 + "shasum": "",
  995 + "mirrors": [
  996 + {
  997 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  998 + "preferred": true
  999 + }
  1000 + ]
  1001 + },
  1002 + "require": {
  1003 + "ext-json": "*",
  1004 + "nesbot/carbon": "^2.16",
  1005 + "symfony/process": "^4.2",
  1006 + "topthink/framework": "^6.0.0",
  1007 + "topthink/think-factory": "^1.0.0",
  1008 + "topthink/think-helper": "^3.0.4"
  1009 + },
  1010 + "require-dev": {
  1011 + "mockery/mockery": "^1.2",
  1012 + "phpunit/phpunit": "^6.2",
  1013 + "topthink/think-migration": "^3.0.0"
  1014 + },
  1015 + "type": "library",
  1016 + "extra": {
  1017 + "think": {
  1018 + "services": [
  1019 + "think\\queue\\Service"
  1020 + ],
  1021 + "config": {
  1022 + "queue": "src/config.php"
  1023 + }
  1024 + }
  1025 + },
  1026 + "autoload": {
  1027 + "psr-4": {
  1028 + "think\\": "src"
  1029 + },
  1030 + "files": [
  1031 + "src/common.php"
  1032 + ]
  1033 + },
  1034 + "notification-url": "https://packagist.org/downloads/",
  1035 + "license": [
  1036 + "Apache-2.0"
  1037 + ],
  1038 + "authors": [
  1039 + {
  1040 + "name": "yunwuxin",
  1041 + "email": "[email protected]"
  1042 + }
  1043 + ],
  1044 + "description": "The ThinkPHP5 Queue Package",
  1045 + "time": "2019-10-13T03:51:32+00:00"
  1046 + },
  1047 + {
  1048 + "name": "topthink/think-worker",
  1049 + "version": "v3.0.4",
  1050 + "source": {
  1051 + "type": "git",
  1052 + "url": "https://github.com/top-think/think-worker.git",
  1053 + "reference": "188f6af276b780382fbc244fa25d0ed92d476bd5"
  1054 + },
  1055 + "dist": {
  1056 + "type": "zip",
  1057 + "url": "https://api.github.com/repos/top-think/think-worker/zipball/188f6af276b780382fbc244fa25d0ed92d476bd5",
  1058 + "reference": "188f6af276b780382fbc244fa25d0ed92d476bd5",
  1059 + "shasum": "",
  1060 + "mirrors": [
  1061 + {
  1062 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1063 + "preferred": true
  1064 + }
  1065 + ]
  1066 + },
  1067 + "require": {
  1068 + "ext-fileinfo": "*",
  1069 + "topthink/framework": "^6.0.0",
  1070 + "workerman/gateway-worker": "^3.0.0",
  1071 + "workerman/workerman": "^3.3.0"
  1072 + },
  1073 + "type": "library",
  1074 + "extra": {
  1075 + "think": {
  1076 + "services": [
  1077 + "think\\worker\\Service"
  1078 + ],
  1079 + "config": {
  1080 + "worker": "src/config/worker.php",
  1081 + "worker_server": "src/config/server.php",
  1082 + "gateway_worker": "src/config/gateway.php"
  1083 + }
  1084 + }
  1085 + },
  1086 + "autoload": {
  1087 + "psr-4": {
  1088 + "think\\worker\\": "src"
  1089 + }
  1090 + },
  1091 + "notification-url": "https://packagist.org/downloads/",
  1092 + "license": [
  1093 + "Apache-2.0"
  1094 + ],
  1095 + "authors": [
  1096 + {
  1097 + "name": "liu21st",
  1098 + "email": "[email protected]"
  1099 + }
  1100 + ],
  1101 + "description": "workerman extend for thinkphp6.0",
  1102 + "time": "2019-11-07T03:56:14+00:00"
  1103 + },
  1104 + {
  1105 + "name": "workerman/gateway-worker",
  1106 + "version": "v3.0.15",
  1107 + "source": {
  1108 + "type": "git",
  1109 + "url": "https://github.com/walkor/GatewayWorker.git",
  1110 + "reference": "d633fe52c792839a80ed2cfea7697bf705350d62"
  1111 + },
  1112 + "dist": {
  1113 + "type": "zip",
  1114 + "url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/d633fe52c792839a80ed2cfea7697bf705350d62",
  1115 + "reference": "d633fe52c792839a80ed2cfea7697bf705350d62",
  1116 + "shasum": "",
  1117 + "mirrors": [
  1118 + {
  1119 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1120 + "preferred": true
  1121 + }
  1122 + ]
  1123 + },
  1124 + "require": {
  1125 + "workerman/workerman": ">=3.5.0"
  1126 + },
  1127 + "type": "library",
  1128 + "autoload": {
  1129 + "psr-4": {
  1130 + "GatewayWorker\\": "./src"
  1131 + }
  1132 + },
  1133 + "notification-url": "https://packagist.org/downloads/",
  1134 + "license": [
  1135 + "MIT"
  1136 + ],
  1137 + "homepage": "http://www.workerman.net",
  1138 + "keywords": [
  1139 + "communication",
  1140 + "distributed"
  1141 + ],
  1142 + "time": "2020-03-09T12:03:30+00:00"
  1143 + },
  1144 + {
  1145 + "name": "workerman/workerman",
  1146 + "version": "v3.5.29",
  1147 + "source": {
  1148 + "type": "git",
  1149 + "url": "https://github.com/walkor/Workerman.git",
  1150 + "reference": "eaf533eaa82f7f0237aa1d5502c6d0bced0919f7"
  1151 + },
  1152 + "dist": {
  1153 + "type": "zip",
  1154 + "url": "https://api.github.com/repos/walkor/Workerman/zipball/eaf533eaa82f7f0237aa1d5502c6d0bced0919f7",
  1155 + "reference": "eaf533eaa82f7f0237aa1d5502c6d0bced0919f7",
  1156 + "shasum": "",
  1157 + "mirrors": [
  1158 + {
  1159 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1160 + "preferred": true
  1161 + }
  1162 + ]
  1163 + },
  1164 + "require": {
  1165 + "php": ">=5.3"
  1166 + },
  1167 + "suggest": {
  1168 + "ext-event": "For better performance. "
  1169 + },
  1170 + "type": "library",
  1171 + "autoload": {
  1172 + "psr-4": {
  1173 + "Workerman\\": "./"
  1174 + }
  1175 + },
  1176 + "notification-url": "https://packagist.org/downloads/",
  1177 + "license": [
  1178 + "MIT"
  1179 + ],
  1180 + "authors": [
  1181 + {
  1182 + "name": "walkor",
  1183 + "email": "[email protected]",
  1184 + "homepage": "http://www.workerman.net",
  1185 + "role": "Developer"
  1186 + }
  1187 + ],
  1188 + "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.",
  1189 + "homepage": "http://www.workerman.net",
  1190 + "keywords": [
  1191 + "asynchronous",
  1192 + "event-loop"
  1193 + ],
  1194 + "time": "2020-03-05T11:08:04+00:00"
  1195 + }
  1196 + ],
  1197 + "packages-dev": [
  1198 + {
  1199 + "name": "symfony/polyfill-php72",
  1200 + "version": "v1.15.0",
  1201 + "source": {
  1202 + "type": "git",
  1203 + "url": "https://github.com/symfony/polyfill-php72.git",
  1204 + "reference": "37b0976c78b94856543260ce09b460a7bc852747"
  1205 + },
  1206 + "dist": {
  1207 + "type": "zip",
  1208 + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
  1209 + "reference": "37b0976c78b94856543260ce09b460a7bc852747",
  1210 + "shasum": "",
  1211 + "mirrors": [
  1212 + {
  1213 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1214 + "preferred": true
  1215 + }
  1216 + ]
  1217 + },
  1218 + "require": {
  1219 + "php": ">=5.3.3"
  1220 + },
  1221 + "type": "library",
  1222 + "extra": {
  1223 + "branch-alias": {
  1224 + "dev-master": "1.15-dev"
  1225 + }
  1226 + },
  1227 + "autoload": {
  1228 + "psr-4": {
  1229 + "Symfony\\Polyfill\\Php72\\": ""
  1230 + },
  1231 + "files": [
  1232 + "bootstrap.php"
  1233 + ]
  1234 + },
  1235 + "notification-url": "https://packagist.org/downloads/",
  1236 + "license": [
  1237 + "MIT"
  1238 + ],
  1239 + "authors": [
  1240 + {
  1241 + "name": "Nicolas Grekas",
  1242 + "email": "[email protected]"
  1243 + },
  1244 + {
  1245 + "name": "Symfony Community",
  1246 + "homepage": "https://symfony.com/contributors"
  1247 + }
  1248 + ],
  1249 + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
  1250 + "homepage": "https://symfony.com",
  1251 + "keywords": [
  1252 + "compatibility",
  1253 + "polyfill",
  1254 + "portable",
  1255 + "shim"
  1256 + ],
  1257 + "time": "2020-02-27T09:26:54+00:00"
  1258 + },
  1259 + {
  1260 + "name": "symfony/var-dumper",
  1261 + "version": "v4.4.5",
  1262 + "source": {
  1263 + "type": "git",
  1264 + "url": "https://github.com/symfony/var-dumper.git",
  1265 + "reference": "2572839911702b0405479410ea7a1334bfab0b96"
  1266 + },
  1267 + "dist": {
  1268 + "type": "zip",
  1269 + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2572839911702b0405479410ea7a1334bfab0b96",
  1270 + "reference": "2572839911702b0405479410ea7a1334bfab0b96",
  1271 + "shasum": "",
  1272 + "mirrors": [
  1273 + {
  1274 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1275 + "preferred": true
  1276 + }
  1277 + ]
  1278 + },
  1279 + "require": {
  1280 + "php": "^7.1.3",
  1281 + "symfony/polyfill-mbstring": "~1.0",
  1282 + "symfony/polyfill-php72": "~1.5"
  1283 + },
  1284 + "conflict": {
  1285 + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
  1286 + "symfony/console": "<3.4"
  1287 + },
  1288 + "require-dev": {
  1289 + "ext-iconv": "*",
  1290 + "symfony/console": "^3.4|^4.0|^5.0",
  1291 + "symfony/process": "^4.4|^5.0",
  1292 + "twig/twig": "^1.34|^2.4|^3.0"
  1293 + },
  1294 + "suggest": {
  1295 + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
  1296 + "ext-intl": "To show region name in time zone dump",
  1297 + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
  1298 + },
  1299 + "bin": [
  1300 + "Resources/bin/var-dump-server"
  1301 + ],
  1302 + "type": "library",
  1303 + "extra": {
  1304 + "branch-alias": {
  1305 + "dev-master": "4.4-dev"
  1306 + }
  1307 + },
  1308 + "autoload": {
  1309 + "files": [
  1310 + "Resources/functions/dump.php"
  1311 + ],
  1312 + "psr-4": {
  1313 + "Symfony\\Component\\VarDumper\\": ""
  1314 + },
  1315 + "exclude-from-classmap": [
  1316 + "/Tests/"
  1317 + ]
  1318 + },
  1319 + "notification-url": "https://packagist.org/downloads/",
  1320 + "license": [
  1321 + "MIT"
  1322 + ],
  1323 + "authors": [
  1324 + {
  1325 + "name": "Nicolas Grekas",
  1326 + "email": "[email protected]"
  1327 + },
  1328 + {
  1329 + "name": "Symfony Community",
  1330 + "homepage": "https://symfony.com/contributors"
  1331 + }
  1332 + ],
  1333 + "description": "Symfony mechanism for exploring and dumping PHP variables",
  1334 + "homepage": "https://symfony.com",
  1335 + "keywords": [
  1336 + "debug",
  1337 + "dump"
  1338 + ],
  1339 + "time": "2020-02-24T13:10:00+00:00"
  1340 + },
  1341 + {
  1342 + "name": "topthink/think-trace",
  1343 + "version": "v1.2",
  1344 + "source": {
  1345 + "type": "git",
  1346 + "url": "https://github.com/top-think/think-trace.git",
  1347 + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc"
  1348 + },
  1349 + "dist": {
  1350 + "type": "zip",
  1351 + "url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc",
  1352 + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc",
  1353 + "shasum": "",
  1354 + "mirrors": [
  1355 + {
  1356 + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
  1357 + "preferred": true
  1358 + }
  1359 + ]
  1360 + },
  1361 + "require": {
  1362 + "php": ">=7.1.0",
  1363 + "topthink/framework": "^6.0.0"
  1364 + },
  1365 + "type": "library",
  1366 + "extra": {
  1367 + "think": {
  1368 + "services": [
  1369 + "think\\trace\\Service"
  1370 + ],
  1371 + "config": {
  1372 + "trace": "src/config.php"
  1373 + }
  1374 + }
  1375 + },
  1376 + "autoload": {
  1377 + "psr-4": {
  1378 + "think\\trace\\": "src"
  1379 + }
  1380 + },
  1381 + "notification-url": "https://packagist.org/downloads/",
  1382 + "license": [
  1383 + "Apache-2.0"
  1384 + ],
  1385 + "authors": [
  1386 + {
  1387 + "name": "liu21st",
  1388 + "email": "[email protected]"
  1389 + }
  1390 + ],
  1391 + "description": "thinkphp debug trace",
  1392 + "time": "2019-10-17T02:14:09+00:00"
  1393 + }
  1394 + ],
  1395 + "aliases": [],
  1396 + "minimum-stability": "stable",
  1397 + "stability-flags": [],
  1398 + "prefer-stable": false,
  1399 + "prefer-lowest": false,
  1400 + "platform": {
  1401 + "php": ">=7.1.0"
  1402 + },
  1403 + "platform-dev": []
  1404 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 应用设置
  4 +// +----------------------------------------------------------------------
  5 +
  6 +return [
  7 + // 应用地址
  8 + 'app_host' => env('app.host', ''),
  9 + // 应用的命名空间
  10 + 'app_namespace' => '',
  11 + // 是否启用路由
  12 + 'with_route' => true,
  13 + // 是否启用事件
  14 + 'with_event' => true,
  15 + // 默认应用
  16 + 'default_app' => 'index',
  17 + // 默认时区
  18 + 'default_timezone' => 'Asia/Shanghai',
  19 +
  20 + // 应用映射(自动多应用模式有效)
  21 + 'app_map' => [],
  22 + // 域名绑定(自动多应用模式有效)
  23 + 'domain_bind' => [],
  24 + // 禁止URL访问的应用列表(自动多应用模式有效)
  25 + 'deny_app_list' => [],
  26 +
  27 + // 异常页面的模板文件
  28 + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
  29 +
  30 + // 错误显示信息,非调试模式有效
  31 + 'error_message' => '页面错误!请稍后再试~',
  32 + // 显示错误信息
  33 + 'show_error_msg' => true,
  34 +];
  1 +<?php
  2 +
  3 +// +----------------------------------------------------------------------
  4 +// | 缓存设置
  5 +// +----------------------------------------------------------------------
  6 +
  7 +return [
  8 + 'default' => 'redis',
  9 + 'stores' => [
  10 + // 文件缓存
  11 + 'file' => [
  12 + // 驱动方式
  13 + 'type' => 'file',
  14 + // 设置不同的缓存保存目录
  15 + 'path' => '../runtime/file/',
  16 + ],
  17 + // redis缓存
  18 + 'redis' => [
  19 + // 驱动方式
  20 + 'type' => 'redis',
  21 + // 服务器地址
  22 + 'host' => '127.0.0.1',
  23 + 'serialize' => ['json_encode','json_decode'],
  24 + 'prefix' => 'ws:',
  25 + ],
  26 + ],
  27 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 控制台配置
  4 +// +----------------------------------------------------------------------
  5 +return [
  6 + // 指令定义
  7 + 'commands' => [
  8 + ],
  9 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | Cookie设置
  4 +// +----------------------------------------------------------------------
  5 +return [
  6 + // cookie 保存时间
  7 + 'expire' => 0,
  8 + // cookie 保存路径
  9 + 'path' => '/',
  10 + // cookie 有效域名
  11 + 'domain' => '',
  12 + // cookie 启用安全传输
  13 + 'secure' => false,
  14 + // httponly设置
  15 + 'httponly' => false,
  16 + // 是否使用 setcookie
  17 + 'setcookie' => true,
  18 +];
  1 +<?php
  2 +
  3 +return [
  4 + // 默认使用的数据库连接配置
  5 + 'default' => env('database.driver', 'mysql'),
  6 +
  7 + // 自定义时间查询规则
  8 + 'time_query_rule' => [],
  9 +
  10 + // 自动写入时间戳字段
  11 + // true为自动识别类型 false关闭
  12 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date
  13 + 'auto_timestamp' => true,
  14 +
  15 + // 时间字段取出后的默认时间格式
  16 + 'datetime_format' => 'Y-m-d H:i:s',
  17 +
  18 + // 数据库连接配置信息
  19 + 'connections' => [
  20 + 'mysql' => [
  21 + // 数据库类型
  22 + 'type' => env('database.type', 'mysql'),
  23 + // 服务器地址
  24 + 'hostname' => env('database.hostname', '127.0.0.1'),
  25 + // 数据库名
  26 + 'database' => env('database.database', ''),
  27 + // 用户名
  28 + 'username' => env('database.username', 'root'),
  29 + // 密码
  30 + 'password' => env('database.password', ''),
  31 + // 端口
  32 + 'hostport' => env('database.hostport', '3306'),
  33 + // 数据库连接参数
  34 + 'params' => [],
  35 + // 数据库编码默认采用utf8
  36 + 'charset' => env('database.charset', 'utf8'),
  37 + // 数据库表前缀
  38 + 'prefix' => env('database.prefix', ''),
  39 +
  40 + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
  41 + 'deploy' => 0,
  42 + // 数据库读写是否分离 主从式有效
  43 + 'rw_separate' => false,
  44 + // 读写分离后 主服务器数量
  45 + 'master_num' => 1,
  46 + // 指定从服务器序号
  47 + 'slave_no' => '',
  48 + // 是否严格检查字段是否存在
  49 + 'fields_strict' => true,
  50 + // 是否需要断线重连
  51 + 'break_reconnect' => false,
  52 + // 监听SQL
  53 + 'trigger_sql' => env('app_debug', true),
  54 + // 开启字段缓存
  55 + 'fields_cache' => false,
  56 + // 字段缓存路径
  57 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
  58 + ],
  59 +
  60 + // 更多的数据库配置信息
  61 + ],
  62 +];
  1 +<?php
  2 +
  3 +return [
  4 + // 默认磁盘
  5 + 'default' => env('filesystem.driver', 'local'),
  6 + // 磁盘列表
  7 + 'disks' => [
  8 + 'local' => [
  9 + 'type' => 'local',
  10 + 'root' => app()->getRuntimePath() . 'storage',
  11 + ],
  12 + 'public' => [
  13 + // 磁盘类型
  14 + 'type' => 'local',
  15 + // 磁盘路径
  16 + 'root' => app()->getRootPath() . 'public/storage',
  17 + // 磁盘路径对应的外部URL路径
  18 + 'url' => '/storage',
  19 + // 可见性
  20 + 'visibility' => 'public',
  21 + ],
  22 + // 更多的磁盘配置信息
  23 + ],
  24 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +// +----------------------------------------------------------------------
  12 +// | Workerman设置 仅对 php think worker:gateway 指令有效
  13 +// +----------------------------------------------------------------------
  14 +return [
  15 + // 扩展自身需要的配置
  16 + 'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
  17 + 'host' => '0.0.0.0', // 监听地址
  18 + 'port' => 2348, // 监听端口
  19 + 'socket' => '', // 完整监听地址
  20 + 'context' => [], // socket 上下文选项
  21 + 'register_deploy' => true, // 是否需要部署register
  22 + 'businessWorker_deploy' => true, // 是否需要部署businessWorker
  23 + 'gateway_deploy' => true, // 是否需要部署gateway
  24 +
  25 + // Register配置
  26 + 'registerAddress' => '127.0.0.1:1236',
  27 +
  28 + // Gateway配置
  29 + 'name' => 'thinkphp',
  30 + 'count' => 1,
  31 + 'lanIp' => '127.0.0.1',
  32 + 'startPort' => 2000,
  33 + 'daemonize' => false,
  34 + 'pingInterval' => 30,
  35 + 'pingNotResponseLimit' => 0,
  36 + 'pingData' => '{"type":"ping"}',
  37 +
  38 + // BusinsessWorker配置
  39 + 'businessWorker' => [
  40 + 'name' => 'BusinessWorker',
  41 + 'count' => 1,
  42 + 'eventHandler' => '\think\worker\Events',
  43 + ],
  44 +
  45 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 多语言设置
  4 +// +----------------------------------------------------------------------
  5 +
  6 +return [
  7 + // 默认语言
  8 + 'default_lang' => env('lang.default_lang', 'zh-cn'),
  9 + // 允许的语言列表
  10 + 'allow_lang_list' => [],
  11 + // 多语言自动侦测变量名
  12 + 'detect_var' => 'lang',
  13 + // 是否使用Cookie记录
  14 + 'use_cookie' => true,
  15 + // 多语言cookie变量
  16 + 'cookie_var' => 'think_lang',
  17 + // 扩展语言包
  18 + 'extend_list' => [],
  19 + // Accept-Language转义为对应语言包名称
  20 + 'accept_language' => [
  21 + 'zh-hans-cn' => 'zh-cn',
  22 + ],
  23 + // 是否支持语言分组
  24 + 'allow_group' => false,
  25 +];
  1 +<?php
  2 +
  3 +// +----------------------------------------------------------------------
  4 +// | 日志设置
  5 +// +----------------------------------------------------------------------
  6 +return [
  7 + // 默认日志记录通道
  8 + 'default' => env('log.channel', 'file'),
  9 + // 日志记录级别
  10 + 'level' => [],
  11 + // 日志类型记录的通道 ['error'=>'email',...]
  12 + 'type_channel' => [],
  13 + // 关闭全局日志写入
  14 + 'close' => false,
  15 + // 全局日志处理 支持闭包
  16 + 'processor' => null,
  17 +
  18 + // 日志通道列表
  19 + 'channels' => [
  20 + 'file' => [
  21 + // 日志记录方式
  22 + 'type' => 'File',
  23 + // 日志保存目录
  24 + 'path' => '',
  25 + // 单文件日志写入
  26 + 'single' => false,
  27 + // 独立日志级别
  28 + 'apart_level' => ['consumer','producer','send','receive'],
  29 + // 最大日志文件数量
  30 + 'max_files' => 0,
  31 + // 使用JSON格式记录
  32 + 'json' => false,
  33 + // 日志处理
  34 + 'processor' => null,
  35 + // 关闭通道日志写入
  36 + 'close' => false,
  37 + // 日志输出格式化
  38 + 'format' => '[%s][%s] %s',
  39 + // 是否实时写入
  40 + 'realtime_write' => false,
  41 + // 存入时间
  42 + 'time_format' => 'Y-m-d H:i:s',
  43 + ],
  44 + // 其它日志通道配置
  45 + ],
  46 +
  47 +];
  1 +<?php
  2 +// 中间件配置
  3 +return [
  4 + // 别名或分组
  5 + 'alias' => [],
  6 + // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
  7 + 'priority' => [],
  8 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: yunwuxin <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +
  12 +return [
  13 + 'default' => 'sync',
  14 + 'connections' => [
  15 + 'sync' => [
  16 + 'type' => 'redis',
  17 + ],
  18 + 'database' => [
  19 + 'type' => 'database',
  20 + 'queue' => 'default',
  21 + 'table' => 'jobs',
  22 + ],
  23 + 'redis' => [
  24 + 'type' => 'redis',
  25 + 'queue' => 'default',
  26 + 'host' => '127.0.0.1',
  27 + 'port' => 6379,
  28 + 'password' => '',
  29 + 'select' => 7,
  30 + 'timeout' => 0,
  31 + 'persistent' => false,
  32 + ],
  33 + ],
  34 + 'failed' => [
  35 + 'type' => 'none',
  36 + 'table' => 'failed_jobs',
  37 + ],
  38 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 路由设置
  4 +// +----------------------------------------------------------------------
  5 +
  6 +return [
  7 + // pathinfo分隔符
  8 + 'pathinfo_depr' => '/',
  9 + // URL伪静态后缀
  10 + 'url_html_suffix' => 'html',
  11 + // URL普通方式参数 用于自动生成
  12 + 'url_common_param' => true,
  13 + // 是否开启路由延迟解析
  14 + 'url_lazy_route' => false,
  15 + // 是否强制使用路由
  16 + 'url_route_must' => false,
  17 + // 合并路由规则
  18 + 'route_rule_merge' => false,
  19 + // 路由是否完全匹配
  20 + 'route_complete_match' => false,
  21 + // 访问控制器层名称
  22 + 'controller_layer' => 'controller',
  23 + // 空控制器名
  24 + 'empty_controller' => 'Error',
  25 + // 是否使用控制器后缀
  26 + 'controller_suffix' => false,
  27 + // 默认的路由变量规则
  28 + 'default_route_pattern' => '[\w\.]+',
  29 + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
  30 + 'request_cache' => false,
  31 + // 请求缓存有效期
  32 + 'request_cache_expire' => null,
  33 + // 全局请求缓存排除规则
  34 + 'request_cache_except' => [],
  35 + // 默认控制器名
  36 + 'default_controller' => 'Index',
  37 + // 默认操作名
  38 + 'default_action' => 'index',
  39 + // 操作方法后缀
  40 + 'action_suffix' => '',
  41 + // 默认JSONP格式返回的处理方法
  42 + 'default_jsonp_handler' => 'jsonpReturn',
  43 + // 默认JSONP处理方法
  44 + 'var_jsonp_handler' => 'callback',
  45 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 会话设置
  4 +// +----------------------------------------------------------------------
  5 +
  6 +return [
  7 + // session name
  8 + 'name' => 'PHPSESSID',
  9 + // SESSION_ID的提交变量,解决flash上传跨域
  10 + 'var_session_id' => '',
  11 + // 驱动方式 支持file cache
  12 + 'type' => 'file',
  13 + // 存储连接标识 当type使用cache的时候有效
  14 + 'store' => null,
  15 + // 过期时间
  16 + 'expire' => 1440,
  17 + // 前缀
  18 + 'prefix' => '',
  19 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | Trace设置 开启调试模式后有效
  4 +// +----------------------------------------------------------------------
  5 +return [
  6 + // 内置Html和Console两种方式 支持扩展
  7 + 'type' => 'Html',
  8 + // 读取的日志通道名
  9 + 'channel' => '',
  10 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | 模板设置
  4 +// +----------------------------------------------------------------------
  5 +
  6 +return [
  7 + // 模板引擎类型使用Think
  8 + 'type' => 'Think',
  9 + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
  10 + 'auto_rule' => 1,
  11 + // 模板目录名
  12 + 'view_dir_name' => 'view',
  13 + // 模板后缀
  14 + 'view_suffix' => 'html',
  15 + // 模板文件名分隔符
  16 + 'view_depr' => DIRECTORY_SEPARATOR,
  17 + // 模板引擎普通标签开始标记
  18 + 'tpl_begin' => '{',
  19 + // 模板引擎普通标签结束标记
  20 + 'tpl_end' => '}',
  21 + // 标签库标签开始标记
  22 + 'taglib_begin' => '{',
  23 + // 标签库标签结束标记
  24 + 'taglib_end' => '}',
  25 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +
  12 +// +----------------------------------------------------------------------
  13 +// | Workerman设置 仅对 php think worker 指令有效
  14 +// +----------------------------------------------------------------------
  15 +return [
  16 + // 扩展自身需要的配置
  17 + 'host' => '0.0.0.0', // 监听地址
  18 + 'port' => 2346, // 监听端口
  19 + 'root' => '', // WEB 根目录 默认会定位public目录
  20 + 'app_path' => '', // 应用目录 守护进程模式必须设置(绝对路径)
  21 + 'file_monitor' => false, // 是否开启PHP文件更改监控(调试模式下自动开启)
  22 + 'file_monitor_interval' => 2, // 文件监控检测时间间隔(秒)
  23 + 'file_monitor_path' => [], // 文件监控目录 默认监控application和config目录
  24 +
  25 + // 支持workerman的所有配置参数
  26 + 'name' => 'thinkphp',
  27 + 'count' => 4,
  28 + 'daemonize' => false,
  29 + 'pidFile' => '',
  30 +];
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +
  12 +// +----------------------------------------------------------------------
  13 +// | Workerman设置 仅对 php think worker:server 指令有效
  14 +// +----------------------------------------------------------------------
  15 +return [
  16 + // 扩展自身需要的配置
  17 + 'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
  18 + 'host' => '0.0.0.0', // 监听地址
  19 + 'port' => 8282, // 监听端口
  20 + 'socket' => '', // 完整监听地址
  21 + 'context' => [], // socket 上下文选项
  22 + 'worker_class' => 'app\http\Worker', // 自定义Workerman服务类名 支持数组定义多个服务
  23 +
  24 + // 支持workerman的所有配置参数
  25 + 'name' => 'thinkphp',
  26 + 'count' => 4,
  27 + 'daemonize' => false,
  28 + 'pidFile' => '',
  29 +
  30 + // 支持事件回调
  31 + // onWorkerStart
  32 + 'onWorkerStart' => function ($worker) {
  33 +
  34 + },
  35 + // onWorkerReload
  36 + 'onWorkerReload' => function ($worker) {
  37 +
  38 + },
  39 + // onConnect
  40 + 'onConnect' => function ($connection) {
  41 +
  42 + },
  43 + // onMessage
  44 + 'onMessage' => function ($connection, $data) {
  45 + $connection->send('receive success');
  46 + },
  47 + // onClose
  48 + 'onClose' => function ($connection) {
  49 +
  50 + },
  51 + // onError
  52 + 'onError' => function ($connection, $code, $msg) {
  53 + echo "error [ $code ] $msg\n";
  54 + },
  55 +];
  1 +*
  2 +!.gitignore
  1 +<IfModule mod_rewrite.c>
  2 + Options +FollowSymlinks -Multiviews
  3 + RewriteEngine On
  4 +
  5 + RewriteCond %{REQUEST_FILENAME} !-d
  6 + RewriteCond %{REQUEST_FILENAME} !-f
  7 + RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  8 +</IfModule>
不能预览此文件类型
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +
  12 +// [ 应用入口文件 ]
  13 +namespace think;
  14 +
  15 +require __DIR__ . '/../vendor/autoload.php';
  16 +
  17 +// 执行HTTP应用并响应
  18 +$http = (new App())->http;
  19 +
  20 +$response = $http->run();
  21 +
  22 +$response->send();
  23 +
  24 +$http->end($response);
  1 +User-agent: *
  2 +Disallow:
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +// $Id$
  12 +
  13 +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
  14 + return false;
  15 +} else {
  16 + $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
  17 +
  18 + require __DIR__ . "/index.php";
  19 +}
  1 +*
  2 +!.gitignore
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: liu21st <[email protected]>
  10 +// +----------------------------------------------------------------------
  11 +use think\facade\Route;
  12 +
  13 +Route::get('think', function () {
  14 + return 'hello,ThinkPHP6!';
  15 +});
  16 +
  17 +Route::get('isOnline/:uuid/:wxid', 'index/isOnline'); //查看是否在线
  18 +Route::get('kafka_test', 'kafka_test/index'); //kafka test队列
  19 +Route::get('kafka_login', 'KafkaLogin/kafka_login'); //kafka login队列
  20 +Route::get('kafka_send', 'KafkaSend/kafka_send'); //kafka send队列
  21 +Route::get('kafka_callback', 'KafkaCallback/kafka_callback'); //kafka send队列
  22 +Route::get('phpinfo', 'index/phpinfo'); //phpinfo查看
  1 +*
  2 +!.gitignore
  1 +#!/usr/bin/env php
  2 +<?php
  3 +namespace think;
  4 +
  5 +// 命令行入口文件
  6 +// 加载基础文件
  7 +require __DIR__ . '/vendor/autoload.php';
  8 +
  9 +// 应用初始化
  10 +(new App())->console->run();
  1 +如果不使用模板,可以删除该目录