MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / getOperateData

Method getOperateData

wxapp/yichengtong.js:189–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187 }
188
189 async getOperateData() {
190 if (!this.openid) throw new Error("缺少 openid,无法从 wx_server 获取授权数据");
191 const { data } = await axios.post(
192 `${wechat.serverUrl}/wx/getuserinfo`,
193 { appid: MINI_APP_ID, openid: this.openid },
194 {
195 headers: { auth: wechat.auth },
196 timeout: 30000,
197 validateStatus: () => true,
198 }
199 );
200 if (!data?.status) throw new Error(data?.message || "wx_server 获取 operatedata 失败");
201 const info = data.data || {};
202 if (!info.code || !info.iv || !info.encryptedData) {
203 throw new Error(`wx_server operatedata 缺少必要字段: ${JSON.stringify(data)}`);
204 }
205 return info;
206 }
207
208 async loginByCode() {
209 const code = await this.getWxCode();

Callers 1

loginByOperateDataMethod · 0.95

Calls 1

postMethod · 0.45

Tested by

no test coverage detected