12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2020/1/13
- * Time: 16:28
- */
- namespace app\worker\controller;
- use GatewayWorker\Lib\Gateway;
- use think\worker\Server;
- use Workerman\Lib\Timer;
- class Worker extends Server
- {
- // protected $socket = 'websocket://0.0.0.0:2347';
- // todo 运行方法 php think worker:server
- public function onWorkerStart()
- {
- // 定时器
- $user=new User();
- $user->index();// 处理失效订单
- }
- // 连接的时候
- // public function onConnect($connection)
- // {
- // // Gateway::log(1212);
- // dump(($connection));
- //// dump($connection->onMessage);
- //
- // }
- // // 接送到消息
- // public function onMessage($connection,$data)
- // {
- //
- // // var_dump($data);
- //
- // // Gateway::sendToAll("21212");
- //
- // $connection->send(json_encode($data));
- // }
- //
- //
- //
- //
- //
- // // 关闭链接
- // public function onClose($connection)
- // {
- //
- // }
- //
- //// 重新启动 woker
- // public function onWorkerReload($worker)
- // {
- //
- // }
- }
|