feat(osi): 实现通用 Call 与响应判码(T-004)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package osi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
ServiceIDJKDAFind = "JKDA00002"
|
||||
)
|
||||
|
||||
const codeRetryableTimeout = "405"
|
||||
|
||||
var servicePaths = map[string]string{
|
||||
ServiceIDJKDAFind: "/auto/jkda/find",
|
||||
}
|
||||
|
||||
func PathOf(serviceID string) (string, error) {
|
||||
path, ok := servicePaths[serviceID]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unknown serviceId %q", serviceID)
|
||||
}
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func IsSuccessCode(code string) bool {
|
||||
code = strings.TrimSpace(code)
|
||||
code = strings.TrimLeft(code, "0")
|
||||
return code == "1"
|
||||
}
|
||||
|
||||
func IsRetryableCode(code string) bool {
|
||||
return strings.TrimSpace(code) == codeRetryableTimeout
|
||||
}
|
||||
Reference in New Issue
Block a user