util.go 432 B

1234567891011121314151617181920212223
  1. package util
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
  5. "crypto/sha256"
  6. "fmt"
  7. )
  8. // sha1 加密
  9. func GetHashKey(bs []byte) string {
  10. defer common.Catch()
  11. ha := sha256.New()
  12. ha.Write(bs)
  13. hbs := ha.Sum(nil)
  14. key := fmt.Sprintf("%x", hbs)
  15. return key
  16. }
  17. // 创建订单号
  18. func GetOrderCode(name string) string {
  19. return fmt.Sprintf("%s-%s", name, <-jy.VarOrderCode.Pool)
  20. }