初始化项目
This commit is contained in:
commit
28f327c903
19 files changed
+434
No files matched your search
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const getErrorMessge = code => {
|
||||
let message = '';
|
||||
switch (code) {
|
||||
case 0:
|
||||
message = '请求成功';
|
||||
break;
|
||||
default:
|
||||
message = '请求成功';
|
||||
break;
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
const respFormat = option => {
|
||||
const res = {};
|
||||
res.data = option.hasOwnProperty('data') ? option.data : '';
|
||||
res.errcode = option.hasOwnProperty('errcode') ? option.errcode : 0;
|
||||
res.result = option.hasOwnProperty('result') ? option.result : true;
|
||||
res.desc = option.hasOwnProperty('desc') ? option.desc : getErrorMessge(res.errcode);
|
||||
return res;
|
||||
};
|
||||
|
||||
module.exports = respFormat;
|
||||
Reference in new issue
Block a user