支付模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 regels
392 B

  1. package zhios_pay_utils
  2. import (
  3. "encoding/json"
  4. )
  5. func Serialize(data interface{}) []byte {
  6. res, err := json.Marshal(data)
  7. if err != nil {
  8. return []byte{}
  9. }
  10. return res
  11. }
  12. func Unserialize(b []byte, dst interface{}) {
  13. if err := json.Unmarshal(b, dst); err != nil {
  14. dst = nil
  15. }
  16. }
  17. func SerializeStr(data interface{}, arg ...interface{}) string {
  18. return string(Serialize(data))
  19. }