<?php


namespace app\admin\controller;

use app\common\middleware\WriteLog;
use app\common\service\FileService;
use app\common\service\RoleService;
use app\common\service\ProjectService;
use app\common\service\ContractService;
use app\common\exception\CatchException;
use app\common\service\ProjectStatusService;
use app\admin\middleware\CheckPermissionAttr;
use app\common\service\ProjectScheduleService;

/**
 * 需要登录 的基类
 * Class AuthBase
 * @package app\api\controller
 */
class BaseAuthorized extends Base
{
    protected $middleware = [CheckPermissionAttr::class, WriteLog::class];
    
    protected $checkTokenOpen = true;

    protected function ProjectService(): ProjectService
    {
        return (new ProjectService($this->app))->exceptionClass(CatchException::class);
    }

    protected function ProjectScheduleService(): ProjectScheduleService
    {
        return (new ProjectScheduleService($this->app))->exceptionClass(CatchException::class);
    }
    protected function ProjectStatusService(): ProjectStatusService
    {
        return (new ProjectStatusService($this->app))->exceptionClass(CatchException::class);
    }
    protected function ContractService(): ContractService
    {
        return (new ContractService($this->app))->exceptionClass(CatchException::class);
    }

    protected function FileService(): FileService
    {
        return (new FileService($this->app))->exceptionClass(CatchException::class);
    }

    protected function RoleService(): RoleService
    {
        return (new RoleService($this->app))->exceptionClass(CatchException::class);
    }
}