|
@@ -4,11 +4,34 @@ use Illuminate\Support\Facades\Route;
|
|
|
use Longyi\Gift\Http\Controllers\Shop\GiftController;
|
|
use Longyi\Gift\Http\Controllers\Shop\GiftController;
|
|
|
use Longyi\RewardPoints\Http\Middleware\ApiCustomerAuthenticate;
|
|
use Longyi\RewardPoints\Http\Middleware\ApiCustomerAuthenticate;
|
|
|
|
|
|
|
|
-Route::group(['prefix' => 'api', 'middleware' => ['api','web']], function () {
|
|
|
|
|
- Route::get('/lists', [GiftController::class, 'lists'])->name('shop.api.gift.lists');
|
|
|
|
|
- Route::post('/add', [GiftController::class, 'add'])->name('shop.api.gift.add');
|
|
|
|
|
- Route::get('/my-gift-cards', [GiftController::class, 'getCustomerGiftCards'])->name('shop.api.checkout.cart.giftcard.list');
|
|
|
|
|
- Route::post('/activate', [GiftController::class, 'activateGiftCard'])->name('shop.api.checkout.cart.giftcard.activate');
|
|
|
|
|
- Route::delete('/remove', [GiftController::class, 'destroyGiftCard'])->name('shop.api.checkout.cart.giftcard.remove');
|
|
|
|
|
- Route::post('/auto-apply-expiring', [GiftController::class, 'autoApplyExpiringGiftCard'])->name('shop.api.checkout.cart.giftcard.auto-apply');
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+|--------------------------------------------------------------------------
|
|
|
|
|
+| 网站前台路由(传统 Web,session 登录)
|
|
|
|
|
+|--------------------------------------------------------------------------
|
|
|
|
|
+| 走 web + customer 中间件,未登录会跳转登录页;POST/DELETE 需带 CSRF token。
|
|
|
|
|
+*/
|
|
|
|
|
+Route::group(['middleware' => ['web', 'customer'], 'prefix' => 'gift'], function () {
|
|
|
|
|
+ Route::get('/lists', [GiftController::class, 'lists'])->name('shop.gift.lists');
|
|
|
|
|
+ Route::post('/add', [GiftController::class, 'add'])->name('shop.gift.add');
|
|
|
|
|
+ Route::get('/my-gift-cards', [GiftController::class, 'getCustomerGiftCards'])->name('shop.gift.my-gift-cards');
|
|
|
|
|
+ Route::post('/activate', [GiftController::class, 'activateGiftCard'])->name('shop.gift.activate');
|
|
|
|
|
+ Route::delete('/remove', [GiftController::class, 'destroyGiftCard'])->name('shop.gift.remove');
|
|
|
|
|
+ Route::post('/auto-apply-expiring', [GiftController::class, 'autoApplyExpiringGiftCard'])->name('shop.gift.auto-apply-expiring');
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+|--------------------------------------------------------------------------
|
|
|
|
|
+| API 路由(前后端分离 / 第三方客户端,token 或 storefront key)
|
|
|
|
|
+|--------------------------------------------------------------------------
|
|
|
|
|
+| 走 api + ApiCustomerAuthenticate(支持 session cookie / Sanctum token / storefront key)。
|
|
|
|
|
+*/
|
|
|
|
|
+Route::group(['prefix' => 'api'], function () {
|
|
|
|
|
+ Route::group(['middleware' => ['api', ApiCustomerAuthenticate::class], 'prefix' => 'gift'], function () {
|
|
|
|
|
+ Route::get('/lists', [GiftController::class, 'lists'])->name('shop.api.gift.lists');
|
|
|
|
|
+ Route::post('/add', [GiftController::class, 'add'])->name('shop.api.gift.add');
|
|
|
|
|
+ Route::get('/my-gift-cards', [GiftController::class, 'getCustomerGiftCards'])->name('shop.api.checkout.cart.giftcard.list');
|
|
|
|
|
+ Route::post('/activate', [GiftController::class, 'activateGiftCard'])->name('shop.api.checkout.cart.giftcard.activate');
|
|
|
|
|
+ Route::delete('/remove', [GiftController::class, 'destroyGiftCard'])->name('shop.api.checkout.cart.giftcard.remove');
|
|
|
|
|
+ Route::post('/auto-apply-expiring', [GiftController::class, 'autoApplyExpiringGiftCard'])->name('shop.api.checkout.cart.giftcard.auto-apply');
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|