V2.7 增加agent执行器

This commit is contained in:
georgehao
2019-07-03 22:31:27 +08:00
parent c3a89e9243
commit 37fb659c4e
48 changed files with 2832 additions and 513 deletions

View File

@@ -11,6 +11,7 @@ package libs
import (
"crypto/md5"
"fmt"
"github.com/axgle/mahonia"
"math/rand"
"regexp"
"time"
@@ -67,3 +68,16 @@ func GetRandomString(lens int) string {
}
return string(result)
}
func GbkAsUtf8(str string) string {
srcDecoder := mahonia.NewDecoder("gbk")
desDecoder := mahonia.NewDecoder("utf-8")
resStr := srcDecoder.ConvertString(str)
_, resBytes, _ := desDecoder.Translate([]byte(resStr), true)
return string(resBytes)
}
//任务识别码
func JobKey(taskId, serverId int) int {
return taskId*10000000 + serverId
}