You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
|
|
class Yz
|
|
{
|
|
public static function echo($data = [], $code = 200)
|
|
{
|
|
$result = array();
|
|
$result['code'] = $code;
|
|
$result['data'] = $data;
|
|
return response()->json($result)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
public static function echoError($msg)
|
|
{
|
|
$result = array();
|
|
$result['status'] = 'no';
|
|
$result['msg'] = $msg;
|
|
return response()->json($result)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
public static function echoError1($msg)
|
|
{
|
|
$result = array();
|
|
$result['status'] = false;
|
|
$result['msg'] = $msg;
|
|
return response()->json($result)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
public static function Return($status, $msg, $data = [])
|
|
{
|
|
$result = array();
|
|
$result['status'] = $status;
|
|
$result['msg'] = $msg;
|
|
$result['data'] = $data;
|
|
return $result;
|
|
}
|
|
|
|
public static function debug($data)
|
|
{
|
|
throw new HttpResponseException(response()->json(Yz::Return(100000, 'Debug', $data))->setEncodingOptions(JSON_UNESCAPED_UNICODE));
|
|
}
|
|
}
|
|
|