cxos-node-frame
Version:
适用于中小型企业项目快速全栈开发框架
46 lines (41 loc) • 1.47 kB
JavaScript
module.exports = () => {
/** 构造常量结构。用于字典的定义和实现 */
class BaseConstant{
/** 对应的数据库存储的编码值 */
key = null
/** 对应的中文解释 */
value = null
constructor(key, value) {
this.key = key
this.value = value
}
get key(){
return this.key
}
get value(){
return this.value
}
}
/** 公共常量类 */
class CommonCst{
static YES = new BaseConstant('Y', '是')
static NO = new BaseConstant('N', '否')
static ADMIN_ACCOUNT = new BaseConstant('1', '内置超级管理员账号ID')
static ADMIN_ROLE = new BaseConstant('2', '内置超级管理员角色ID')
static APPUSER_ROLE = new BaseConstant('3', '内置APP用户角色ID')
}
/** 接口返回码模块常量类 */
class APICodeCst {
static SUCCESS = new BaseConstant(200, '操作成功')
static ERROR = new BaseConstant(500, '请求异常')
static NOT_FIND = new BaseConstant(404, '接口找不到')
static NOT_SIGN = new BaseConstant(403, '接口签名异常')
static NOT_API = new BaseConstant(402, '接口未授权')
static NOT_TOKEN = new BaseConstant(401, '接口令牌异常')
}
return {
CommonCst,
APICodeCst
}
}