|
@@ -205,6 +205,12 @@ class Api
|
|
*/
|
|
*/
|
|
protected function success($msg = '', $data = null, $code = 1, $type = null, array $header = [])
|
|
protected function success($msg = '', $data = null, $code = 1, $type = null, array $header = [])
|
|
{
|
|
{
|
|
|
|
+ if($msg == 1){
|
|
|
|
+ $msg = 'success';
|
|
|
|
+ }
|
|
|
|
+ if(empty($msg)){
|
|
|
|
+ $msg = '操作成功';
|
|
|
|
+ }
|
|
$this->result($msg, $data, $code, $type, $header);
|
|
$this->result($msg, $data, $code, $type, $header);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -218,6 +224,9 @@ class Api
|
|
*/
|
|
*/
|
|
protected function error($msg = '', $data = null, $code = 0, $type = null, array $header = [])
|
|
protected function error($msg = '', $data = null, $code = 0, $type = null, array $header = [])
|
|
{
|
|
{
|
|
|
|
+ if(empty($msg)){
|
|
|
|
+ $msg = __('Invalid parameters');
|
|
|
|
+ }
|
|
$this->result($msg, $data, $code, $type, $header);
|
|
$this->result($msg, $data, $code, $type, $header);
|
|
}
|
|
}
|
|
|
|
|