-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
util.go
67 lines (61 loc) · 1.04 KB
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package xxl
import (
"encoding/json"
"strconv"
)
// Int64ToStr int64 to str
func Int64ToStr(i int64) string {
return strconv.FormatInt(i, 10)
}
//执行任务回调
func returnCall(req *RunReq, code int64, msg string) []byte {
data := call{
&callElement{
LogID: req.LogID,
LogDateTim: req.LogDateTime,
ExecuteResult: &ExecuteResult{
Code: code,
Msg: msg,
},
HandleCode: int(code),
HandleMsg: msg,
},
}
str, _ := json.Marshal(data)
return str
}
//杀死任务返回
func returnKill(req *killReq, code int64) []byte {
msg := ""
if code != SuccessCode {
msg = "Task kill err"
}
data := res{
Code: code,
Msg: msg,
}
str, _ := json.Marshal(data)
return str
}
//忙碌返回
func returnIdleBeat(code int64) []byte {
msg := ""
if code != SuccessCode {
msg = "Task is busy"
}
data := res{
Code: code,
Msg: msg,
}
str, _ := json.Marshal(data)
return str
}
//通用返回
func returnGeneral() []byte {
data := &res{
Code: SuccessCode,
Msg: "",
}
str, _ := json.Marshal(data)
return str
}