浏览代码

Merge branch 'master' of 47.76.126.2:seven/bot-28

seven 1 周之前
父节点
当前提交
756b409eed
共有 5 个文件被更改,包括 40 次插入14 次删除
  1. 20 13
      app/Http/Controllers/admin/User.php
  2. 1 1
      app/Services/SecretService.php
  3. 7 0
      lang/en/messages.php
  4. 7 0
      lang/vi/messages.php
  5. 5 0
      lang/zh/messages.php

+ 20 - 13
app/Http/Controllers/admin/User.php

@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
 use App\Services\RoomService;
 use App\Services\RoomService;
 use App\Services\SecretService;
 use App\Services\SecretService;
 use App\Services\TopUpService;
 use App\Services\TopUpService;
+use Illuminate\Support\Facades\App;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Validator;
@@ -96,19 +97,25 @@ class User extends Controller
             }
             }
             $oldUser = UserModel::where('secret_key', $params['secret_key'])->first();
             $oldUser = UserModel::where('secret_key', $params['secret_key'])->first();
             $newUser = UserModel::where('member_id', $params['member_id'])->first();
             $newUser = UserModel::where('member_id', $params['member_id'])->first();
-            $text = "账户转移通知:\n";
-            $text .= "管理员已将您的账户转移至新用户\n\n";
-            $text .= "新用户信息\n";
-            $text .= "用户ID:{$newUser->getMemberId()}\n";
-            $text .= "用户名:{$newUser->getUsername()}\n";
-            $text .= "昵称:{$newUser->getFirstName()}\n";
+            App::setLocale($oldUser->language);
+            $text = lang('账户转移通知') . ":\n";
+            $text .= lang('管理员已将您的账户转移至新用户') . "\n\n";
+            $text .= lang('新用户信息') . "\n";
+            $text .= lang('用户ID') . ":{$newUser->getMemberId()}\n";
+            if ($newUser->getUsername()) {
+                $text .= lang("用户名") . ":@{$newUser->getUsername()}\n";
+            }
+            $text .= lang('昵称') . ":{$newUser->getFirstName()}\n";
             TopUpService::notifyTransferSuccess($oldUser->getMemberId(), $text);
             TopUpService::notifyTransferSuccess($oldUser->getMemberId(), $text);
-            $text = "账户转移通知:\n";
-            $text .= "管理员已将指定账户转移至您的账户\n\n";
-            $text .= "原账户信息\n\n";
-            $text .= "用户ID:{$oldUser->getMemberId()}\n";
-            $text .= "用户名:{$oldUser->getUsername()}\n";
-            $text .= "昵称:{$oldUser->getFirstName()}\n";
+            App::setLocale($newUser->language);
+            $text = lang("账户转移通知") . ":\n";
+            $text .= lang("管理员已将指定账户转移至您的账户") . "\n\n";
+            $text .= lang('原账户信息') . "\n\n";
+            $text .= lang('用户ID') . ":{$oldUser->getMemberId()}\n";
+            if ($oldUser->getUsername()) {
+                $text .= lang('用户名') . ":@{$oldUser->getUsername()}\n";
+            }
+            $text .= lang('昵称') . ":{$oldUser->getFirstName()}\n";
             TopUpService::notifyTransferSuccess($newUser->getMemberId(), $text);
             TopUpService::notifyTransferSuccess($newUser->getMemberId(), $text);
             DB::commit();
             DB::commit();
         } catch (ValidationException $e) {
         } catch (ValidationException $e) {
@@ -116,7 +123,7 @@ class User extends Controller
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {
         } catch (Exception $e) {
             DB::rollBack();
             DB::rollBack();
-            if($e->getCode() == HttpStatus::CUSTOM_ERROR){
+            if ($e->getCode() == HttpStatus::CUSTOM_ERROR) {
                 return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
                 return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
             }
             }
             return $this->error(intval($e->getCode()));
             return $this->error(intval($e->getCode()));

+ 1 - 1
app/Services/SecretService.php

@@ -126,7 +126,7 @@ class SecretService
     {
     {
         $user = User::where('secret_key', $secretKey)->where('member_id', '!=', $chatId)->first();
         $user = User::where('secret_key', $secretKey)->where('member_id', '!=', $chatId)->first();
         $newUser = User::where('member_id', $chatId)->first();
         $newUser = User::where('member_id', $chatId)->first();
-        if (!$newUser || $user) return false;
+        if (!$newUser || !$user) return false;
         $oldMemberId = $user->getMemberId();
         $oldMemberId = $user->getMemberId();
 //        $oldUserId = $user->id;
 //        $oldUserId = $user->id;
         $newMemberId = $chatId;
         $newMemberId = $chatId;

+ 7 - 0
lang/en/messages.php

@@ -285,6 +285,13 @@ return [
     "消息格式错误!" => "Message Format Error!",
     "消息格式错误!" => "Message Format Error!",
     "任何疑问都可以联系唯一客服" => "For Any Questions, Contact the Sole Customer Service",
     "任何疑问都可以联系唯一客服" => "For Any Questions, Contact the Sole Customer Service",
     "🤖开始使用" => "🤖Get started",
     "🤖开始使用" => "🤖Get started",
+    "账户转移通知" => "Account Transfer Notification",
+    "管理员已将您的账户转移至新用户" => "The administrator has transferred your account to a new user",
+    "新用户信息" => "New User Information",
+    "管理员已将指定账户转移至您的账户" => "The administrator has transferred the specified account to your account",
+    "原账户信息" => "Original Account Information",
+    
+
 
 
 
 
 
 

+ 7 - 0
lang/vi/messages.php

@@ -286,6 +286,13 @@ return [
     "任何疑问都可以联系唯一客服" => "Mọi thắc mắc có thể liên hệ bộ phận chăm sóc khách hàng duy nhất",
     "任何疑问都可以联系唯一客服" => "Mọi thắc mắc có thể liên hệ bộ phận chăm sóc khách hàng duy nhất",
     "🤖开始使用" => "🤖Bắt đầu sử dụng",
     "🤖开始使用" => "🤖Bắt đầu sử dụng",
     
     
+    "账户转移通知" => "Thông báo chuyển tài khoản",
+    "管理员已将您的账户转移至新用户" => "Quản trị viên đã chuyển tài khoản của bạn sang người dùng mới",
+    "新用户信息" => "Thông tin người dùng mới",
+    "管理员已将指定账户转移至您的账户" => "Quản trị viên đã chuyển tài khoản được chỉ định sang tài khoản của bạn",
+    "原账户信息" => "Thông tin tài khoản cũ",
+
+
 
 
 
 
 
 

+ 5 - 0
lang/zh/messages.php

@@ -285,6 +285,11 @@ return [
     "消息格式错误!" => "消息格式错误!",
     "消息格式错误!" => "消息格式错误!",
     "任何疑问都可以联系唯一客服" => "任何疑问都可以联系唯一客服",
     "任何疑问都可以联系唯一客服" => "任何疑问都可以联系唯一客服",
     "🤖开始使用" => "🤖开始使用",
     "🤖开始使用" => "🤖开始使用",
+    "账户转移通知" => "账户转移通知",
+    "管理员已将您的账户转移至新用户" => "管理员已将您的账户转移至新用户",
+    "新用户信息" => "新用户信息",
+    "管理员已将指定账户转移至您的账户" => "管理员已将指定账户转移至您的账户",
+    "原账户信息" => "原账户信息",
 
 
 
 
 ];
 ];