Skip to content

Commit

Permalink
[fix] 修复初始化时参数校验问题
Browse files Browse the repository at this point in the history
  • Loading branch information
huangriya committed Oct 11, 2022
1 parent 8b8f902 commit 46e56d8
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion demo/demo/sdk/AnalysysAgent_WX_SDK.es6.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/demo/sdk/AnalysysAgent_WX_SDK.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/demoPlugin/sdk/AnalysysAgent_WX_SDK.plugin.es6.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/demoPlugin/sdk/AnalysysAgent_WX_SDK.plugin.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions demo/demoTaro/sdk/AnalysysAgent_WX_SDK.custom.es6.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions demo/demoTaro/sdk/AnalysysAgent_WX_SDK.custom.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/AnalysysAgent_WX_SDK.custom.es6.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/AnalysysAgent_WX_SDK.custom.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/AnalysysAgent_WX_SDK.es6.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/AnalysysAgent_WX_SDK.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/AnalysysAgent_WX_SDK.plugin.es6.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/AnalysysAgent_WX_SDK.plugin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/module/autoTrigger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setPathParams } from '../../store/pathParams'
import ready from '../ready'
import { config } from '../../store/config'
import { isFunction } from '../../utils/type'
import { getPath, getCurrentPage } from '../../utils/path'
import { getCurrentPage } from '../../utils/path'
import { eventAttribute } from '../../store/eventAttribute'
import { getNow } from '../../store/time'

Expand Down
5 changes: 2 additions & 3 deletions src/module/printLog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const errorMessage = {
'60008': 'Send message failed.',
'60009': '{FN}:The length of the property key (string[{KEY}]) needs to be 1-125 !',
'600010': '{FN}:The length of the property key (string[{KEY}]) needs to be 1-99 !',
'600011': '{FN}:[{KEY}] does not conform to naming rules!',
'600012': '{FN}:Property key invalid, nonsupport value: '+ readOnlyAttrs.join('/') +' \n' +
'current KEY:{KEY}',
'600016': '{FN}: Property value invalid, support type: Object \n' +
Expand Down Expand Up @@ -63,14 +62,14 @@ export function successLog(opt: msgetype) {
}


export function errorLog(opt: msgetype, msg?: string) {
export function errorLog(opt: msgetype, isInit?: boolean) {
const msgTemp = errorMessage[opt.code] || errorMessage.common;
const showMsg = msgTemp.replace(/{FN}/g, opt.fn || '')
.replace(/{KEY}/g, JSON.stringify(opt.key || ''))
.replace(/{VALUE}/g, JSON.stringify(opt.value))
.replace(/{VALUETYPE}/g, getType(opt.value))
.replace(/{KEYTYPE}/g, getType(opt.key))
if (config.debugMode === 1 || config.debugMode === 2) {
if (config.debugMode === 1 || config.debugMode === 2 || isInit) {
console.warn(showMsg)
}
}
16 changes: 15 additions & 1 deletion src/module/sendData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,21 @@ function postData (successFn?: () => void) : any {
*/

function sendData (data: buriedPointData, successFn?: () => void) : any {


if (!config.appkey) {
errorLog({
code: 60006
})
return
}

if (!config.uploadURL) {
errorLog({
code: 60007
})
return
}

// 加入待上报队列
addPostData(data)

Expand Down
4 changes: 2 additions & 2 deletions src/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const configRule = {
verify: [lengthCheck]
},
uploadURL: {
verify: [isString]
verify: [lengthCheck]
},
debugMode: {
verify: [isNumber]
Expand Down Expand Up @@ -81,7 +81,7 @@ export function setConfig (options: initConfig, isVerify = true) : Promise<objec
key: o,
code: 60002,
value: value
})
}, true)
} else {
config[o] = value
}
Expand Down

0 comments on commit 46e56d8

Please sign in to comment.