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

@@ -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
}
}