Ken 2 тижнів тому
батько
коміт
e152f63f3c
2 змінених файлів з 14 додано та 3 видалено
  1. 13 2
      app/Helpers/helpers.php
  2. 1 1
      app/Http/Controllers/admin/User.php

+ 13 - 2
app/Helpers/helpers.php

@@ -1,4 +1,15 @@
 <?php
+
+use Illuminate\Support\Facades\Lang;
+
+if (!function_exists('lang')) {
+    function lang(string $key): string
+    {
+        return Lang::get("messages.{$key}");
+    }
+}
+
+
 if (!function_exists('get_cache_key')) {
     function get_cache_key(string $id): string
     {
@@ -94,8 +105,8 @@ function bcdechex($dec)
     $hex = '';
     while (bccomp($dec, 0) > 0) {
         $last = bcmod($dec, 16);
-        $hex  = dechex($last) . $hex;
-        $dec  = bcdiv($dec, 16, 0);
+        $hex = dechex($last) . $hex;
+        $dec = bcdiv($dec, 16, 0);
     }
     return $hex ?: '0';
 }

+ 1 - 1
app/Http/Controllers/admin/User.php

@@ -93,7 +93,7 @@ class User extends Controller
 
             $res = SecretService::migration($params['member_id'], $params['secret_key']);
             if (!$res) {
-                throw new Exception("迁移失败", HttpStatus::CUSTOM_ERROR);
+                throw new Exception(lang("迁移失败"), HttpStatus::CUSTOM_ERROR);
             }
             $oldUser = UserModel::where('secret_key', $params['secret_key'])->first();
             $newUser = UserModel::where('member_id', $params['member_id'])->first();