xybot/tool/api.go
2025-04-17 14:59:55 +08:00

27 lines
1.1 KiB
Go

package tool
import "github.com/go-resty/resty/v2"
type API interface {
CheckDatabaseOK() (running bool, err error) // 检查数据库是否正常
IsRunning() (flag bool, err error) // 是否在运行
CdnDownloadImg(aesKey, cdnMidImgUrl string) (dataBase64Str string, err error) // 下载图片
DownloadAttach(attachId string) (dataBase64Str string, err error) // 下载附件
DownloadVideo(msgId int) (dataBase64Str string, err error) // 下载视频
DownloadVoice(msgId int, voiceUrl string, length int) (dataBase64Str string, err error) // 下载语音
SetProxy(param SetProxyRequest) (err error) // 设置代理
SetStep(stepCount int) (err error) // 设置步数
}
type service struct {
client *resty.Client
wxId string
}
func New(client *resty.Client, wxId string) API {
return &service{
client: client,
wxId: wxId,
}
}