index.php 771 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\api\route;
  3. use app\api\middleware\AllowOriginMiddleware;
  4. use app\api\middleware\UserMiddleware;
  5. use think\facade\Route;
  6. /**
  7. * 首页接口
  8. */
  9. Route::group('index',function () {
  10. //产品分类
  11. Route::rule('getCategory', 'v1.index/getCategory');
  12. //产品标签
  13. Route::get('getKeyword/:cid', 'v1.index/getKeyword');
  14. //产品列表
  15. Route::rule('productList', 'v1.index/productList');
  16. //产品详情
  17. Route::get('product/:id', 'v1.index/productDetail');
  18. })->middleware([
  19. AllowOriginMiddleware::class
  20. ]);
  21. Route::group(function () {
  22. //产品分享二维码
  23. Route::get('product/code/:id', 'v1.index/code')->name('productCode');
  24. })->middleware([
  25. AllowOriginMiddleware::class,
  26. UserMiddleware::class
  27. ]);