This commit is contained in:
2026-07-27 00:18:02 +08:00
parent c3b0de6ac5
commit 6fbdac381b
9 changed files with 217 additions and 6 deletions

View File

@@ -21,10 +21,11 @@ const (
CodeParamEmpty = "100012" // 请求参数为空
CodeBusinessIDNotFound = "212007" // 业务场景标识不存在
// 授权范围重复获取:主体已对本应用授权,无须再获取授权链接
// 个人用户帐号管理 / 企业用户帐号管理 均有说明
// get-auth-url 返回「授权范围重复获取」时可用作兜底(非正式查授权接口)
// 正式查授权请用 POST /corp/get 的 bindingStatus
CodeAuthScopeDuplicate = "210002" // 授权范围重复获取
CodeAuthScopeDuplicateCorp = "210013" // 授权范围重复获取(无须重复获取授权申请链接)
CodeCorpNotFound = "210032" // 企业用户不存在
)
// APIError 法大大业务错误(按 code 判断,不依赖 msg
@@ -56,8 +57,9 @@ func NewAPIError(op, code, msg, requestID string) *APIError {
}
}
// IsAuthAlreadyGranted 是否表示「已授权 / 授权范围重复获取」,应跳过再次获取授权链接
// 官方文档:应按返回码 code 判断msg 可能调整。
// IsAuthAlreadyGranted 是否为 get-auth-url「授权范围重复获取」错误码210002/210013
// 注意:正式判断是否已授权应调用 POST /corp/getbindingStatus=authorized
// 本函数仅作取链失败时的兜底。
func IsAuthAlreadyGranted(err error) bool {
if err == nil {
return false