add QQ扫码登录

This commit is contained in:
ZJY 2021-09-29 11:31:57 +08:00
parent 643ce4eb51
commit 54910e1503

View File

@ -1,10 +1,13 @@
package models
import (
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"github.com/beego/beego/v2/client/httplib"
"github.com/beego/beego/v2/core/logs"
"io/ioutil"
"regexp"
"strings"
"time"
@ -139,12 +142,21 @@ var codeSignals = []CodeSignal{
{
Command: []string{"qrcode", "扫码", "二维码", "scan"},
Handle: func(sender *Sender) interface{} {
rsp, err := httplib.Get("http://127.0.0.1:5703/api/login/qrcode1").Response()
rsp, err := httplib.Get("https://api.kukuqaq.com/jd/qrcode").Response()
if err != nil {
return nil
}
logs.Info(rsp.Body)
return rsp
body, err1 := ioutil.ReadAll(rsp.Body)
if err1 == nil {
fmt.Println(string(body))
}
s := &QQuery{}
if len(body) > 0 {
json.Unmarshal(body, &s)
}
logs.Info(s.Data.QqLoginQrcode.Bytes)
ddd, _ := base64.StdEncoding.DecodeString(s.Data.QqLoginQrcode.Bytes)
return ddd
},
},
{