feat : login wx
This commit is contained in:
52
app/Service/Api/BaseService.php
Normal file
52
app/Service/Api/BaseService.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Api;
|
||||
|
||||
use App\Lib\ApiReturn;
|
||||
use Hyperf\Context\Context;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
|
||||
abstract class BaseService
|
||||
{
|
||||
/**
|
||||
* 请求对象
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Inject]
|
||||
protected RequestInterface $request;
|
||||
|
||||
/**
|
||||
* 通用返回对象
|
||||
* @var ApiReturn $return
|
||||
*/
|
||||
#[Inject]
|
||||
protected ApiReturn $return;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
* @var int $userId
|
||||
*/
|
||||
protected int $userId = 0;
|
||||
|
||||
/**
|
||||
* 主构造函数(获取请求对象)
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->userId = Context::get("user_id",0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主体函数抽象类
|
||||
*/
|
||||
abstract public function handle();
|
||||
}
|
||||
Reference in New Issue
Block a user