From fab4b60b66e2761a97672f459b4c6bbdbc01fc19 Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Wed, 29 Sep 2021 10:34:03 +0800 Subject: [PATCH] =?UTF-8?q?add=20QQ=E6=89=AB=E7=A0=81=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/login.go | 2 +- models/command.go | 32 +++++++++++--------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/controllers/login.go b/controllers/login.go index f0ee0db..ea3b216 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -93,7 +93,7 @@ func (c *LoginController) GetQrcode1() { jsonByte, _ := json.Marshal(s) jsonStr := string(jsonByte) fmt.Printf("%v", jsonStr) - //c.Ctx.WriteString(`{"url":"` + "url" + `","img":"` + base64.StdEncoding.EncodeToString(data) + `"}`) //"data:image/png;base64," + + c.Ctx.WriteString(`{"url":"` + "url" + `","img":"` + string(s.Data.QqLoginQrcode.Bytes) + `"}`) //"data:image/png;base64," + } diff --git a/models/command.go b/models/command.go index 2464588..8ad672d 100644 --- a/models/command.go +++ b/models/command.go @@ -3,6 +3,7 @@ package models import ( "errors" "fmt" + "github.com/beego/beego/v2/client/httplib" "github.com/beego/beego/v2/core/logs" "regexp" "strings" @@ -135,27 +136,16 @@ var codeSignals = []CodeSignal{ return nil }, }, - //{ - // Command: []string{"qrcode", "扫码", "二维码", "scan"}, - // Handle: func(sender *Sender) interface{} { - // rsp, err := httplib.Get("https://api.kukuqaq.com/jd/qrcode").Response() - // if err != nil { - // return nil - // } - // body, err1 := ioutil.ReadAll(rsp.Body) - // if err1 == nil { - // fmt.Println(string(body)) - // } - // s := &QQuery{} - // if len(body) > 0 { - // json.Unmarshal(body, &s) - // } - // jsonByte, _ := json.Marshal(s) - // jsonStr := string(jsonByte) - // fmt.Printf("%v", jsonStr) - // return `{"url":"` + "http://www.baidu.com" + `","img":"` + s.Data.QqLoginQrcode.Bytes + `"}` - // }, - //}, + { + Command: []string{"qrcode", "扫码", "二维码", "scan"}, + Handle: func(sender *Sender) interface{} { + rsp, err := httplib.Get("http://127.0.0.1:%d/api/login/qrcode1").Response() + if err != nil { + return nil + } + return rsp + }, + }, { Command: []string{"sign", "打卡", "签到"}, Handle: func(sender *Sender) interface{} {