用户点击`获取二维码`,请求二维码生成接口:`https://www.iyuu.cn/qrcode`,返回二维码参数:
```json
{"ticket":"gQH47zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAycTMtdzlMVEhlYzIxcF9jQU50MWsAAgQHjGRdAwR4AAAA","expire_seconds":120,"uid":1735536450}
```
注:uid通过函数`rand(1,4294967200)`生成并查询缓存,确保唯一后放入Redis缓存。){
return;
}
// 通过workerman,向uid的页面推送数据
$ret = sendMessageByUid($uid, $buffer);
// 返回推送结果;
Worker::stopAll();
});
};
// 当有客户端发来消息时执行的回调函数
$worker->onMessage = function($connection, $datamessage = json_decode($data, true);
if(empty($message)) return;
if(isset($message['cmd'])) {
// 根据类型执行不同的业务