mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
✏️ make lint happy
This commit is contained in:
parent
a9f98763c4
commit
4ad7ff7971
@ -1,7 +1,4 @@
|
||||
// Package webctrl
|
||||
/*
|
||||
* 一个用户webui的包,里面包含了webui所需的所有内容
|
||||
*/
|
||||
// Package webctrl 包含 webui 所需的所有内容
|
||||
package webctrl
|
||||
|
||||
import (
|
||||
|
||||
@ -5,6 +5,7 @@ package file
|
||||
|
||||
import "os"
|
||||
|
||||
// Pwd 获取当前路径
|
||||
func Pwd() (path string) {
|
||||
path, _ = os.Getwd()
|
||||
return
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Pwd 获取当前路径的正斜杠表示
|
||||
func Pwd() string {
|
||||
path, _ := os.Getwd()
|
||||
return strings.ReplaceAll(path, "\\", "/")
|
||||
|
||||
@ -2,6 +2,7 @@ package file
|
||||
|
||||
import "os"
|
||||
|
||||
// BOT_PATH BOT当前路径
|
||||
var BOT_PATH = Pwd()
|
||||
|
||||
// IsExist 文件/路径存在
|
||||
@ -10,7 +11,7 @@ func IsExist(path string) bool {
|
||||
return err == nil || os.IsExist(err)
|
||||
}
|
||||
|
||||
// IsExist 文件/路径不存在
|
||||
// IsNotExist 文件/路径不存在
|
||||
func IsNotExist(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return err != nil && os.IsNotExist(err)
|
||||
|
||||
@ -82,7 +82,7 @@ func GetLazyData(path string, isReturnDataBytes, isDataMustEqual bool) ([]byte,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(data) <= 0 {
|
||||
if len(data) == 0 {
|
||||
return nil, errors.New("read body len <= 0")
|
||||
}
|
||||
if filemd5 != nil {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Package process 流程控制相关
|
||||
package process
|
||||
|
||||
import (
|
||||
@ -5,6 +6,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// SleepAbout1sTo2s 随机阻塞等待 1 ~ 2s
|
||||
func SleepAbout1sTo2s() {
|
||||
time.Sleep(time.Second + time.Millisecond*time.Duration(rand.Intn(1000)))
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Package web 网络处理相关
|
||||
package web
|
||||
|
||||
import (
|
||||
@ -6,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ReqWith 使用自定义请求头获取数据
|
||||
func ReqWith(url string, method string, referer string, ua string) (data []byte, err error) {
|
||||
client := &http.Client{}
|
||||
// 提交请求
|
||||
@ -25,6 +27,7 @@ func ReqWith(url string, method string, referer string, ua string) (data []byte,
|
||||
return
|
||||
}
|
||||
|
||||
// GetData 获取数据
|
||||
func GetData(url string) (data []byte, err error) {
|
||||
var response *http.Response
|
||||
response, err = http.Get(url)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user