shop.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. 'use strict';
  2. // 商城路由
  3. module.exports = app => {
  4. // 管理员登录检查函数
  5. const webLogin = app.middleware.webLogin(app.config.jwt);
  6. const shops = app.controller.home;
  7. /**
  8. * [subRouter 命名空间路由]
  9. * @type {[type]}
  10. */
  11. const subRouter = app.router.namespace(`/${process.env.APP_CUSTOME || 'universal'}/api`);
  12. // 商城主要配置项
  13. subRouter.get('/shop/config', shops.shop.shopConfig);
  14. // 商城支持的支付方式
  15. subRouter.get('/shop/payConfig', shops.shop.payConfig);
  16. // 首页商品列表
  17. subRouter.get('/homeProducts', shops.products.homeProduct);
  18. // 首页商品列表
  19. subRouter.get('/officeHomeProducts', shops.products.officeHomeProducts);
  20. // 商品详情
  21. subRouter.get('/detail', shops.products.detail);
  22. // 商品搜索
  23. subRouter.get('/search', shops.products.search);
  24. // 树形分类商品
  25. subRouter.get('/trees', shops.productCategory.trees);
  26. // 分类下的商品列表
  27. subRouter.get('/category', shops.productCategory.category);
  28. // 用户微信登录
  29. subRouter.get('/wxlogin', shops.user.wxRegisterAdnLogin);
  30. // 获取用户微信登录地址
  31. subRouter.post('/wxlogin', shops.user.wxloginURL);
  32. // 用户账号登录
  33. subRouter.post('/login', shops.user.login);
  34. // 添加购物车
  35. subRouter.post('/cart', webLogin, shops.cart.create);
  36. // 更新购物车
  37. subRouter.put('/cart', webLogin, shops.cart.update);
  38. // 删除购物车
  39. subRouter.delete('/cart', webLogin, shops.cart.delete);
  40. // 查询购物车
  41. subRouter.get('/cart', webLogin, shops.cart.select);
  42. // 购物车商品件数
  43. subRouter.get('/cart/total', shops.cart.cartTotal);
  44. // 查询户收货地址操作接口
  45. subRouter.get('/address', webLogin, shops.address.select);
  46. // 添加用户收货地址操作接口
  47. subRouter.post('/address', webLogin, shops.address.create);
  48. // 更新用户收货地址操作接口
  49. subRouter.put('/address', webLogin, shops.address.update);
  50. // 删除用户收货地址操作接口
  51. subRouter.delete('/address', webLogin, shops.address.delete);
  52. // // 用户下单接口
  53. // subRouter.post('/order', webLogin, shops.order.create);
  54. // // 获取订单列表
  55. // subRouter.get('/order', webLogin, shops.order.select);
  56. // 用户下单接口v2
  57. subRouter.post('/v2/order', webLogin, shops.order.createV2);
  58. // 获取订单列表v2
  59. subRouter.get('/v2/order', webLogin, shops.order.select);
  60. // 获取订单详情
  61. subRouter.get('/order/info', shops.order.selectInfo);
  62. // 获取订单数量
  63. subRouter.get('/order/count', webLogin, shops.order.orderCount);
  64. // 用户取消订单
  65. subRouter.put('/order/cancel', webLogin, shops.order.cancel);
  66. // 用户催发货
  67. subRouter.put('/order/urge', webLogin, shops.order.urge);
  68. // 用户确认收货
  69. subRouter.put('/order/confirm', webLogin, shops.order.confirm);
  70. // 用户查询订单是否支付成功
  71. subRouter.get('/order/pay/query', webLogin, shops.order.orderPayFind);
  72. // 获取用户余额
  73. subRouter.get('/user/money', webLogin, shops.user.userMoney);
  74. // 获取用户账户余额
  75. subRouter.get('/user/account', webLogin, shops.user.userAccount);
  76. // 获取用户资金明细
  77. subRouter.get('/user/money/log', webLogin, shops.user.userMoneyLog);
  78. // 获取用户资金明细
  79. subRouter.get('/user/commission/log', webLogin, shops.user.userCommissionLog);
  80. // 获取用户餐币明细
  81. subRouter.get('/user/coinDetail', webLogin, shops.user.coinDetail);
  82. // 获取用户餐饮币账户
  83. subRouter.get('/user/diningCoin', webLogin, shops.user.userDiningCoin);
  84. // 获取新用户福利记录
  85. subRouter.get('/user/money/newUserBenefits', webLogin, shops.user.newUserBenefits);
  86. // 更新用户信息
  87. subRouter.put('/user/updateUserInfo', webLogin, shops.user.updateUserInfo);
  88. // 查看配送信息
  89. subRouter.get('/order/deliver', webLogin, shops.order.orderDeliver);
  90. // 商品评论提交
  91. subRouter.post('/product/comment', webLogin, shops.products.comment);
  92. // 获取商品评论
  93. subRouter.get('/product/comment', shops.products.commentList);
  94. // 订单继续支付
  95. subRouter.get('/order/again', webLogin, shops.order.orderAgainPay);
  96. // 手动执行定时任务一次
  97. subRouter.get('/executeTask', shops.relInviter.executeSchedule);
  98. // 测试接口 http://test.enroll.sizhijie.com/oneshop/api/test
  99. subRouter.get('/test', shops.relInviter.test);
  100. // 查询可提现金额
  101. subRouter.get('/couldCash', shops.user.userCommissionCouldCash);
  102. // 查询商家可提现餐币金额
  103. subRouter.get('/couldCashCoin', webLogin, shops.user.businessDiningCoinCouldCash);
  104. // 查询可核销餐币
  105. subRouter.get('/couldTransferCoin', shops.user.userCouldTransferCoin);
  106. // 用户分佣坚持申请提现
  107. subRouter.post('/cashOut', webLogin, shops.user.userCashOut);
  108. // 用户分佣转电子餐费申请提现
  109. subRouter.post('/commission2DiningCoin', webLogin, shops.user.commission2DiningCoin);
  110. // 商家申请提现
  111. subRouter.post('/coinCashOut', webLogin, shops.user.userCoinCashOut);
  112. // 商家申请核销餐币
  113. subRouter.post('/coinTransfer', webLogin, shops.user.coinTransfer);
  114. // 查询代理认真申请记录
  115. subRouter.get('/proxyApplyLog', webLogin, shops.proxyApplyLogs.select);
  116. // 添加代理认真申请记录
  117. subRouter.post('/proxyApplyLog', webLogin, shops.proxyApplyLogs.create);
  118. // 更新代理认真申请记录
  119. subRouter.put('/proxyApplyLog', webLogin, shops.proxyApplyLogs.update);
  120. // 删除代理认真申请记录
  121. subRouter.delete('/proxyApplyLog', webLogin, shops.proxyApplyLogs.delete);
  122. // 2022/12/12 发送短信验证码接口
  123. subRouter.get('/phoneSMS', webLogin, shops.proxyApplyLogs.phoneSMS);
  124. // 查询合作餐店列表接口
  125. subRouter.get('/partnerList', shops.partnerInfo.select);
  126. subRouter.get('/partnerListAll', shops.partnerInfo.selectAll);
  127. // 2023/7/25 统计
  128. subRouter.post('/statisticLogs', webLogin, shops.statistic.statisticLogs);
  129. // 2023/7/25 用户行为记录列表
  130. subRouter.get('/statisticLogs', webLogin, shops.statistic.statisticLogsList);
  131. // 2023/7/25 活跃用户列表
  132. subRouter.get('/activeUsers', shops.statistic.activeUsers);
  133. // 2023/7/25 我邀请的活跃用户列表
  134. subRouter.get('/myActiveUsers', shops.statistic.myActiveUsers);
  135. };