56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Api\Driver;
|
|
|
|
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 BaseDriverService extends BaseService
|
|
{
|
|
use CycleTrait;
|
|
|
|
/**
|
|
* @var AdminUser
|
|
*/
|
|
#[Inject]
|
|
protected AdminUser $adminUserModel;
|
|
|
|
/**
|
|
* @var Builder|Model|AdminUser|null
|
|
*/
|
|
protected AdminUser|null|Builder|Model $adminInfo;
|
|
|
|
protected int $cycleId;
|
|
|
|
/**
|
|
* @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::DRIVER) throw new ErrException('暂无权限,请联系客服并提供相关信息绑定账号');
|
|
}
|
|
|
|
abstract public function handle();
|
|
} |