bjchy-udg-sdk 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bjchy-udg-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Universal Data Gateway SDK - 跨端统一数据访问(微信小程序 / Web / Node.js),API 兼容微信云开发",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
package/src/index.js CHANGED
@@ -81,6 +81,12 @@ class UdgClient {
81
81
  defaultDb: o.defaultDb || '',
82
82
  timeout: o.timeout || 15000
83
83
  }
84
+ // streetKey 模式:resolve 结果本地有缓存时同步补上 appid,
85
+ // 否则 AuthManager 的存储键缺 appid,刷新页面后读不回已缓存的 token(isLoggedIn 恒 false)
86
+ if (!this._ctx.appid && this._ctx.streetKey) {
87
+ const cached = storage.get('udg_resolve_' + this._ctx.streetKey + '@' + this._ctx.endpoint)
88
+ if (cached) this._ctx.appid = cached
89
+ }
84
90
  this._ctx.auth = new AuthManager(this._ctx, rawPost(this._ctx))
85
91
  if (o.token) {
86
92
  // 外部 token 直入(与现有 JWT 体系互通)