V2.7 增加agent执行器
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user