abler-api 0.1.54 → 0.1.55

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.
@@ -217,7 +217,7 @@ class apiUtil$2 {
217
217
  */
218
218
 
219
219
 
220
- static apiSuccess(data, req) {
220
+ static apiSuccess(data, req, spOrderNum) {
221
221
  let response = {
222
222
  success: true,
223
223
  stateCode: 0,
@@ -225,6 +225,10 @@ class apiUtil$2 {
225
225
  datetime: new Date()
226
226
  };
227
227
 
228
+ if (spOrderNum) {
229
+ response.spOrderNum = spOrderNum;
230
+ }
231
+
228
232
  if (req && req.headers) {
229
233
  let userAgent = req.headers["user-agent"];
230
234
 
@@ -1524,6 +1528,28 @@ class apiUtil$2 {
1524
1528
  text = lines.join('\r\n');
1525
1529
  await fs$1.async_writeFile(fileName, text);
1526
1530
  return n;
1531
+ }
1532
+ /**
1533
+ * 创建验证码对象
1534
+ * npm i svg-captcha
1535
+ * npm i svg2png
1536
+ */
1537
+
1538
+
1539
+ static createSvgCaptcha(options) {
1540
+ const captcha = svgCaptcha.create({
1541
+ inverse: options.hasOwnProperty('inverse') ? options.inverse : false,
1542
+ fontSize: options.fontSize || 48,
1543
+ noise: options.noise || 2,
1544
+ width: options.width || 150,
1545
+ height: options.height || 75,
1546
+ size: options.size || 4,
1547
+ charPreset: options.charPreset || '0123456789',
1548
+ ignoreChars: options.ignoreChars || '0oli',
1549
+ color: options.hasOwnProperty('color') ? options.color : true,
1550
+ background: options.background || '#cc9966'
1551
+ });
1552
+ return captcha;
1527
1553
  } //#endregion
1528
1554
 
1529
1555
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "-module": "./dist/es/pp-util.js",