feat : check

This commit is contained in:
2025-04-01 14:59:08 +08:00
parent 44e773305f
commit 6bf2dc8a17
5 changed files with 108 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ namespace App\Constants\Common;
class RoleCode
{
/**
* @var int 角色 1=超级管理员 2=管理员 3=财务 5=客服 6=市场部 7=厨师 8=司机 9=仓管 10=套餐餐配员 11=自选餐配员
* @var int 角色 1=超级管理员 2=管理员 3=财务 5=客服 6=市场部 7=厨师 8=司机 9=仓管 10=套餐餐配员 11=自选餐配员 12=核销员
*/
CONST INT SUPER_ADMIN = 1;
CONST INT ADMIN = 2;
@@ -17,4 +17,5 @@ class RoleCode
CONST INT WAREHOUSE = 9;
CONST INT MEAL_CATERING = 10;
CONST INT OPTION_CATERING = 11;
CONST INT SALESMAN = 12;
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Controller\Api;
use App\Controller\AbstractController;
use App\Middleware\Api\JwtAuthMiddleware;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middlewares;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Validation\Annotation\Scene;
#[Controller(prefix: 'api/salesman')]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class SalesmanController extends AbstractController
{
#[RequestMapping(path: 'take_photo',methods: 'POST')]
#[Scene(scene: 'take_photo')]
public function forceTakePhoto()
{
return $response->raw('Hello Hyperf!');
}
}

View File

@@ -31,9 +31,9 @@ class CheckService extends CateringBaseService
protected OrderMealCateringLog $orderMealCateringLog;
/**
* @var OrderMealCateringLog
* @var OrderMealCateringLog|null
*/
protected OrderMealCateringLog $logInfo;
protected OrderMealCateringLog|null $logInfo;
/**
* @var Order

View File

@@ -0,0 +1,59 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\Salesman;
use App\Constants\Common\RoleCode;
use App\Exception\ErrException;
use App\Model\AdminUser;
use App\Service\Api\BaseService;
use App\Service\ServiceTrait\Common\CycleTrait;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Model;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
abstract class BaseSalesmanService extends BaseService
{
use CycleTrait;
/**
* @var int
*/
protected int $cycleId;
/**
* @var Builder|Model|AdminUser|null
*/
protected AdminUser|null|Builder|Model $adminInfo;
/**
* @var AdminUser
*/
#[Inject]
protected AdminUser $adminUserModel;
/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __construct()
{
parent::__construct();
$this->cycleId = $this->initTodayCycleId();
$this->adminInfo = $this->adminUserModel->getAdminInfoByBindUserId($this->userId);
if ($this->adminInfo->role_id != RoleCode::SALESMAN) throw new ErrException('暂无权限,请联系客服并提供相关信息绑定账号');
}
abstract public function handle();
}

View File

@@ -0,0 +1,19 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\Salesman;
class ForceTakePhotoService extends BaseSalesmanService
{
public function handle()
{
//todo Write logic
}
}