2021-01-04 11:04:48 +08:00

65 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2021 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库https://gitee.com/zoujingli/ThinkLibrary
// | github 代码仓库https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace think\admin;
use think\App;
use think\Container;
/**
* 自定义服务基类
* Class Service
* @package think\admin
*/
abstract class Service
{
/**
* 应用实例
* @var App
*/
protected $app;
/**
* Service constructor.
* @param App $app
*/
public function __construct(App $app)
{
$this->app = $app;
$this->initialize();
}
/**
* 初始化服务
* @return static
*/
protected function initialize()
{
return $this;
}
/**
* 静态实例对象
* @param array $var 实例参数
* @param boolean $new 创建新实例
* @return static
*/
public static function instance(array $var = [], bool $new = false)
{
return Container::getInstance()->make(static::class, $var, $new);
}
}