<?php
namespace app\api\route;

use app\api\middleware\AllowOriginMiddleware;
use app\api\middleware\UserMiddleware;
use think\facade\Route;

/**
 * 首页接口
 */
Route::group('index',function () {
    //产品分类
    Route::rule('getCategory', 'v1.index/getCategory');
    //产品标签
    Route::get('getKeyword/:cid', 'v1.index/getKeyword');
    //产品列表
    Route::rule('productList', 'v1.index/productList');
    //产品详情
    Route::get('product/:id', 'v1.index/productDetail');

})->middleware([
    AllowOriginMiddleware::class
]);

Route::group(function () {
    //产品分享二维码
    Route::get('product/code/:id', 'v1.index/code')->name('productCode');

})->middleware([
    AllowOriginMiddleware::class,
    UserMiddleware::class
]);
