RobotWeb官方机器人PHP框架 – 搭建运行教程

图片[1]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

准备工作

开始工作(点击图片可以放大)

  • Nginx任意版本
  • PHP7.3版本(强制要求)(安装扩展:fileinfo,redis)
  • PHP扩展:RedisSwoole Compiler
  • 运行目录:/public
  • 伪静态

1.服务器操作系统选择-应用模板–宝塔Liuxn面板

图片[2]-[AList]简单搭建一个属于自己的网盘(美化版)

2.将域名解析到你的服务器IP地址

图片[3]-[AList]简单搭建一个属于自己的网盘(美化版)

3.打开宝塔应用商店

  • 安装Redis 打开设置-将requirepass(密码)清空
  • 安装PHP7.3版本(强制要求)
图片[4]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

4.添加网站(PHP7.3)-绑定域名-上传PHP源码-设置运行目录为/public

图片[5]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客
图片[6]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

5.添加SSL证书-配置伪静态(NGINX)

location / {
    try_files $uri $uri/ /index.php?$query_string;
}
图片[7]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客
图片[8]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

6.安装PHP7.3扩展-访问首页安装Swoole Compiler拓展

图片[9]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客
图片[10]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

7.配置机器人信息

文件路径:/config/robot.php

图片[11]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客
图片[12]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

图片[13]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客
图片[14]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

8.配置WebHook(请务必先完成以上步骤)

图片[15]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

9.测试机器人状态

图片[16]-RobotWeb官方机器人PHP框架 – 搭建运行教程-单华博客

机器人配置写法

文件路径:/app/Http/Plugs/NathanDemo/Index.php

插入到15行左右注释行内即可

// 多行文字
            case mb_strpos($content, '客服') !== false:
                $sendData = [
                    '-======请用手机=======-' => null,
                    '单华QQ:  DanHua790  (手机QQ)' => null,
                    '萱萱QQ:  Egg4348  (手机QQ)' => null,
                    '=-====================-=' => null,
                    'WX微信:  DanHua790' => null,
                    '==-==================-==' => null,
                    '永久导航网  DanHua,cc' => null,
                ];
                $sendContent = $BaseController->replaceDotsInDomains($BaseController->formatDataToString($sendData));
                return $sendContent;
                break;
// 图片
            case mb_strpos($content, '图片') !== false:
                $sendContent = json_encode(['send_type' => 1,'send_info' => 'https://shop.danhua.cc/assets/static/general/image/2024-11-02/9b184885942d1dc2e19bbf4d46201095.png']);
                return $sendContent;
                break;
                //视频
                return $sendContent;
                break;
            case mb_strpos($content, '来个视频') !== false:
                $sendContent = json_encode(['send_type' => 2,'send_info' => 'https://api.gtme.cn/api/spdq']);
                return $sendContent;
                break;

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容