diff --git a/platformapi/alipayapi/pay_for_user.go b/platformapi/alipayapi/pay_for_user.go index 7042604c..5a3229a9 100644 --- a/platformapi/alipayapi/pay_for_user.go +++ b/platformapi/alipayapi/pay_for_user.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/gopay-main/pkg/util" "io/ioutil" "strings" ) @@ -127,19 +126,19 @@ func GetCertSN(certPathOrData interface{}) (sn string, err error) { case string: certData, err = ioutil.ReadFile(pathOrData) if err != nil { - return util.NULL, err + return "", err } case []byte: certData = pathOrData default: - return util.NULL, errors.New("certPathOrData 证书类型断言错误") + return "", errors.New("certPathOrData 证书类型断言错误") } block, _ := pem.Decode(certData) if block != nil { cert, err := x509.ParseCertificate(block.Bytes) if err != nil { - return util.NULL, err + return "", err } name := cert.Issuer.String() serialNumber := cert.SerialNumber.String() @@ -148,8 +147,8 @@ func GetCertSN(certPathOrData interface{}) (sn string, err error) { h.Write([]byte(serialNumber)) sn = hex.EncodeToString(h.Sum(nil)) } - if sn == util.NULL { - return util.NULL, errors.New("failed to get sn,please check your cert") + if sn == "" { + return "", errors.New("failed to get sn,please check your cert") } return sn, nil } @@ -180,12 +179,12 @@ func GetRootCertSN(rootCertPathOrData interface{}) (sn string, err error) { case string: certData, err = ioutil.ReadFile(pathOrData) if err != nil { - return util.NULL, err + return "", err } case []byte: certData = pathOrData default: - return util.NULL, errors.New("rootCertPathOrData 断言异常") + return "", errors.New("rootCertPathOrData 断言异常") } pems := strings.Split(string(certData), certEnd) @@ -203,15 +202,15 @@ func GetRootCertSN(rootCertPathOrData interface{}) (sn string, err error) { h := md5.New() h.Write([]byte(name)) h.Write([]byte(serialNumber)) - if sn == util.NULL { + if sn == "" { sn += hex.EncodeToString(h.Sum(nil)) } else { sn += "_" + hex.EncodeToString(h.Sum(nil)) } } } - if sn == util.NULL { - return util.NULL, errors.New("failed to get sn,please check your cert") + if sn == "" { + return "", errors.New("failed to get sn,please check your cert") } return sn, nil }