From cad2d155275dddf64d36baa5f19b58241a7e3558 Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Thu, 10 Aug 2023 17:32:55 +0800 Subject: [PATCH] no message --- app/Libraries/Lu.php | 2 +- app/Libraries/Yo.php | 49 ++++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/Libraries/Lu.php b/app/Libraries/Lu.php index feb7464..82e5e93 100644 --- a/app/Libraries/Lu.php +++ b/app/Libraries/Lu.php @@ -142,7 +142,7 @@ class Lu self::$request->response_data = $data_str; self::$request->save(); } - return $res; + return response()->json($res)->setEncodingOptions(JSON_UNESCAPED_UNICODE); } // endregion // region echo diff --git a/app/Libraries/Yo.php b/app/Libraries/Yo.php index 5fd18cd..41da2b6 100755 --- a/app/Libraries/Yo.php +++ b/app/Libraries/Yo.php @@ -5,30 +5,35 @@ use Illuminate\Support\Str; class Yo { - public static function create_echo($id = 0) - { - return Lu::echo(config('code.200.c'), 200, ['id' => $id]); - } + public static function create_echo($id = 0) + { + return Lu::echo(config('code.200.c'), 200, ['id' => $id]); + } - public static function delete_echo($id = 0) - { - return Lu::echo(config('code.200.d'), 200, ['id' => $id]); - } + public static function delete_echo($id = 0) + { + return Lu::echo(config('code.200.d'), 200, ['id' => $id]); + } - public static function update_echo($id = 0) - { - return Lu::echo(config('code.200.u'), 200, ['id' => $id]); - } + public static function update_echo($id = 0) + { + return Lu::echo(config('code.200.u'), 200, ['id' => $id]); + } - public static function error_echo($code, $replace = []) - { - $msg = config("code.{$code}"); - if (count($replace)) $msg = Str::replaceArray('?', $replace, $msg); - throw new HttpResponseException(response()->json(Lu::echo($msg, $code))); - } + public static function error_echo($code, $replace = []) + { + $msg = config("code.{$code}"); + if (count($replace)) $msg = Str::replaceArray('?', $replace, $msg); + throw new HttpResponseException(Lu::echo($msg, $code)); + } - public static function echo($data = []) - { - return Lu::echo(config('code.200.r'), 200, $data); - } + public static function debug($data) + { + throw new HttpResponseException(Lu::echo('Debug', 100000, $data)); + } + + public static function echo($data = []) + { + return Lu::echo(config('code.200.r'), 200, $data); + } }