@tmsfe/tms-core 0.0.94 → 0.0.96

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.
package/src/md5.js CHANGED
@@ -1,9 +1,6 @@
1
1
  /**
2
- * @copyright 2017-present, Tencent, Inc. All rights reserved.
3
2
  * @author Davis.Lu <davislu@tencent.com>
4
- *
5
- * @file crypto tools.
6
- *
3
+ * @desc: 基于md5算法对源字符串进行hash,生成hash字符串
7
4
  **/
8
5
 
9
6
  /**
package/src/mpInfo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 支持服务接入相关接口
2
+ * @desc: 支持服务接入相关接口
3
3
  */
4
4
  import Request from './request';
5
5
 
@@ -11,6 +11,9 @@ import Request from './request';
11
11
  * @param {String} mpId 接入服务商渠道标识
12
12
  * @param {String} userId 出行用户标识
13
13
  * @returns {Promise<String>} 返回 openId,失败时返回空
14
+ * @example
15
+ * const { tms } = getApp({ allowDefault: true });
16
+ * tms.getMpOpenId('xxx', '111')
14
17
  */
15
18
  async function getMpOpenId(mpId, userId) {
16
19
  const { resData } = await new Request().post('user/mpinfo', { userId, mpId });
@@ -25,6 +28,9 @@ async function getMpOpenId(mpId, userId) {
25
28
  * @category 服务接入
26
29
  * @param {String} apiKey 服务接入方渠道标识
27
30
  * @returns {Promise<String>} 返回 openId,失败时返回空
31
+ * @example
32
+ * const { tms } = getApp({ allowDefault: true });
33
+ * tms.getMpOpenId('xxx', '111')
28
34
  */
29
35
  async function getOuterOpenId(apiKey) {
30
36
  const { resData } = await new Request().post('user/mpinfo', { mpId: apiKey });
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @desc: 获取导航高度的相关函数
3
+ */
4
+ import { compareVersion } from './compareVersion';
1
5
  let systemInfo = null;
2
6
 
3
7
  /**
4
- * 获取系统信息,有缓存
5
- * 返回数据同wx.getSystemInfoSync
8
+ * 获取系统信息,有缓存, 返回数据同wx.getSystemInfoSync {@link https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html}
6
9
  * @returns {Object} 系统信息
7
10
  */
8
11
  const getSystemInfoSync = () => {
@@ -18,7 +21,7 @@ const getSystemInfoSync = () => {
18
21
  };
19
22
 
20
23
  /**
21
- * 获取系统信息
24
+ * 获取系统信息,有缓存, 返回数据同wx.getSystemInfoSync {@link https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html}
22
25
  * @returns {Object} 系统信息
23
26
  */
24
27
  const getSysInfo = () => {
@@ -34,7 +37,7 @@ const getSysInfo = () => {
34
37
  };
35
38
 
36
39
  /**
37
- * 获取胶囊位置信息
40
+ * 获取胶囊位置信息,返回数据同wx.getMenuButtonBoundingClientRect {@link https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html}
38
41
  * @returns {Object} 胶囊位置信息
39
42
  */
40
43
  const getMenuButtonRectInfo = () => {
@@ -51,38 +54,9 @@ const getMenuButtonRectInfo = () => {
51
54
  return menuButtonRectInfo;
52
55
  };
53
56
 
54
- /**
55
- * 版本比较函数
56
- * @param {String} sourceVersion 作为基准版本号
57
- * @param {String} targetVersion 目标比较版本号
58
- * @returns {Number} 比较结果
59
- * 返回值说明:
60
- * 1 : 大于基准版本号
61
- * 0 : 等于基准版本号
62
- * -1: 小于基准版本号
63
- */
64
- const compareVersion = (sourceVersion, targetVersion) => {
65
- if (typeof sourceVersion !== 'string' || typeof targetVersion !== 'string') {
66
- throw new Error('版本比较参数类型有误');
67
- }
68
-
69
- const toInt = n => parseInt(n, 10); // eslint-disable-line require-jsdoc
70
- const sourceArray = sourceVersion.split('.').map(toInt);
71
- const targetArray = targetVersion.split('.').map(toInt);
72
-
73
- for (let i = 0; i < sourceArray.length; i += 1) {
74
- if (sourceArray[i] > targetArray[i]) {
75
- return 1;
76
- } if (sourceArray[i] < targetArray[i]) {
77
- return -1;
78
- }
79
- }
80
-
81
- return 0;
82
- };
83
-
84
57
  /**
85
58
  * 胶囊高度适配,以兼容获取到的胶囊高度值非法的情况
59
+ * @private
86
60
  * @param {Number} height 胶囊高度
87
61
  * @param {Boolean} isIOS 是否是ios系统
88
62
  * @returns {Number} 胶囊高度
@@ -97,6 +71,7 @@ const formatMenuHeight = (height, isIOS) => {
97
71
 
98
72
  /**
99
73
  * 计算自定义导航栏布局信息
74
+ * @private
100
75
  * @param {Boolean} isIOS 是否是ios平台
101
76
  * @param {Number} statusBarHeight 状态栏高度
102
77
  * @param {String} apiCategory API类别
@@ -194,5 +169,4 @@ const getEnterOptions = () => {
194
169
 
195
170
  export {
196
171
  getNavBarConfigData,
197
- compareVersion,
198
172
  };
package/src/navigator.js CHANGED
@@ -1,9 +1,7 @@
1
1
 
2
2
  /**
3
- * @copyright 2021-present, Tencent, Inc. All rights reserved.
3
+ * @desc: 小程序跳转相关方法
4
4
  * @author Davislu <davislu@tencent.com>
5
- * @brief navigator provides some function to navigate pages in miniprogram.
6
- *
7
5
  */
8
6
 
9
7
  /**
@@ -26,7 +24,7 @@ const DEFN = () => {};
26
24
  * @param {object} setting.navbar 页面导航栏设置
27
25
  * @param {string} setting.navbar.frontColor 导航栏字体颜色
28
26
  * @param {string} setting.navbar.backgroundColor 导航栏背景颜色
29
- * @returns {undefined} 无返回值
27
+ * @returns {void} 无返回值
30
28
  */
31
29
  const navigateToWebview = ({ url: webUrl, complete = DEFN, message = DEFN, share = {}, navbar = {} }) => {
32
30
  const page = '/modules/x/webcontainer/webcontainer';
package/src/numUtils.js CHANGED
@@ -1,12 +1,15 @@
1
+ /**
2
+ * @desc: 数字处理相关函数
3
+ */
4
+
1
5
  import { roundStr } from './stringUtils';
2
6
  /**
3
7
  * 四舍五入(支持保留n位小数,n>=0)
4
- * @param {any} x 原数字
5
- * 如果n不是合法数字或者无法转换为合法数字,round结果返回NaN
6
- * @param {any} n 保留几位小数,默认0
7
- * 如果n不是合法数字或者无法转换为合法数字,round结果返回NaN
8
- * 如果n小于0,round结果返回NaN
9
- * 如果n的值包含小数部分,round处理时只关注n的整数部分值
8
+ * @param {any} x 原数字, 如果n不是合法数字或者无法转换为合法数字,round结果返回NaN
9
+ * @param {any} n 保留几位小数,默认0;
10
+ 1. 如果n不是合法数字或者无法转换为合法数字,round结果返回NaN;
11
+ 2. 如果n小于0,round结果返回NaN
12
+ 3. 如果n的值包含小数部分,round处理时只关注n的整数部分值
10
13
  * @return {number} 返回一个保留n位小数的数字,异常情况下可能是NaN
11
14
  */
12
15
  const round = (x, n = 0) => parseFloat(roundStr(x, n, false));
package/src/objUtils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Tencent Inc. All Rights Reserved.
3
- * Description: Some Functions for Obejct.
2
+ * @desc: 对象处理相关函数
4
3
  */
5
4
 
6
5
  /**
@@ -32,6 +31,8 @@ export class JsonParseError extends Error {
32
31
 
33
32
  /**
34
33
  * 安全的JSON.parse
34
+ * @param {object} data JSON.parse的对象
35
+ * @param {boolean} throwErrIfParseFail 如果解析失败,是否抛出错误
35
36
  */
36
37
  export function safeJsonParse(data, throwErrIfParseFail = false) {
37
38
  try {
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * 负责对象的克隆
3
+ * @private: true
3
4
  */
4
5
 
5
6
  const maxArrLen = 10;
6
- const maxStrLen = 200;
7
- const maxFieldLen = 20;
7
+ const maxStrLen = 50;
8
+ const maxFieldLen = 10;
8
9
 
9
10
  // 字符串字段白名单,白名单内的字段不截断
10
11
  const fieldWhiteList = [
@@ -47,9 +48,9 @@ function isArrayType(obj: any): { isArray: boolean, value: any } {
47
48
  * @param depth 当前克隆的深度
48
49
  * @param maxDepth 最大克隆深度
49
50
  */
50
- function deepClone(obj: any, depth = 0, maxDepth = 5): any {
51
+ function deepClone(obj: any, depth = 0, maxDepth = 2): any {
51
52
  if (depth > maxDepth) {
52
- return undefined;
53
+ return '深度超过上限,截断';
53
54
  }
54
55
  const res1 = isBasicsType(obj);
55
56
  if (res1.isBasics) {
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 格式化旧埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 格式化新埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 埋点辅助函数
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -8,7 +9,7 @@ import clone from './clone';
8
9
 
9
10
  function getTms(): any {
10
11
  // 如果是在app.js的onLaunch中调用,则没有getApp().tms为空
11
- return getApp()?.tms || wx.tms;
12
+ return getApp()?.tms || (wx as any).tms;
12
13
  }
13
14
 
14
15
  let initOptions: IInitOptions;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * 埋点
2
+ * @desc: 埋点上报
3
+ * @module: report
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -8,8 +9,12 @@ import sender from './sender';
8
9
  import formatV1 from './formatV1';
9
10
  import formatV2 from './formatV2';
10
11
 
12
+ const logger = wx.getLogManager({});
13
+ logger.log('report模块代码被装载');
14
+
11
15
  /**
12
16
  * 初始化
17
+ * @private
13
18
  */
14
19
  function init(options: IInitOptions): void {
15
20
  helper.init(options);
@@ -17,20 +22,26 @@ function init(options: IInitOptions): void {
17
22
 
18
23
  /**
19
24
  * 旧埋点
20
- * @param data { 27: xxxx, 34: xxx }
25
+ * @param { object } data 上报对象
26
+ * @example
27
+ * report({ 27: xxxx, 34: xxx })
21
28
  */
22
29
  function report(data: IOldParams = {}): void {
23
30
  if (helper.canReport()) {
31
+ logger.log('旧埋点:', data);
24
32
  formatV1.formatData(data).then(arr => sender.queue(arr));
25
33
  }
26
34
  }
27
35
 
28
36
  /**
29
37
  * 旧埋点,快速上报,不依赖用户位置
30
- * @param data { 27: xxxx, 34: xxx }
38
+ * @param { object } data 上报对象
39
+ * @example
40
+ * fastReport({ 27: xxxx, 34: xxx })
31
41
  */
32
42
  function fastReport(data: IOldParams = {}): void {
33
43
  if (helper.canReport()) {
44
+ logger.log('旧立即埋点:', data);
34
45
  const arr = formatV1.formatFastData(data);
35
46
  sender.send(arr);
36
47
  }
@@ -38,18 +49,37 @@ function fastReport(data: IOldParams = {}): void {
38
49
 
39
50
  /**
40
51
  * 新埋点
52
+ * @param {string} 参数1 页面|组件的唯一标志
53
+ * @param {any} 参数2 埋点属性(会埋在埋点31个字段)
54
+ * @param {any} 参数3 埋点属性(会埋在埋点32个字段) 依次类推参数4、参数5,最多10个参数
55
+ * @returns {void}
56
+ * @example
57
+ * const { tms } = getApp({ allowDefault: true });
58
+ * const reporter = tms.getReporter();
59
+ * reporter.report2('user_security_level', {}, {});
41
60
  */
42
61
  function report2(...data: any[]): void {
43
62
  if (helper.canReport()) {
63
+ logger.log('新埋点:', data);
44
64
  formatV2.formatData(data).then(arr => sender.queue(arr));
45
65
  }
46
66
  }
47
67
 
48
68
  /**
49
- * 新埋点,快速上报,不依赖用户位置
69
+ * 新埋点,埋点需要立即上报,不依赖用户位置,
70
+ * fastReport2()上报时携带的"省"、"市"等需要异步请求的基础字段会从缓存中读取,如果无缓存则为空,report2()则一定会携带这些字段
71
+ * @param {string} 参数1 页面|组件的唯一标志
72
+ * @param {any} 参数2 埋点属性(会埋在埋点31个字段)
73
+ * @param {any} 参数3 埋点属性(会埋在埋点32个字段) 依次类推参数4、参数5,最多10个参数
74
+ * @returns {void}
75
+ * @example
76
+ * const { tms } = getApp({ allowDefault: true });
77
+ * const reporter = tms.getReporter();
78
+ * reporter.fastReport2('user_security_level', {}, {});
50
79
  */
51
80
  function fastReport2(...data: any[]): void {
52
81
  if (helper.canReport()) {
82
+ logger.log('新立即埋点:', data);
53
83
  const arr = formatV2.formatFastData(data);
54
84
  sender.send(arr);
55
85
  }
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 负责小程序级的全埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 负责组件的全埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * 全埋点辅助类
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
6
7
 
7
8
  function getReporter(): any {
8
9
  // 如果是在app.js的onLaunch中调用,则没有getApp().tms为空
9
- const tms = getApp()?.tms || wx.tms;
10
+ const tms = getApp()?.tms || (wx as any).tms;
10
11
  return tms.getReporter();
11
12
  }
12
13
 
@@ -56,7 +57,7 @@ function setLastBindEvent(info: IBindEvent): void {
56
57
  const pages = getCurrentPages().reverse();
57
58
  const page = pages.find((t: any) => t) || {};
58
59
  // eslint-disable-next-line
59
- info.pageUrl = page.route;
60
+ info.pageUrl = (page as any).route;
60
61
  lastBindEvent = info;
61
62
  }
62
63
 
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 负责页面和组件的全埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  import proxyApp from './app';
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 负责页面的全埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
@@ -2,6 +2,7 @@
2
2
 
3
3
  /**
4
4
  * 绑定的触发事件埋点
5
+ * @private: true
5
6
  */
6
7
  interface IBindEvent {
7
8
  /**
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * 负责发送埋点
3
+ * @private: true
3
4
  */
4
5
 
5
6
  // / <reference path='./types.ts'/>
package/src/request.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @copyright 2021-present, Tencent, Inc. All rights reserved.
3
3
  * @brief request.js用于发起网络请求.
4
- * request模块作为基于 tms-core 的应用的公共请求模块。
4
+ * @desc: request模块作为基于 tms-core 的应用的公共请求模块。
5
5
  * 目前支持在出行服务小程序或基于出行服务的小程序中调用。在后续runtime支持公众号H5后,
6
6
  * 将支持在H5中调用。
7
7
  *
@@ -9,10 +9,11 @@
9
9
  * 框架判断在不同的运行环境,切换调用不同运行环境提供的方法。
10
10
  */
11
11
  import md5 from './md5';
12
- import { getLogManager } from './log';
13
12
  import { getEnvInfo, getAuthInfo } from './env';
14
13
  import { safeJsonParse } from './objUtils';
15
14
 
15
+ const logger = wx.getLogManager({});
16
+
16
17
  /**
17
18
  * 用于序列化需要签名的参数
18
19
  * @private
@@ -144,11 +145,11 @@ export default class Request {
144
145
  }
145
146
 
146
147
  /**
147
- * 格式化接口路径
148
- * @private
149
- * @param {string} path 需要格式化的接口路径
150
- * @returns {string} 格式化后的接口路径
151
- */
148
+ * 格式化接口路径
149
+ * @private
150
+ * @param {string} path 需要格式化的接口路径
151
+ * @returns {string} 格式化后的接口路径
152
+ */
152
153
  makeUrl(path) {
153
154
  if ((/^http/i).test(path)) return path;
154
155
  const host = this.host || Request.defaultHost;
@@ -288,10 +289,10 @@ export default class Request {
288
289
  async serialize(path, data = {}) {
289
290
  let url = this.makeUrl(path);
290
291
  const signData = await composeParam(data, this.withAuth, this.baseParam);
291
- const signture = sign(signData);
292
+ const signature = sign(signData);
292
293
  const params = [];
293
- Object.keys(signture).forEach((key) => {
294
- const val = encodeURIComponent(signture[key]);
294
+ Object.keys(signature).forEach((key) => {
295
+ const val = encodeURIComponent(signature[key]);
295
296
  params.push(`${key}=${val}`);
296
297
  });
297
298
  if (params.length) url += (/\?/.test(url) ? '&' : '?') + params.join('&');
@@ -310,23 +311,46 @@ export default class Request {
310
311
  async createRequestTask(path, param = {}, method = 'POST', header = {}) {
311
312
  const requestParam = await composeParam(param, this.withAuth, this.baseParam);
312
313
  const data = sign(requestParam);
313
- const logger = getLogManager();
314
- const res = await new Promise((resolve, reject) => {
314
+ return new Promise((resolve, reject) => {
315
315
  wx.request({
316
316
  url: this.makeUrl(path),
317
317
  header,
318
318
  method,
319
319
  data,
320
320
  success: (res) => {
321
+ // 埋点已经单独打日志了,接口请求数据日志太长影响分析
322
+ if (path.indexOf('basic/event/upload') === -1) {
323
+ let result = JSON.stringify(res?.data);
324
+ if (result.length > 500) {
325
+ result = `${result.substring(0, 500)} 内容太长被截断`;
326
+ }
327
+ const obj = {
328
+ path,
329
+ method,
330
+ header: JSON.stringify(header),
331
+ params: JSON.stringify(data),
332
+ res: result,
333
+ };
334
+ const str = JSON.stringify(obj, null, ' ').replace(/\\"/ig, '\'');
335
+ logger.log(`接口请求成功:\n${str}`);
336
+ }
337
+
321
338
  resolve(res);
322
- logger.log({ path, header, method, param: data, res: res?.data });
323
339
  },
324
340
  fail: (err) => {
341
+ const obj = {
342
+ path,
343
+ method,
344
+ header: JSON.stringify(header),
345
+ params: JSON.stringify(data),
346
+ err: JSON.stringify(err),
347
+ };
348
+ const str = JSON.stringify(obj, null, ' ').replace(/\\"/ig, '\'');
349
+ logger.error(`接口请求失败:\n${str}`);
350
+
325
351
  reject(err);
326
- logger.log({ path, header, method, param: data, err });
327
352
  },
328
353
  });
329
354
  });
330
- return res;
331
355
  }
332
356
  }
package/src/rpx.js CHANGED
@@ -1,9 +1,13 @@
1
+ /**
2
+ * @desc: pr\rpx互相转化
3
+ */
4
+
1
5
  import syncApi from './syncfnmanager';
2
6
 
3
7
  /**
4
8
  * @description rpx to px
5
9
  * @param {Number} rpx 需要转换的rpx数值
6
- * @returns {Number} 转换后的rpx数值
10
+ * @returns {Number} 转换后的px数值
7
11
  */
8
12
  const rpxToPx = (rpx) => {
9
13
  const sys = syncApi.getSystemInfoSync();
@@ -14,8 +18,8 @@ const rpxToPx = (rpx) => {
14
18
 
15
19
  /**
16
20
  * @description px to rpx
17
- * @returns {Number} 转换后的rpx数值
18
- * @param px
21
+ * @param {Number} px 需要转换的px数值
22
+ * @returns {Number} 转换后的rpx数值
19
23
  */
20
24
  const pxToRpx = (px) => {
21
25
  const sys = syncApi.getSystemInfoSync();
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @module: runtime-car
3
+ * @desc: 车辆相关
4
+ */
1
5
  let carInfo = {}; // 当前车信息
2
6
  let carList = []; // 缓存到的车列表信息
3
7
  let getCarListProm = null;
@@ -2,8 +2,8 @@
2
2
 
3
3
  /**
4
4
  * @copyright 2021-present, Tencent, Inc. All rights reserved.
5
- * @brief runtime.js is used to initialize a tms based app.
6
- *
5
+ * @module: runtime-index
6
+ * @desc: 集成业务通用接口(登录、车辆、微信支付分)
7
7
  */
8
8
  import Login from './login';
9
9
  import Car from './car';
@@ -74,14 +74,15 @@ const login = async () => {
74
74
  };
75
75
 
76
76
  /**
77
- * 获取微信支付分授权
78
- * @param { param.traceSource ? } 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
79
- * @param { param.subMchId } 商户id
80
- * @param { param.bussClassify ? } 请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
81
- * @param { param.payChannel ? } 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
82
- * @param { param.wechaId } 公众号id,支付分授权相关一般都用我的车的车公众号
83
- * @param { param.subAppId ? } 小程序的id,支付分授权相关一般都用我的车小程序id
84
- * @param { param.openId ? } 用户在我的车公众号下面的id
77
+ * 设置微信支付分授权
78
+ * @param {Object} params对象类型 以下是params的解释
79
+ * @param {Number}params.traceSource 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
80
+ * @param {String } param.subMchId 商户id
81
+ * @param {Number} params.bussClassify 请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
82
+ * @param {Number} params.payChannel 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
83
+ * @param {String} params.wechaId 公众号id,支付分授权相关一般都用我的车的车公众号
84
+ * @param {String} params.subAppId 小程序的id,支付分授权相关一般都用我的车小程序id
85
+ * @param {String} params.openId 用户在我的车公众号下面的id
85
86
  * @returns { object } { state: 1, errMsg: 200, errMsg: '', errData: '' }
86
87
  */
87
88
  async function setPaypointAuth(param = {}) {
@@ -130,8 +131,9 @@ function getRequestInstnce() {
130
131
 
131
132
  /**
132
133
  * 获取微信支付分授权
133
- * @param { param.traceSource ? } 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
134
- * @param { param.payChannel ? } 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
134
+ * @param {Object} params对象类型 以下是params的解释
135
+ * @param {Number} params.traceSource 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
136
+ * @param {Number} param.payChannel 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
135
137
  * @returns { object } { errMsg: 200, errMsg: '', errData: '' }
136
138
  */
137
139
  async function getPermissionList(param = {}) {
@@ -150,13 +152,14 @@ async function getPermissionList(param = {}) {
150
152
 
151
153
  /**
152
154
  * 获取微信支付分授权
153
- * @param { param.traceSource ? } 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
154
- * @param { param.subMchId } 商户id
155
- * @param { param.bussClassify ? } 请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
156
- * @param { param.payChannel ? } 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
157
- * @param { param.wechaId } 公众号id,支付分授权相关一般都用我的车的车公众号
158
- * @param { param.subAppId ? } 小程序的id,支付分授权相关一般都用我的车小程序id
159
- * @param { param.openId ? } 用户在我的车公众号下面的id
155
+ * @param {Object} params对象类型 以下是params的解释
156
+ * @param {Number} params.traceSource 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
157
+ * @param {String} params.subMchId 商户id
158
+ * @param {Number} params.bussClassify请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
159
+ * @param {Number} params.payChannel请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
160
+ * @param {String} params.wechaId 公众号id,支付分授权相关一般都用我的车的车公众号
161
+ * @param {String} params.subAppId小程序的id,支付分授权相关一般都用我的车小程序id
162
+ * @param {String} params.openId用户在我的车公众号下面的id
160
163
  * @returns { object } { state: 1, errMsg: 200, errMsg: '', errData: '' }
161
164
  */
162
165
  async function terminatePaypointPermisson(param = {}) {
@@ -183,9 +186,10 @@ async function terminatePaypointPermisson(param = {}) {
183
186
 
184
187
  /**
185
188
  * 获取用户在某个业务中是否授权
186
- * @param { param.traceSource ? } 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
187
- * @param { param.bussClassify ? } 请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
188
- * @param { param.payChannel ? } 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
189
+ * @param {Object} params对象类型 以下是params的解释
190
+ * @param {Number} params.traceSource 请求来源: 1-订单 2-支付网关 3-车机网关 4-开放平台 6-分账
191
+ * @param {Number} params.bussClassify 请求来源: 1-洗车 2-停车 12-代驾 24-租车 13-保养 3-加油
192
+ * @param {Number} params.payChannel 请求来源: 1-小程序 2-车机 3-小场景 4-开放平台 5-H5
189
193
  * @returns { object } { state: 1, errMsg: 200, errMsg: '', errData: '' }
190
194
  */
191
195
  async function queryServicePermissions(param = {}) {
@@ -203,6 +207,21 @@ async function queryServicePermissions(param = {}) {
203
207
  return res;
204
208
  }
205
209
 
210
+ /**
211
+ * @namespace runtimeapi
212
+ * @description 对外暴露的api
213
+ * @param {Function} getPhone 获取手机号
214
+ * @param {Function} login... 详见跳转[runtime-login](#runtime-login)
215
+ * @param {Function} getLoginInfo 返回 loginInfoPromise
216
+ * @param {Function} getOpenId 获取openId 详见跳转[runtime-login](#runtime-login)
217
+ * @param {Function} getMycarPubOpenId 获取用户在我的车公众号下的openId 详见跳转[runtime-login](#runtime-login)
218
+ * @param {Function} getSinanPubOpenId 获取用户在出行服务公众号下的openId 详见跳转[runtime-login](#runtime-login)
219
+ * @param {Function} getCarManager 用户获取小程序统一维护的车信息管理器,详见跳转 [runtimt-car](#runtime-car)
220
+ * @param {Function} setPaypointAuth 设置微信支付分授权
221
+ * @param {Function} getPermissionList 获取微信支付分授权
222
+ * @param {Function} terminatePaypointPermisson 获取微信支付分授权
223
+ * @param {Function} queryServicePermissions 获取用户在某个业务中是否授权
224
+ */
206
225
  const api = {
207
226
  getPhone,
208
227
  registerPhone,