Files
jx-callback/business/jxutils/jxutils_cms.go
2018-09-15 18:53:39 +08:00

31 lines
699 B
Go

package jxutils
// 合并得到最终的门店状态
func MergeStoreStatus(status int, vendorStatus int) int {
if status < vendorStatus {
return status
}
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
}