feat : check
This commit is contained in:
59
app/Service/Api/Salesman/BaseSalesmanService.php
Normal file
59
app/Service/Api/Salesman/BaseSalesmanService.php
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user