user.js 2.4 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. // 路由配置
  3. const path = require('path');
  4. const regPath = path.resolve('app', 'public', 'routerRegister');
  5. const routerRegister = require(regPath);
  6. const rkey = 'user';
  7. const ckey = 'user.user';
  8. const keyZh = '用户';
  9. const routes = [
  10. { method: 'post', path: `${rkey}/cct`, controller: `${ckey}.cct`, name: `${ckey}cct`, zh: `${keyZh}更换token` },
  11. { method: 'post', path: `${rkey}/toLoginByCode`, controller: `${ckey}.toLoginByCode`, name: `${ckey}toLoginByCode`, zh: `${keyZh}手机验证码登陆` },
  12. { method: 'post', path: `${rkey}/checkLoginCode`, controller: `${ckey}.checkLoginCode`, name: `${ckey}checkLoginCode`, zh: `${keyZh}手机验证码登陆校验` },
  13. { method: 'post', path: `${rkey}/checkBindPhone`, controller: `${ckey}.checkBindPhone`, name: `${ckey}checkBindPhone`, zh: `${keyZh}校验绑定手机验证码` },
  14. { method: 'post', path: `${rkey}/toBindPhone`, controller: `${ckey}.toBindPhone`, name: `${ckey}toBindPhone`, zh: `${keyZh}发送绑定手机验证码` },
  15. { method: 'post', path: `${rkey}/toBindEmail`, controller: `${ckey}.toBindEmail`, name: `${ckey}toBindEmail`, zh: `${keyZh}发送绑定邮箱验证码` },
  16. { method: 'post', path: `${rkey}/checkBindEmail`, controller: `${ckey}.checkBindEmail`, name: `${ckey}checkBindEmail`, zh: `${keyZh}校验绑定邮箱` },
  17. { method: 'post', path: `${rkey}/wxLogin`, controller: `${ckey}.wxLogin`, name: `${ckey}wxLogin`, zh: `${keyZh}微信登陆` },
  18. { method: 'post', path: `${rkey}/login`, controller: `${ckey}.login`, name: `${ckey}Login`, zh: `${keyZh}登陆` },
  19. { method: 'post', path: `${rkey}/resetPwd/:id`, controller: `${ckey}.resetPwd`, name: `${ckey}ResetPwd`, zh: `重置密码${keyZh}` },
  20. { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
  21. { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
  22. { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, middleware: ['password'], name: `${ckey}Create`, zh: `创建${keyZh}` },
  23. { method: 'post', path: `${rkey}/:id`, controller: `${ckey}.update`, middleware: ['password'], name: `${ckey}Update`, zh: `修改${keyZh}` },
  24. { method: 'delete', path: `${rkey}`, controller: `${ckey}.destroy`, name: `${ckey}Delete`, zh: `删除${keyZh}` },
  25. ];
  26. module.exports = app => {
  27. routerRegister(app, routes, keyZh, rkey, ckey);
  28. };