26 lines
439 B
PHP
26 lines
439 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Services\Base;
|
||
|
|
|
||
|
|
class BaseService
|
||
|
|
{
|
||
|
|
protected $userId;
|
||
|
|
protected static $instance;
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
$token = request()->header('token');
|
||
|
|
$this->userId = $token;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 单例
|
||
|
|
|
||
|
|
public static function getInstance()
|
||
|
|
{
|
||
|
|
if (!self::$instance instanceof self) {
|
||
|
|
self::$instance = new self();
|
||
|
|
}
|
||
|
|
return self::$instance;
|
||
|
|
}
|
||
|
|
}
|