@leikeduntech/leiai-js 2.5.0 → 2.5.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/build/index.js +19 -1
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -115,6 +115,24 @@ var uuidv4Re = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9
115
115
  function isValidUUIDv4(str) {
116
116
  return str && uuidv4Re.test(str);
117
117
  }
118
+ function convertArrayToString(arr) {
119
+ let result = "[";
120
+ for (let i = 0; i < arr.length; i++) {
121
+ const obj = arr[i];
122
+ const keys = Object.keys(obj);
123
+ result += "{";
124
+ for (let j = 0; j < keys.length; j++) {
125
+ const key = keys[j];
126
+ const value = obj[key];
127
+ result += '"' + key + '":' + (typeof value === "string" ? '"' + value + '"' : value) + ",";
128
+ }
129
+ result = result.slice(0, -1);
130
+ result += "},";
131
+ }
132
+ result = result.slice(0, -1);
133
+ result += "]";
134
+ return result;
135
+ }
118
136
  function signTencentHunyuan(bodyData, url, keyList) {
119
137
  const sortedObj = {};
120
138
  Object.keys(bodyData).sort().forEach((key) => {
@@ -124,7 +142,7 @@ function signTencentHunyuan(bodyData, url, keyList) {
124
142
  for (let key in sortedObj) {
125
143
  if (signStr) {
126
144
  if (typeof sortedObj[key] === "object") {
127
- signStr += `&${key}=${JSON.stringify(sortedObj[key])}`;
145
+ signStr += `&${key}=${convertArrayToString(sortedObj[key])}`;
128
146
  } else {
129
147
  signStr += `&${key}=${sortedObj[key]}`;
130
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leikeduntech/leiai-js",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "author": "liuhean",
5
5
  "repository": {
6
6
  "type": "git",