From b0816c2105add3e75f85a7ff9b349864f1a1dabb Mon Sep 17 00:00:00 2001 From: johlanse Date: Sun, 24 Apr 2022 16:55:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0web=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/push.md | 16 ++++++++++++++++ lib/respond.go | 2 +- model/user.go | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/push.md b/docs/push.md index a3331b1..22b4685 100644 --- a/docs/push.md +++ b/docs/push.md @@ -1,5 +1,21 @@ ## 推送配置 +### web推送 +> 适用于部署在服务器上或者家里有公网IP的设备上 + +配置config.yml的如下部分 +```yaml +web: + # 启用web + enable: true + # 监听的ip,若只需要本机访问则设置为127.0.0.1,监听本机所有ip为0.0.0.0 + host: 0.0.0.0 + # 监听的端口号 0-65535可选 + port: 8081 +``` + +开启后通过浏览器访问 *http://ip:port*即可打开网址 + ### 钉钉推送 配置config.yml的如下部分,具体使用教程详情参考[钉钉](https://developers.dingtalk.com/document/robots/custom-robot-access?spm=ding_open_doc.document.0.0.7f875e5903iVpC#topic-2026027) ```yaml diff --git a/lib/respond.go b/lib/respond.go index 3f8bae3..1d4b89f 100644 --- a/lib/respond.go +++ b/lib/respond.go @@ -152,7 +152,6 @@ func (c *Core) RespondDaily(user *model.User, model string) { continue } if enabled { - log.Infoln("检测到有答案未提交,将重新提交") err := btn.Click() if err != nil { log.Errorln("提交答案失败") @@ -270,6 +269,7 @@ func (c *Core) RespondDaily(user *model.User, model string) { log.Errorln("获取网页全体内容失败" + err.Error()) goto label } + time.Sleep(time.Second * time.Duration(rand2.Intn(3))) log.Debugln("以获取网页内容") err = openTips.Click() if err != nil { diff --git a/model/user.go b/model/user.go index 89f6325..92b49b4 100644 --- a/model/user.go +++ b/model/user.go @@ -39,7 +39,7 @@ type User struct { func Query() ([]*User, error) { var users []*User ping() - results, err := db.Query("select * from user") + var results, err = db.Query("select * from user") if err != nil { return nil, err }