q-koa 12.3.0 → 12.3.2

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.
@@ -308,7 +308,13 @@ exports.getLocation = async (ctx) => {
308
308
  const appConfig = getConfig(app)
309
309
  const { tencent_key } = await appConfig.getObject('map')
310
310
 
311
- const geo = new Geo(tencent_key)
311
+ let geo
312
+ if (Array.isArray(tencent_key)) {
313
+ geo = new Geo(lodash.shuffle(tencent_key)[0])
314
+ } else {
315
+ geo = new Geo(tencent_key)
316
+ }
317
+
312
318
  const addressName = address || `${provinceName}${cityName}`
313
319
  const result = await geo.getToLngAndLat(addressName)
314
320
 
@@ -328,7 +334,13 @@ exports.getLngAndLat = async (ctx) => {
328
334
  const appConfig = getConfig(app)
329
335
  const { tencent_key } = await appConfig.getObject('map')
330
336
 
331
- const geo = new Geo(tencent_key)
337
+ let geo
338
+ if (Array.isArray(tencent_key)) {
339
+ geo = new Geo(lodash.shuffle(tencent_key)[0])
340
+ } else {
341
+ geo = new Geo(tencent_key)
342
+ }
343
+
332
344
  const res = await geo.getToLoation({
333
345
  longitude,
334
346
  latitude,
@@ -661,6 +661,9 @@ exports.profitsharing = async ({
661
661
  pay_config = 'weixin_pay',
662
662
  }) => {
663
663
  if (!ctx) throw new Error('?ctx')
664
+ if (amount === 0) throw new Error(`amount不能为0`)
665
+ if (amount % 1 !== 0) throw new Error(`amount需要是整数`)
666
+
664
667
  const { app, appName } = getAppByCtx(ctx)
665
668
 
666
669
  const appConfig = getConfig(app)
@@ -44,6 +44,8 @@ exports.getObject = (config, app) => async (type) => {
44
44
  temObj[list[i].code] = Number(list[i].value)
45
45
  } else if (list[i].type === 'switch') {
46
46
  temObj[list[i].code] = Boolean(Number(list[i].value))
47
+ } else if (list[i].type === 'list' || list[i].type === 'json') {
48
+ temObj[list[i].code] = JSON.parse(list[i].value)
47
49
  } else {
48
50
  temObj[list[i].code] = list[i].value
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.3.0",
3
+ "version": "12.3.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {