erp/routes/api.php

94 lines
5.6 KiB
PHP

<?php
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Role\RolesController;
use App\Http\Controllers\UploadController;
use App\Http\Controllers\Shop\ShopsController;
use App\Http\Controllers\Goods\GoodsSkusController;
use App\Http\Controllers\Business\BusinessGoodsSkusController;
use App\Http\Controllers\Group\GroupsController;
use App\Http\Controllers\Business\BusinessOrderController;
use App\Http\Controllers\Goods\GoodsSkuLocationController;
use App\Http\Controllers\Goods\GoodsCombinationController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware(['auth:api', 'check.permissions'])->group(function () {
// 用户
Route::resource('users', 'User\UsersController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
// 商品种类
Route::resource('goods_types', 'Goods\GoodsTypesController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
// 商品品牌
Route::resource('goods_brands', 'Goods\GoodsBrandsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
// 日志
Route::resource('logs', 'Log\LogsController', ['only' => ['index']]);
// 商品
Route::resource('goods', 'Goods\GoodsController', ['only' => ['index', 'store']]);
Route::resource('goods_combination', 'Goods\GoodsCombinationController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
// 商品规格
Route::resource('goods_skus', 'Goods\GoodsSkusController', ['only' => ['index', 'show', 'update', 'store']]);
Route::patch('batch/goods_skus', [GoodsSkusController::class, 'batchUpdate'])->name('goods_sku.batch_update');
Route::patch('single/goods_skus/{id}', [GoodsSkusController::class, 'updateField'])->name('goods_sku.single_update');
// 店铺
Route::resource('shops', 'Shop\ShopsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
Route::get('count/orders/num', [ShopsController::class, 'countOrdersNumWithSkuCode'])->name('goods_sku.orders_num');
Route::get('download/{id}/goods', [ShopsController::class, 'downloadGoods'])->name('business.goods_sku.download');
Route::put('sync/shop/stock', [ShopsController::class, 'syncStock'])->name('business.shop.sync_stock');
// 角色
Route::resource('roles', 'Role\RolesController', ['only' => ['index', 'store', 'show', 'update']]);
Route::post('roles/{id}/permissions', [RolesController::class, 'addPermissions'])->name('roles.permission');
// 权限
Route::resource('permissions', 'Permission\PermissionsController', ['only' => ['index',
// 'store', 'show', 'update', 'destroy'
]]);
// 平台
Route::resource('plat_goods', 'Business\BusinessGoodsSkusController', ['only' => ['index', 'update', 'destroy']]);
Route::get('plat_orders', [BusinessOrderController::class, 'index'])->name('plat.orders.index');
Route::get('plat_group_activity/{shopId}', [BusinessOrderController::class, 'groupActivity'])->name('plat.activity.list');
Route::post('plat/sync/{id}/stock', [BusinessGoodsSkusController::class, 'syncStock'])->name('plat.sync.stock');
// 团购
Route::resource('group', 'Group\GroupsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
// 商品货架
Route::get('goods_sku_location', [GoodsSkuLocationController::class, 'index'])->name('goods_sku_location.index');
Route::put('goods_sku_location', [GoodsSkuLocationController::class, 'update'])->name('goods_sku_location.update');
Route::delete('goods_sku_location', [GoodsSkuLocationController::class, 'delete'])->name('goods_sku_location.delete');
});
Route::get('stock/goods_skus', [GoodsSkusController::class, 'stockNum'])->middleware('auth:api');
Route::get('goods/filter/{title}', [GoodsCombinationController::class, 'goodsSkus'])->middleware('auth:api');
// 登录
Route::post('/auth/login', [LoginController::class, 'login'])->name('auth.login');
// 菜单
Route::resource('menus', 'Menu\MenusController', ['only' => ['index',
// 'store', 'show', 'update', 'destroy'
]])->middleware('auth:api');
// 获取平台列表
Route::get('shop_platforms', [ShopsController::class, 'getPlatList'])->name('plat.list')->middleware('auth:api');
// 团购商品添加列表
Route::get('goodsList', [GroupsController::class, 'goodsList'])->name('goods.list')->middleware('auth:api');
Route::get('groupGoods', [GroupsController::class, 'getGoods'])->name('group.get_goods')->middleware('auth:api');
Route::post('groupGoods', [GroupsController::class, 'addGroupGoods'])->name('group.add_goods')->middleware('auth:api');
Route::get('addGoods', [GroupsController::class, 'addGoods'])->name('group.add_goods')->middleware('auth:api');
// 妙选商城数据推送
Route::post('business', [ShopsController::class, 'business'])->name('shop.put.business');
// 盘点导入
Route::post('inventory/goods_skus', [GoodsSkusController::class, 'inventoryImport'])->name('goods_sku.inventory');
// 商品货架导入
Route::post('goods_sku_location', [GoodsSkuLocationController::class, 'import'])->name('goods_sku_location.import');
// 今日价格导入
Route::post('today/price', [BusinessGoodsSkusController::class, 'todayPriceImport'])->name('plat.today_price.import');
// 文件上传
Route::post('upload', [UploadController::class, 'store'])->name('upload.file');