uitls.go 345 B

1234567891011121314151617
  1. package utils
  2. func OrderIdRange(OrderId int64) (int64, int64) {
  3. minOrderId := OrderId //后面有几个零
  4. var maxStep int64 = 1
  5. currValue := minOrderId
  6. for {
  7. if currValue%10 == 0 {
  8. currValue = currValue / 10
  9. maxStep = maxStep * 10
  10. } else {
  11. break
  12. }
  13. }
  14. maxOrderId := minOrderId + maxStep - 1
  15. return minOrderId, maxOrderId
  16. }