MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / loginSign

Function loginSign

wxapp/txdt.js:123–151  ·  view source on GitHub ↗
({ appId, sessionId = "-1", openId, userId, postBody })

Source from the content-addressed store, hash-verified

121}
122
123function loginSign({ appId, sessionId = "-1", openId, userId, postBody }) {
124 const reqId = md5(`${Math.random()} ${Date.now()}`);
125 const reqTime = Date.now().toString().slice(0, 10);
126 const signParams = {
127 appId,
128 reqId,
129 reqTime,
130 userId,
131 openID: openId,
132 sessionID: sessionId,
133 accessKey: LOGIN_ACCESS_KEY,
134 businessStr: JSON.stringify(postBody),
135 };
136 const signText = `${sortedQuery(signParams)}&secretKey=${LOGIN_SECRET_KEY}`;
137 const headers = {
138 "mapservice-sign-version": "v2",
139 "mapservice-sign": sha256(signText),
140 "mapservice-reqid": reqId,
141 "mapservice-reqtime": reqTime,
142 "mapservice-appid": appId,
143 "mapservice-accesskey": LOGIN_ACCESS_KEY,
144 "mapservice-sessionid": sessionId,
145 };
146 if (sessionId && sessionId !== "-1") {
147 headers["mapservice-openid"] = openId;
148 headers["mapservice-userid"] = userId;
149 }
150 return headers;
151}
152
153function mapH5Sign(apiPath, user) {
154 const reqId = uuid();

Callers 2

miniLoginMethod · 0.85
queryUserMethod · 0.85

Calls 3

sortedQueryFunction · 0.85
sha256Function · 0.85
md5Function · 0.70

Tested by

no test coverage detected