From abb137cfe208f9bc80678f3a3db2089b36b3aba7 Mon Sep 17 00:00:00 2001 From: Aska Date: Mon, 7 Sep 2026 20:58:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(weixin):=20=E9=9D=A2=E6=9D=BF=E7=A9=BAtoken?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=BE=AE=E4=BF=A1iLink=E6=94=BE=E8=A1=8C?= =?UTF-8?q?=E2=80=94=E2=80=94=E4=B8=BA=E6=89=AB=E7=A0=81=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=85=88=E5=BB=BA=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adminSaveChannelConfig 的 len(cfg)==0 校验要求至少 token/baseUrl/address, 但微信扫码登录 需先建空token账号(再扫码回填 token/bot_id/owner_id)。对 weixin-ilink 豁免该校验,允许空配置 账号保存; 其余平台保持必填。PUT 空token 保存已验证 201。build/test 全绿, 已部署. --- internal/services/gateway/admin_write_channel_config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/services/gateway/admin_write_channel_config.go b/internal/services/gateway/admin_write_channel_config.go index 6dedb2f..fbc7b70 100644 --- a/internal/services/gateway/admin_write_channel_config.go +++ b/internal/services/gateway/admin_write_channel_config.go @@ -96,7 +96,11 @@ func (s *Server) adminSaveChannelConfig(w http.ResponseWriter, r *http.Request) return } cfg := channelConfigFromRequest(req) - if len(cfg) == 0 { + // weixin-ilink may be saved with an empty config: the panel creates the account + // first, then the user scans the QR (get_bot_qrcode) which fills bot_token/bot_id/ + // owner_id via login-status (design/08 §4). Requiring a token here would block that + // flow, so exempt it from the "at least one field" gate. + if len(cfg) == 0 && platform != "weixin-ilink" { s.auditClaims(r, "channel.save", "error") writeError(w, apperr.Wrap(apperr.ErrBadRequest, "bad_request", "至少提供 token/baseUrl/address 等配置字段")) return