BaseLogic.php
821 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace App\Http\Logic\Bside;
use App\Enums\Common\Code;
use App\Exceptions\BsideGlobalException;
/**
* @notes: 逻辑层基类 控制器调用 统一返回 统一抛出异常
* @author:wlj
* @date: 2022/6/7 17:37
*/
class BaseLogic
{
/**
* @notes: 请简要描述方法功能
* @param array $data
* @return array
* @author:wlj
* @date: 2022/7/19 12:25
*/
public function success(array $data): array
{
return $data;
}
/**
* @notes: 错误抛出
* @param string $code
* @param string $message
* @throws BsideGlobalException
* @author:wlj
* @date: 2022/7/19 12:28
*/
public function fail(string $code = Code::SYSTEM_ERROR, $message = "")
{
throw new BsideGlobalException($code, $message);
}
}