feat(channel): 微信 iLink 账号状态三态(诚实口径)
state ∈ 有效 / **被拒(需重扫)** / 未知;🔴 -14 是**被拒不是过期**,且**未知原因绝不 写成「过期」**(面板文案与错误码都如实)。三态判定为纯函数 + 三态各有用例。 ⚠️ 未做(如实登记): 三态(每账号逐条三态)本片未做。
This commit is contained in:
1 parent
f75e7a9c9b
commit
7505c46b70
8 files changed
+808
-17
No files matched your search
@@ -75,6 +75,10 @@ func (a *Adapter) ReadMessages(ctx context.Context, emit func(adapter.UnifiedMes
|
||||
|
||||
failures := 0
|
||||
for {
|
||||
// 先拍下本次调用将要使用的凭据快照:长轮询成功时用它置位「已证实」
|
||||
// (session_status.go),于是「请求发出后配置就被换掉」不会把旧凭据的证据
|
||||
// 记到新凭据头上。
|
||||
token := a.botToken()
|
||||
resp, err := a.fetchUpdates(ctx)
|
||||
if err != nil {
|
||||
if ctx.Err() != nil {
|
||||
@@ -109,6 +113,9 @@ func (a *Adapter) ReadMessages(ctx context.Context, emit func(adapter.UnifiedMes
|
||||
}
|
||||
continue
|
||||
}
|
||||
// 一次成功的 getupdates 就是「iLink 接受了这份凭据」的证据:三态由此从
|
||||
// 「未知」变成「有效」(session_status.go)。
|
||||
a.markVerified(token)
|
||||
a.setCursor(resp.GetUpdatesBuf)
|
||||
|
||||
for _, raw := range resp.Msgs {
|
||||
|
||||
Reference in new issue
Block a user