蛋蛋星球-制度模式
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.

33 lines
602 B

  1. package saobei
  2. import (
  3. "fmt"
  4. )
  5. // BizErr 用于判断通联的业务逻辑是否有错误
  6. type BizErr struct {
  7. Code string `json:"code"`
  8. Msg string `json:"msg"`
  9. }
  10. // bizErrCheck 检查返回码是否为SUCCESS 否则返回一个BizErr
  11. func bizErrCheck(resp RspBase) error {
  12. if resp.ReturnCode != "01" {
  13. return &BizErr{
  14. Code: resp.ReturnCode,
  15. Msg: resp.ReturnMsg,
  16. }
  17. }
  18. //if resp.ResultCode != "01" {
  19. // return &BizErr{
  20. // Code: resp.ResultCode,
  21. // Msg: resp.ReturnMsg,
  22. // }
  23. //}
  24. return nil
  25. }
  26. func (e *BizErr) Error() string {
  27. return fmt.Sprintf(`[%s]%s`, e.Code, e.Msg)
  28. }