31 lines
699 B
Go
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
|
|
}
|