错误
塞内卡致命错误 ===================
消息:seneca:操作 cmd:signup,role:api 失败:无法读取未定义的属性“替换”。
代码:act_execute
详细信息:{ 消息:'无法读取属性 \'replace\' of undefined',模式:'cmd:signup,role:api',fn:[Function:signup],cb:[Function],实例:'Seneca/pr061njfdnng /1504005334341/1/3.2.2/-','orig$':TypeError:无法读取 Array.forEach 的 /usr/src/app/services/common.js:22:24 处未定义的属性“替换”(本机) 在 module.exports (/usr/src/app/services/common.js:20:13) 在 Seneca.signup (/usr/src/app/services/api.js:117:17) 在 execute_action (/usr /src/app/node_modules/seneca/seneca.js:1060:20) 在 Object.act_fn [as fn] (/usr/src/app/node_modules/seneca/seneca.js:1013:11) 在 Immediate.processor ( /usr/src/app/node_modules/gate-executor/gate-executor.js:136:14) 在 runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5), 'message$': 'Cannot read property \ 'replace\' of undefined', plugin: {} }
堆栈:在 /usr/src/app/services/common.js:22:24 at Array.forEach (native) at module.exports (/usr/src/app/services/common.js:20:13) at Seneca .signup (/usr/src/app/services/api.js:117:17) at execute_action (/usr/src/app/node_modules/seneca/seneca.js:1060:20) at Object.act_fn [as fn] (/usr/src/app/node_modules/seneca/seneca.js:1013:11) 在 Immediate.processor (/usr/src/app/node_modules/gate-executor/gate-executor.js:136:14) 在 runCallback (timers.js:781:20) 在 tryOnImmediate (timers.js:743:5) 在 processImmediate [as _immediateCallback] (timers.js:714:5)
代码
if(queryString.indexOf('?') > -1){
queryString = queryString.split('?')[1];
}
var pairs = queryString.split('&');
pairs.forEach(function(pair) {
pair = pair.split('=');
var s = pair[1].replace(/\+/g," ");
//console.log('s', s);
//console.log('pair[1]', pair[1]);
var sfinal = decodeURIComponent(s || '');
//console.log('sfinal', sfinal);
result[pair[0]] = sfinal;
});
//done( null, result )