CRMEB/backend/app/api/middleware/WriteOffAuthMiddleware.php
吴昊天 2444d60cc4 feat(订单核销): 恢复移动端核销页与 order_verific 接口,核销后进入待评价
仅开放给核销员/配送员,并补齐 page_link 与个人中心菜单契约路径。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 10:24:26 +08:00

45 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\api\middleware;
use app\services\personnel\ServicePersonnelServices;
use app\services\system\store\SystemStoreStaffServices;
use crmeb\interfaces\MiddlewareInterface;
use think\Request;
/**
* 移动端核销权限:核销员或配送员其一即可
*/
class WriteOffAuthMiddleware implements MiddlewareInterface
{
public function handle(Request $request, \Closure $next)
{
$uid = (int)$request->uid();
if ($uid <= 0) {
return app('json')->fail('请先登录');
}
/** @var SystemStoreStaffServices $storeStaffServices */
$storeStaffServices = app()->make(SystemStoreStaffServices::class);
if ($storeStaffServices->verifyStatus($uid)) {
return $next($request);
}
/** @var ServicePersonnelServices $deliveryServices */
$deliveryServices = app()->make(ServicePersonnelServices::class);
if ($deliveryServices->checkoutIsService($uid)) {
return $next($request);
}
return app('json')->fail('您无核销权限,请联系管理员');
}
}