修改登录接口

This commit is contained in:
Cool 2024-11-05 18:38:23 +08:00
parent f570189652
commit e3c9470b4d
1 changed files with 54 additions and 54 deletions

View File

@ -1,13 +1,15 @@
package main package main
import ( import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"time"
"os"
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
"github.com/eatmoreapple/openwechat" "github.com/eatmoreapple/openwechat"
) )
@ -64,12 +66,11 @@ func HttpPost(url string, data interface{}, timelim int) []byte {
func main() { func main() {
bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式,上面登录不上的可以尝试切换这种模式 bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式
reloadStorage := openwechat.NewJsonFileHotReloadStorage("storage.json")
defer reloadStorage.Close()
err := bot.PushLogin(reloadStorage, openwechat.NewRetryLoginOption()) // 注册登陆二维码回调
if err != nil { bot.UUIDCallback = openwechat.PrintlnQrcodeUrl
if err := bot.Login(); err != nil {
fmt.Println(err) fmt.Println(err)
return return
} }
@ -119,7 +120,6 @@ func main() {
// 调用Stable Diffusion // 调用Stable Diffusion
// msg.ReplyText("这个功能还没有实现,可以先期待一下~") // msg.ReplyText("这个功能还没有实现,可以先期待一下~")
sender, _ := msg.Sender() sender, _ := msg.Sender()
content = strings.TrimLeft(content[len("生成图片"):], " \t\n") content = strings.TrimLeft(content[len("生成图片"):], " \t\n")
resp_raw := HttpPost("http://localhost:11111/draw", GenerateImageRequest{UserName: sender.ID(), Prompt: content}, 120) resp_raw := HttpPost("http://localhost:11111/draw", GenerateImageRequest{UserName: sender.ID(), Prompt: content}, 120)