- no platform dependency in sync.go
This commit is contained in:
@@ -131,3 +131,20 @@ func GetSliceLen(list interface{}) int {
|
||||
func CaculateSkuVendorPrice(price int, percentage int) int {
|
||||
return price * percentage / 100
|
||||
}
|
||||
|
||||
// 生成一个不重复的临时ID
|
||||
func genFakeID1() int64 {
|
||||
return time.Now().UnixNano() / 1000000
|
||||
}
|
||||
|
||||
func GenFakeID() int64 {
|
||||
return genFakeID1() * 2
|
||||
}
|
||||
|
||||
func IsFakeID(id int64) bool {
|
||||
if id == 0 {
|
||||
return true
|
||||
}
|
||||
multiple := id / genFakeID1()
|
||||
return multiple == 2 || multiple == 3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user