docs: update docs

This commit is contained in:
johlanse 2021-12-06 19:25:30 +08:00
parent c27a86ac8d
commit 8a647b5791
7 changed files with 158 additions and 57 deletions

View File

@ -4,68 +4,15 @@
该项目基于[playwright-go](https://github.com/mxschmitt/playwright-go) 开发,支持*windows**linux*,*mac* 该项目基于[playwright-go](https://github.com/mxschmitt/playwright-go) 开发,支持*windows**linux*,*mac*
若在使用过程中出现什么不可预料的问题欢迎提交*issue* 若在使用过程中出现什么不可预料的问题欢迎提交*issue*
+ [配置参考](./docs/config.md)
+ [推送参考](./docs/push.md)
## 使用 ## 使用
+ 从release下载对应版本压缩包 + [Windows使用](./docs/windows/index.md)
+ windows一般下载 **study_xxqg_windows_amd64.zip** + [Linux使用](./docs/linux/index.md)
+ 首次打开会在 ```config\config.yml```生成默认配置文件
+ 生成配置文件后第一次打开会自动安装无头浏览器,可能需要耐心等待
+ 再次打开即可运行
+ windows环境推荐直接打开浏览器扫码或者在控制台出现二维码后打开当前目录```screen.png```进行扫码
+ 其他无头浏览环境请配置[pushplus](http://www.pushplus.plus/) 推送进行扫码
## 配置文件
```yaml
# 刷课模式默认为3
# 1只刷文章何视频
# 2只刷文章和视频和每日答题
# 3刷文章和视频和每日答题每周答题和专项答题
model: 3
# 日志等级
# panic
# fatal
# error
# warn, warning
# info
# debug
# trace
log_level: "info"
# 是否显示浏览器
show_browser: true
push:
ding:
enable: false
access_token: ""
secret: ""
# 目前仅支持pushplus推送二维码默认建议使用pushplus推送
# pushplus使用方法见http://www.pushplus.plus/
push_plus:
enable: true
token: ""
# 通过telegram进行交互模式当配置tg.enable为true时会自动注册bot命令
# telegram_bot使用教程https://www.dazhuanlan.com/leemode/topics/927496
tg:
enable: false
chat_id: 0
token: ""
proxy: ""
# 设置是否定时执行学习程序格式为cron格式
# "9 19 * * *" 每天19点9分执行一次
# "* 10 * * *” 每天早上十点执行一次
cron: ""
```
>telegram推送使用参考
![](https://raw.githubusercontent.com/johlanse/study_xxqg/main/config/tg.jpg)
## 申明,该项目仅用于学习。 ## 申明,该项目仅用于学习。
## 鸣谢 ## 鸣谢

7
docs/README.md Normal file
View File

@ -0,0 +1,7 @@
+ [配置参考](./config.md)
+ [推送参考](./push.md)
## 使用
+ [Windows使用](./windows/index.md)
+ [Linux使用](./linux/index.md)

46
docs/config.md Normal file
View File

@ -0,0 +1,46 @@
## 配置文件
```yaml
# 刷课模式默认为3
# 1只刷文章何视频
# 2只刷文章和视频和每日答题
# 3刷文章和视频和每日答题每周答题和专项答题
model: 3
# 日志等级
# panic
# fatal
# error
# warn, warning
# info
# debug
# trace
log_level: "info"
# 是否显示浏览器
show_browser: true
push:
ding:
enable: false
access_token: ""
secret: ""
# 目前仅支持pushplus推送二维码默认建议使用pushplus推送
# pushplus使用方法见http://www.pushplus.plus/
push_plus:
enable: true
token: ""
# 通过telegram进行交互模式当配置tg.enable为true时会自动注册bot命令
# telegram_bot使用教程https://www.dazhuanlan.com/leemode/topics/927496
tg:
enable: false
chat_id: 0
token: ""
proxy: ""
# 设置是否定时执行学习程序格式为cron格式
# "9 19 * * *" 每天19点9分执行一次
# "* 10 * * *” 每天早上十点执行一次
cron: ""
```

13
docs/linux/index.md Normal file
View File

@ -0,0 +1,13 @@
## linux基本使用
+ 本地访问[Releases]([Release](https://github.com/johlanse/study_xxqg/releases)) ,查找对应版本并复制链接
+ 使用wget下载对应版本压缩包
+ > tag -xzvf study_xxqg_linux_amd64.tag.gz
+ 运行 ```./study_xxqg```,首次运行会生成默认配置文件
+ 使用vim修改对应配置文件linux建议使用tg模式运行详情配置参考[配置](../config.md),推送方式查看[push](../push.md)
+ 再次运行即可
## docker运行
+ 等待docker大佬贡献docker教程

25
docs/problem.md Normal file
View File

@ -0,0 +1,25 @@
## 常见问题
+ ### windows打开**study_xxqg.exe**出现直接闪退
> 在文件路径栏输入**cmd**,然后再黑色命令窗口中输入```./study_xxqg.exe```,
> 然后查看报错内容截图并在[github](https://github.com/johlanse/study_xxqg/issues) 提交issue
+ ### arm设备报错```could not download driver: could not check if driver is up2date: could not run driver: exit status 127```
>因为playwright官方对arm设备支持会出现一些问题所以需要手动安装node.js并创建软连接
>
> > apt-get install nodejs
>
> > ln -s /usr/bin/node ~/.cache/ms-playwright-go/1.14.0/node
+ ### linux退出终端后脚本停止运行
> 可以使用screen或者nohup等命令后台运行具体命令自行百度
>
> nohup参考命令
> > nohup ./study_xxqg > xxqg.log 2>&1 & echo $! >pid.pid
>
> 退出程序可以通过**cat pid.pid**查看程序pid,然后kill对应pid进行退出
+ ### 刷文章或者视频无法加分
> 偶尔出现视频和文章无法加分的bug,可以进行等待一段时间后重启程序再次测试,目前尚不清楚造成原因

54
docs/push.md Normal file
View File

@ -0,0 +1,54 @@
## 推送配置
### 钉钉推送
配置config.yml的如下部分,具体使用教程详情参考[钉钉](https://developers.dingtalk.com/document/robots/custom-robot-access?spm=ding_open_doc.document.0.0.7f875e5903iVpC#topic-2026027)
```yaml
ding:
enable: true
access_token: ""
secret: ""
```
### pushplus推送
配置config.yml的如下部分具体使用教程参考[pushplus](https://www.pushplus.plus/)
```yaml
push_plus:
enable: true
token: ""
```
### telegram推送
## Telegram Bot
配置 config.yml的如下部分
```yaml
tg:
enable: false
chat_id: 0
token: ""
proxy: ""
```
### 配置
1. 在 Tg 中搜索[`@BotFather`](https://t.me/BotFather) ,发送指令`/newbot`创建一个 bot
2. 获取你创建好的 API Token 格式为`123456789:AAaaaa-Uuuuuuuuuuu` ,要完整复制**全部内容**
3. 在 Tg 中搜索[`@userinfobot`](https://t.me/userinfobot) ,点击`START`,它就会给你发送你的信息,记住 Id 即可,是一串数字。
4. 跟你创建的 bot 会话,点击`START`,或者发送`/start`
5. 将第 2 步获取的 token 放在`tokenn`中,第 3 步获取的 Id 放到`chat_id`中,`enable`设置为 true。
6. 因为众所周知的原因telegram推送需要进行配置代理例如clash的代理配置为```http://127.0.0.1:7890```即可
增加 telegram bot 指令支持
`/login` 添加一个用户
`/get_users` 获取所有cookie有效的用户
`/study 张三` 指定账号学习,若只存在一个用户则自动选择学习
`/get_scores` 获取账户积分
`/quit` 退出正在学习的实例当长时间无响应时建议退出并查看日志然后提交issue
`/study_all` 按顺序对cookie有效的所有用户进行学习

9
docs/windows/index.md Normal file
View File

@ -0,0 +1,9 @@
## windows使用教程
+ 浏览器访问[Release](https://github.com/johlanse/study_xxqg/releases)
+ 选择最新版本下载 ```study_xxqg_amd64.zip```
+ 将其解压到合适的位置
+ 进入解压后的文件夹,双击运行```study_xxqg.exe```,第一次打开可能会出现闪退发现文件夹下生成了config文件夹
+ 打开config目录下的```confif.yml```文件,进行编辑,详情内容见[配置文件](../config.md)
+ 再次进行运行```study_xxqg.exe```