'use strict'; // 路由配置 const path = require('path'); const regPath = path.resolve('app', 'public', 'routerRegister'); const routerRegister = require(regPath); const rkey = 'user'; const ckey = 'user.user'; const keyZh = '用户'; const routes = [ { method: 'post', path: `${rkey}/cct`, controller: `${ckey}.cct`, name: `${ckey}cct`, zh: `${keyZh}更换token` }, { method: 'post', path: `${rkey}/toLoginByCode`, controller: `${ckey}.toLoginByCode`, name: `${ckey}toLoginByCode`, zh: `${keyZh}手机验证码登陆` }, { method: 'post', path: `${rkey}/checkLoginCode`, controller: `${ckey}.checkLoginCode`, name: `${ckey}checkLoginCode`, zh: `${keyZh}手机验证码登陆校验` }, { method: 'post', path: `${rkey}/checkBindPhone`, controller: `${ckey}.checkBindPhone`, name: `${ckey}checkBindPhone`, zh: `${keyZh}校验绑定手机验证码` }, { method: 'post', path: `${rkey}/toBindPhone`, controller: `${ckey}.toBindPhone`, name: `${ckey}toBindPhone`, zh: `${keyZh}发送绑定手机验证码` }, { method: 'post', path: `${rkey}/toBindEmail`, controller: `${ckey}.toBindEmail`, name: `${ckey}toBindEmail`, zh: `${keyZh}发送绑定邮箱验证码` }, { method: 'post', path: `${rkey}/checkBindEmail`, controller: `${ckey}.checkBindEmail`, name: `${ckey}checkBindEmail`, zh: `${keyZh}校验绑定邮箱` }, { method: 'post', path: `${rkey}/wxLogin`, controller: `${ckey}.wxLogin`, name: `${ckey}wxLogin`, zh: `${keyZh}微信登陆` }, { method: 'post', path: `${rkey}/login`, controller: `${ckey}.login`, name: `${ckey}Login`, zh: `${keyZh}登陆` }, { method: 'post', path: `${rkey}/resetPwd/:id`, controller: `${ckey}.resetPwd`, name: `${ckey}ResetPwd`, zh: `重置密码${keyZh}` }, { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` }, { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` }, { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, middleware: ['password'], name: `${ckey}Create`, zh: `创建${keyZh}` }, { method: 'post', path: `${rkey}/:id`, controller: `${ckey}.update`, middleware: ['password'], name: `${ckey}Update`, zh: `修改${keyZh}` }, { method: 'delete', path: `${rkey}`, controller: `${ckey}.destroy`, name: `${ckey}Delete`, zh: `删除${keyZh}` }, ]; module.exports = app => { routerRegister(app, routes, keyZh, rkey, ckey); };