base.py 670 B

123456789101112131415161718192021222324252627282930
  1. # coding=utf-8
  2. class Formater(object):
  3. @staticmethod
  4. def formatPrice(value):
  5. return int(round(float(value or 0) * 100,0))
  6. @staticmethod
  7. def formatPriceShow(value):
  8. return '%.2f' % (float(value or 0)/100.0)
  9. @staticmethod
  10. def formatCount(value):
  11. return int(round(float(value or 0) * 100, 0))
  12. @staticmethod
  13. def formatCountShow(value):
  14. return '%.2f' % (float(value or 0) / 100.0)
  15. @staticmethod
  16. def formatAmount(value):
  17. return int(round(float(value or 0) * 10000, 0))
  18. @staticmethod
  19. def formatAmountShow(value):
  20. return '%.2f' % (float(value or 0) / 10000.0 + 0.0000001)