更新qq推送文档

This commit is contained in:
johlanse 2022-11-09 08:38:08 +08:00
parent 899e0b766e
commit cc19ab6ccc
3 changed files with 61 additions and 1 deletions

View File

@ -88,6 +88,7 @@ qq:
# gocq的监听地址 # gocq的监听地址
post_addr: "http://127.0.0.1:5700" post_addr: "http://127.0.0.1:5700"
super_user: 123 super_user: 123
access_token: 123
white_list: white_list:
- 123 - 123

View File

@ -164,6 +164,52 @@ tg:
`/study_all` 按顺序对cookie有效的所有用户进行学习 `/study_all` 按顺序对cookie有效的所有用户进行学习
### QQ推送配置
qq推送配置支持双向交互不过需要对接go-cqhttp框架
配置:
```yaml
qq:
# 是否启用qq推送
enable: true
# gocq端监听的地址默认是5700端口ip根据自己的网络环境调整
post_addr: "http://127.0.0.1:5700"
# 管理员qq号
super_user: 123
# gocq端配置的access_token
access_token: 123
# 白名单消息
white_list:
- 123
```
gocq端配置
```yaml
servers:
# HTTP 通信设置
- http:
# 是否关闭正向HTTP服务器
disabled: false
# 服务端监听地址
host: 127.0.0.1
# 服务端监听端口
port: 5700
# 反向HTTP超时时间, 单位秒
# 最小值为5小于5将会忽略本项设置
timeout: 5
middlewares:
<<: *default # 引用默认中间件
# 反向HTTP POST地址列表
post:
-
url: 'http://127.0.0.1:8085/qq' # 此处配置为study_xxqg的网页地址加上/qq
secret: '' # 密钥
```
更多细节请查看go-cqhttp文档
qq命令请输入```.help```查看
### PushDeer推送配置 ### PushDeer推送配置
pishDeer也仅支持单向推送 pishDeer也仅支持单向推送

View File

@ -2,6 +2,7 @@ package web
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gopkg.in/yaml.v3"
"github.com/johlanse/study_xxqg/conf" "github.com/johlanse/study_xxqg/conf"
) )
@ -46,7 +47,19 @@ func configFileSet() gin.HandlerFunc {
var body map[string]string var body map[string]string
_ = ctx.ShouldBindJSON(&body) _ = ctx.ShouldBindJSON(&body)
err := conf.SaveConfigFile(body["data"]) err := yaml.Unmarshal([]byte(body["data"]), new(conf.Config))
if err != nil {
ctx.JSON(200, Resp{
Code: 503,
Message: "配置提交失败!!",
Data: nil,
Success: false,
Error: err.Error(),
})
return
}
err = conf.SaveConfigFile(body["data"])
if err != nil { if err != nil {
ctx.JSON(200, Resp{ ctx.JSON(200, Resp{
Code: 503, Code: 503,