开放接口,修复上游同步不对的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s
This commit is contained in:
73
pkg/constants/agent_open_api.go
Normal file
73
pkg/constants/agent_open_api.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package constants
|
||||
|
||||
import "time"
|
||||
|
||||
// 代理开放接口请求头名称
|
||||
const (
|
||||
AgentOpenAPIHeaderAccount = "X-Agent-Account" // 开放接口账号请求头
|
||||
AgentOpenAPIHeaderPassword = "X-Agent-Password" // 开放接口密码请求头
|
||||
AgentOpenAPIHeaderTimestamp = "X-Agent-Timestamp" // 开放接口时间戳请求头
|
||||
AgentOpenAPIHeaderNonce = "X-Agent-Nonce" // 开放接口随机串请求头
|
||||
AgentOpenAPIHeaderSign = "X-Agent-Sign" // 开放接口签名请求头
|
||||
)
|
||||
|
||||
// 代理开放接口签名配置
|
||||
const (
|
||||
AgentOpenAPISignatureWindow = 5 * time.Minute // 签名允许时间窗
|
||||
AgentOpenAPIBatchNoPrefix = "AOP" // 开放接口批次号前缀
|
||||
)
|
||||
|
||||
// 代理开放接口卡状态
|
||||
const (
|
||||
AgentOpenAPICardStatusNormal = "normal" // 正常
|
||||
AgentOpenAPICardStatusStopped = "stopped" // 停机
|
||||
AgentOpenAPIWalletCurrencyCNY = "CNY" // 人民币币种
|
||||
)
|
||||
|
||||
// AgentOpenAPICardStatusName 返回开放接口卡状态名称
|
||||
func AgentOpenAPICardStatusName(status string) string {
|
||||
switch status {
|
||||
case AgentOpenAPICardStatusNormal:
|
||||
return "正常"
|
||||
case AgentOpenAPICardStatusStopped:
|
||||
return "停机"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
// AgentOpenAPIPackageTypeName 返回开放接口套餐类型名称
|
||||
func AgentOpenAPIPackageTypeName(packageType string) string {
|
||||
switch packageType {
|
||||
case PackageTypeFormal:
|
||||
return "正式套餐"
|
||||
case PackageTypeAddon:
|
||||
return "附加套餐"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
// AgentOpenAPIStopReasonName 返回开放接口停机原因名称
|
||||
func AgentOpenAPIStopReasonName(reason string) string {
|
||||
switch reason {
|
||||
case StopReasonTrafficExhausted:
|
||||
return "流量耗尽"
|
||||
case StopReasonManual:
|
||||
return "手动停机"
|
||||
case StopReasonArrears:
|
||||
return "欠费"
|
||||
case StopReasonProtectPeriod:
|
||||
return "保护期自动停机"
|
||||
case StopReasonNoPackage:
|
||||
return "无有效套餐"
|
||||
case StopReasonNotRealname:
|
||||
return "未完成实名认证"
|
||||
case StopReasonCarrierStopped:
|
||||
return "运营商侧停机"
|
||||
case "":
|
||||
return ""
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user