- no platform dependency in sync.go

This commit is contained in:
gazebo
2018-10-11 22:17:20 +08:00
parent 02b97909bc
commit 6133998e54
17 changed files with 152 additions and 52 deletions

View File

@@ -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
}