扩展功能

This commit is contained in:
wuyanwen
2019-12-06 09:17:40 +08:00
parent 397c8bb7f7
commit 5c7765c97f
18 changed files with 1396 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace catcher;
class CatchResponse
{
/**
* 成功的响应
*
* @time 2019年12月02日
* @param array $data
* @param $msg
* @param int $code
* @return \think\response\Json
*/
public static function success($data = [], $msg = '', $code = 10000): \think\response\Json
{
return json([
'code' => $code,
'msg' => $msg,
'data' => $data,
]);
}
/**
* 错误的响应
*
* @time 2019年12月02日
* @param string $msg
* @param int $code
* @return \think\response\Json
*/
public static function fail($msg = '', $code = 10001): \think\response\Json
{
return json([
'code' => $code,
'msg' => $msg,
]);
}
}