api.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. use app\common\middleware\AllowOriginMiddleware;
  12. use app\common\middleware\CheckSiteOpenMiddleware;
  13. use app\common\middleware\InstallMiddleware;
  14. use app\common\middleware\UserTokenMiddleware;
  15. use app\common\middleware\VisitProductMiddleware;
  16. use think\facade\Route;
  17. Route::group('api/', function () {
  18. Route::get('test', 'api.Auth/test');
  19. //强制登录
  20. Route::group(function () {
  21. //退出登录
  22. Route::post('logout', 'api.Auth/logout');
  23. //用户信息
  24. Route::get('user', 'api.Auth/userInfo');
  25. //绑定推荐人
  26. Route::post('user/spread', 'api.Auth/spread');
  27. //优惠券
  28. Route::group('coupon', function () {
  29. Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');
  30. Route::get('list', 'api.store.product.StoreCoupon/lst');
  31. });
  32. //客服聊天
  33. Route::group('service', function () {
  34. Route::get('history/:id', 'api.store.service.Service/chatHistory');
  35. Route::get('list', 'api.store.service.Service/getList');
  36. Route::get('mer_history/:merId/:id', 'api.store.service.Service/serviceHistory');
  37. Route::get('user_list', 'api.store.service.Service/serviceUserList');
  38. });
  39. //订单
  40. Route::group('order', function () {
  41. Route::post('check', '/checkOrder');
  42. Route::post('create', '/createOrder');
  43. Route::get('group_order_list', '/groupOrderList');
  44. Route::get('group_order_detail/:id', '/groupOrderDetail');
  45. Route::post('cancel/:id', '/cancelGroupOrder');
  46. Route::get('list', '/lst');
  47. Route::get('detail/:id', '/detail');
  48. Route::get('number', '/number');
  49. Route::post('pay/:id', '/groupOrderPay');
  50. Route::post('take/:id', '/take');
  51. Route::post('express/:id', '/express');
  52. Route::post('del/:id', '/del');
  53. Route::get('status/:id', '/groupOrderStatus');
  54. Route::get('verify_code/:id', '/verifyCode');
  55. })->prefix('api.store.order.StoreOrder');
  56. // 预售
  57. Route::group('presell', function () {
  58. Route::post('pay/:id', '/pay');
  59. })->prefix('api.store.order.PresellOrder');
  60. //退款单
  61. Route::group('refund', function () {
  62. Route::get('batch_product/:id', '/batchProduct');
  63. Route::get('express/:id', '/express');
  64. Route::get('product/:id', '/product');
  65. Route::post('apply/:id', '/refund');
  66. Route::get('list', '/lst');
  67. Route::get('detail/:id', '/detail');
  68. Route::post('del/:id', '/del');
  69. Route::post('back_goods/:id', '/back_goods');
  70. })->prefix('api.store.order.StoreRefundOrder');
  71. //评价
  72. Route::group('reply', function () {
  73. Route::get('product/:id', '/product');
  74. Route::post(':id', '/reply');
  75. })->prefix('api.store.product.StoreReply');
  76. //核销
  77. Route::group('verifier', function () {
  78. Route::get('order/:id', '/detail');
  79. Route::get('lst', '/lst');
  80. Route::post(':id', '/verify');
  81. })->prefix('api.store.order.StoreOrderVerify');
  82. //用户
  83. Route::group('user', function () {
  84. //切换账号
  85. Route::get('account', 'User/account');
  86. Route::post('switch', 'User/switchUser');
  87. //收藏
  88. Route::get('/relation/product/lst', 'UserRelation/productList');
  89. Route::get('/relation/merchant/lst', 'UserRelation/merchantList');
  90. Route::post('/relation/create', 'UserRelation/create');
  91. Route::post('/relation/batch/create', 'UserRelation/batchCreate');
  92. Route::post('/relation/delete', 'UserRelation/delete');
  93. //反馈
  94. Route::post('/feedback', 'Feedback/feedback');
  95. Route::get('/feedback/list', 'Feedback/feedbackList');
  96. Route::get('/feedback/detail/:id', 'Feedback/detail');
  97. //充值
  98. Route::post('/recharge', 'UserRecharge/recharge');
  99. Route::post('/recharge/brokerage', 'UserRecharge/brokerage');
  100. //地址
  101. Route::get('/address/lst', 'UserAddress/lst');
  102. Route::post('/address/create', 'UserAddress/create');
  103. Route::get('/address/detail/:id', 'UserAddress/detail');
  104. Route::post('/address/update/:id', 'UserAddress/editDefault');
  105. Route::post('/address/delete/:id', 'UserAddress/delete');
  106. //分销海报
  107. Route::get('/spread_image', 'User/spread_image');
  108. Route::get('/v2/spread_image', 'User/spread_image_v2');
  109. //推广人列表
  110. Route::get('/spread_list', 'User/spread_list');
  111. //提现
  112. Route::get('/extract/lst', 'UserExtract/lst');
  113. Route::get('/extract/banklst', 'UserExtract/bankLst');
  114. Route::post('/extract/create', 'UserExtract/create');
  115. //绑定手机号
  116. Route::post('binding', 'User/binding');
  117. //余额记录
  118. Route::get('bill', 'User/bill');
  119. //佣金记录
  120. Route::get('brokerage_list', 'User/brokerage_list');
  121. //推广人订单
  122. Route::get('spread_order', 'User/spread_order');
  123. //推广人排行榜
  124. Route::get('spread_top', 'User/spread_top');
  125. //佣金排行榜
  126. Route::get('brokerage_top', 'User/brokerage_top');
  127. Route::get('spread_info', 'User/spread_info');
  128. //浏览记录
  129. Route::get('history', 'UserHistory/lst');
  130. Route::post('history/delete/:id', 'UserHistory/deleteHistory');
  131. Route::post('history/batch/delete', 'UserHistory/deleteHistoryBatch');
  132. //发票
  133. Route::post('receipt/create', 'UserReceipt/create');
  134. Route::get('receipt/lst', 'UserReceipt/lst');
  135. Route::get('receipt/order', 'UserReceipt/order');
  136. Route::get('receipt/order/:id', 'UserReceipt/orderDetail');
  137. Route::post('receipt/delete/:id', 'UserReceipt/delete');
  138. Route::post('receipt/update/:id', 'UserReceipt/update');
  139. Route::post('receipt/is_default/:id', 'UserReceipt/isDefault');
  140. Route::get('receipt/detail/:id', 'UserReceipt/detail');
  141. })->prefix('api.user.');
  142. //购物车
  143. Route::group('user/cart', function () {
  144. Route::get('/lst', 'StoreCart/lst');
  145. Route::post('/create', 'StoreCart/create');
  146. Route::post('/again', 'StoreCart/again');
  147. Route::post('/change/:id', 'StoreCart/change');
  148. Route::post('/delete', 'StoreCart/batchDelete');
  149. Route::get('/count', 'StoreCart/cartCount');
  150. })->prefix('api.store.order.');
  151. Route::group('store/product', function () {
  152. Route::post('/assist/create/:id', 'StoreProductAssistSet/create');
  153. Route::get('/assist/detail/:id', 'StoreProductAssistSet/detail');
  154. Route::post('/assist/set/:id', 'StoreProductAssistSet/set');
  155. Route::get('/assist/user/:id', 'StoreProductAssistSet/userList');
  156. Route::get('/assist/share/:id', 'StoreProductAssistSet/shareNum');
  157. Route::get('/assist/set/lst', 'StoreProductAssistSet/lst');
  158. Route::post('/assist/set/delete/:id', 'StoreProductAssistSet/delete');
  159. })->prefix('api.store.product.');
  160. //申请商户
  161. Route::get('intention/lst', 'api.store.merchant.MerchantIntention/lst');
  162. Route::get('intention/detail/:id', 'api.store.merchant.MerchantIntention/detail');
  163. Route::post('intention/update/:id', 'api.store.merchant.MerchantIntention/update');
  164. Route::post('store/product/group/cancel', 'api.store.product.StoreProductGroup/cancel');
  165. })->middleware(UserTokenMiddleware::class, true);
  166. //非强制登录
  167. Route::group(function () {
  168. //上传图片
  169. Route::post('upload/image/:field', 'api.Common/uploadImage');
  170. //公共配置
  171. Route::get('config', 'api.Common/config');
  172. //商品
  173. Route::group('store/product', function () {
  174. Route::get('seckill/select', 'StoreProductSeckill/select');
  175. Route::get('seckill/lst', 'StoreProductSeckill/lst');
  176. Route::get('seckill/detail/:id', 'StoreProductSeckill/detail')->middleware(VisitProductMiddleware::class, 1);
  177. Route::get('recommend/lst', 'StoreProduct/recommendList');
  178. Route::get('lst', 'StoreProduct/lst');
  179. Route::get('hot/:type', 'StoreProduct/hot');
  180. Route::get('category/lst', 'StoreCategory/lst');
  181. Route::get('category', 'StoreCategory/children');
  182. Route::get('brand/lst', 'StoreBrand/lst');
  183. Route::get('detail/:id', 'StoreProduct/detail')->middleware(VisitProductMiddleware::class, 0);
  184. Route::get('/qrcode/:id', 'StoreProduct/qrcode');
  185. Route::get('bag', 'StoreProduct/getBagList');
  186. Route::get('bag/recommend', 'StoreProduct/getBagRecomm');
  187. Route::get('bag/explain', 'StoreProduct/getBagExplain');
  188. Route::get('/reply/lst/:id', 'StoreReply/lst');
  189. //预售
  190. Route::get('/presell/lst', 'StoreProductPresell/lst');
  191. Route::get('/presell/detail/:id', 'StoreProductPresell/detail')->middleware(VisitProductMiddleware::class, 2);
  192. //预售协议
  193. Route::get('presell/agree', 'StoreProductPresell/getAgree');
  194. //助力
  195. Route::get('/assist/lst', 'StoreProductAssist/lst');
  196. //拼团
  197. Route::get('group/lst', 'StoreProductGroup/lst');
  198. Route::get('group/detail/:id', 'StoreProductGroup/detail')->middleware(VisitProductMiddleware::class, 4);
  199. Route::get('group/count', 'StoreProductGroup/userCount');
  200. Route::get('group/category', 'StoreProductGroup/category');
  201. Route::get('group/get/:id', 'StoreProductGroup/groupBuying');
  202. })->prefix('api.store.product.');
  203. //各种商品列表
  204. Route::group('product/spu', function () {
  205. //礼包 product/spu/bag
  206. Route::get('/bag', 'StoreSpu/bag');
  207. //商品 product/spu/lst
  208. Route::get('/lst', 'StoreSpu/lst');
  209. //热门 product/spu/hot/:type
  210. Route::get('/hot/:type', 'StoreSpu/hot');
  211. //推荐 product/spu/recommend
  212. Route::get('/recommend', 'StoreSpu/recommend');
  213. //商户商品 product/spu/merchant/:id
  214. Route::get('/merchant/:id', 'StoreSpu/merProductLst');
  215. //礼包推荐 product/spu/bag/recommend
  216. Route::get('/bag/recommend', 'StoreSpu/bagRecommend');
  217. //活动分类 product/spu/active/category/:type
  218. Route::get('/active/category/:type', 'StoreSpu/activeCategory');
  219. })->prefix('api.store.product.');
  220. //直播
  221. Route::group('broadcast', function () {
  222. Route::get('/lst', 'BroadcastRoom/lst');
  223. Route::get('/hot', 'BroadcastRoom/hot');
  224. })->prefix('api.store.broadcast.');
  225. //优惠券
  226. Route::group('coupon', function () {
  227. Route::get('product', 'api.store.product.StoreCoupon/coupon');
  228. Route::get('store/:id', 'api.store.product.StoreCoupon/merCoupon');
  229. });
  230. //商户
  231. Route::group('store/merchant/', function () {
  232. Route::get('/lst', 'Merchant/lst');
  233. Route::get('/product/lst/:id', 'Merchant/productList');
  234. Route::get('/category/lst/:id', 'Merchant/categoryList');
  235. Route::get('/detail/:id', 'Merchant/detail');
  236. Route::get('/qrcode/:id', 'Merchant/qrcode');
  237. })->prefix('api.store.merchant.');
  238. //文章
  239. Route::group('article', function () {
  240. Route::get('/lst/:cid', 'Article/lst');
  241. Route::get('detail/:id', 'Article/detail');
  242. Route::get('/category/lst', 'ArticleCategory/lst');
  243. })->prefix('api.article.');
  244. //管理员
  245. Route::group('admin', function () {
  246. Route::get('/statistics', '/orderStatistics');
  247. Route::get('/order_price', '/orderDetail');
  248. Route::get('/order_list', '/orderList');
  249. Route::get('/order/:id', '/order');
  250. Route::post('/mark/:id', '/mark');
  251. Route::post('/price/:id', '/price');
  252. Route::post('/delivery/:id', '/delivery');
  253. Route::get('/pay_price', '/payPrice');
  254. Route::get('/pay_number', '/payNumber');
  255. })->prefix('api.user.Admin');
  256. Route::get('excel/download/:id', 'merchant.store.order.Order/download');
  257. //申请商户
  258. Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
  259. Route::get('intention/cate', 'api.store.merchant.MerchantIntention/cateLst');
  260. //浏览量
  261. Route::post('common/visit', 'api.Common/visit');
  262. Route::get('store/product/assist/count', 'api.store.product.StoreProductAssist/userCount');
  263. //test
  264. Route::get('store/test', 'api.Test/test');
  265. })->middleware(UserTokenMiddleware::class, false);
  266. //微信支付回调
  267. Route::any('notice/wechat_pay', 'api.Common/wechatNotify')->name('wechatNotify');
  268. //小程序支付回调
  269. Route::any('notice/routine_pay', 'api.Common/routineNotify')->name('routineNotify');
  270. //支付宝支付回调
  271. Route::any('notice/alipay_pay/:type', 'api.Common/alipayNotify')->name('alipayNotify');
  272. //城市列表
  273. Route::get('system/city/lst', 'merchant.store.shipping.City/getlist');
  274. //热门搜索
  275. Route::get('common/hot_keyword', 'api.Common/hotKeyword');
  276. //推荐页 banner
  277. Route::get('common/hot_banner/:type', 'api.Common/hotBanner');
  278. //退款原因
  279. Route::get('common/refund_message', 'api.Common/refundMessage');
  280. //充值赠送
  281. Route::get('common/recharge_quota', 'api.Common/userRechargeQuota');
  282. //快递公司
  283. Route::get('common/express', 'api.Common/express');
  284. //图片转 base64
  285. Route::post('common/base64', 'api.Common/get_image_base64');
  286. //个人中心菜单
  287. Route::get('common/menus', 'api.Common/menus');
  288. //首页数据
  289. Route::get('common/home', 'api.Common/home');
  290. //经纬度转位置信息
  291. Route::get('lbs/geocoder', 'api.Common/lbs_geocoder');
  292. //获取支付宝支付链接
  293. Route::get('common/pay_key/:key', 'api.Common/pay_key');
  294. //用户反馈类型
  295. Route::get('common/feedback_type', 'api.user.FeedBackCategory/lst');
  296. //登录
  297. Route::post('auth/login', 'api.Auth/login');
  298. //短信登录
  299. Route::post('auth/smslogin', 'api.Auth/smsLogin');
  300. //微信授权
  301. Route::get('auth/wechat', 'api.Auth/auth');
  302. //小程序授权
  303. Route::post('auth/mp', 'api.Auth/mpAuth');
  304. //修改密码
  305. Route::post('user/change_pwd', 'api.Auth/changePassword');
  306. //验证码
  307. Route::post('auth/verify', 'api.Auth/verify');
  308. //微信配置
  309. Route::get('wechat/config', 'api.Wechat/jsConfig');
  310. //图片验证码
  311. Route::get('captcha', 'api.Auth/getCaptcha');
  312. })->middleware(AllowOriginMiddleware::class)->middleware(InstallMiddleware::class)
  313. ->middleware(CheckSiteOpenMiddleware::class);
  314. Route::any('/', 'View/h5')->middleware(InstallMiddleware::class)
  315. ->middleware(CheckSiteOpenMiddleware::class);
  316. Route::group('/pages', function () {
  317. Route::miss('View/h5');
  318. })->middleware(InstallMiddleware::class)
  319. ->middleware(CheckSiteOpenMiddleware::class);
  320. Route::group('/open-location', function () {
  321. Route::miss('View/h5');
  322. })->middleware(InstallMiddleware::class)
  323. ->middleware(CheckSiteOpenMiddleware::class);