Skip to content

Commit c066821

Browse files
committed
♻ (Helper): 完善return
1 parent 1244d81 commit c066821

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Helpers/ResultHelper.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,26 @@ public static function returnFormat(string $msg = 'success', $code = self::CODE_
3434
$ret['data'] = $data;
3535
return $ret;
3636
}
37+
38+
/**
39+
* 返回错误信息
40+
* @param string $msg
41+
* @return array
42+
*/
43+
public static function error(string $msg = 'error'): array
44+
{
45+
return self::returnFormat($msg, self::CODE_WARNING);
46+
}
47+
48+
/**
49+
* 返回成功信息
50+
* @param string $msg
51+
* @param array $data
52+
* @return array
53+
*/
54+
public static function success(string $msg = 'success', array $data = []): array
55+
{
56+
return self::returnFormat($msg, self::CODE_SUCCESS, $data);
57+
}
58+
3759
}

0 commit comments

Comments
 (0)