- task schedule added.

This commit is contained in:
gazebo
2018-09-15 18:53:39 +08:00
parent b2d365e36f
commit af5038e8a7
7 changed files with 444 additions and 1 deletions

View File

@@ -7,3 +7,24 @@ func MergeStoreStatus(status int, vendorStatus int) int {
}
return vendorStatus
}
func SplitSlice(list []interface{}, batchCount int) (listInList [][]interface{}) {
len := len(list)
if len > 0 {
listInListLen := (len-1)/batchCount + 1
listInList = make([][]interface{}, listInListLen)
index := 0
for i := 0; i < len; i++ {
if i%batchCount == 0 {
index = i / batchCount
arrLen := len - i
if arrLen > batchCount {
arrLen = batchCount
}
listInList[index] = make([]interface{}, arrLen)
}
listInList[index][i%batchCount] = list[i]
}
}
return listInList
}