api.php 18 KB

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