Ken 2 viikkoa sitten
vanhempi
commit
d786159ce7
4 muutettua tiedostoa jossa 135 lisäystä ja 94 poistoa
  1. 63 56
      app/Services/BetService.php
  2. 24 12
      lang/en/messages.php
  3. 23 12
      lang/vi/messages.php
  4. 25 14
      lang/zh/messages.php

+ 63 - 56
app/Services/BetService.php

@@ -5,10 +5,12 @@ namespace App\Services;
 
 use App\Http\Controllers\admin\GameplayRule;
 use App\Models\Rebate;
+use App\Models\User;
 use App\Services\BaseService;
 use App\Models\Bet;
 use App\Models\Config;
 use Carbon\Carbon;
+use Illuminate\Support\Facades\App;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
@@ -555,8 +557,8 @@ class BetService extends BaseService
 
         $total_amount = BalanceLogService::model()::where('member_id', $memberId)->where('change_type', '中奖')->sum('amount');
         $total_amount = number_format($total_amount, 2);
-        $text = lang("历史注单")." \n";
-        $text .= lang("中奖总派彩").":{$total_amount} \n";
+        $text = lang("历史注单") . " \n";
+        $text .= lang("中奖总派彩") . ":{$total_amount} \n";
         foreach ($list as $k => $v) {
             if ($v->status == self::model()::STATUS_SETTLED) {
                 $phase = $v->profit - $v->amount;
@@ -566,10 +568,10 @@ class BetService extends BaseService
             }
 
             $text .= "-------------------------------------\n";
-            $text .= lang("期数").":{$v->issue_no} \n";
-            $text .= lang("内容").":{$v->keywords} \n";
-            $text .= lang("金额").":{$v->amount} \n";
-            $text .= lang("盈亏").":{$phase} \n";
+            $text .= lang("期数") . ":{$v->issue_no} \n";
+            $text .= lang("内容") . ":{$v->keywords} \n";
+            $text .= lang("金额") . ":{$v->amount} \n";
+            $text .= lang("盈亏") . ":{$phase} \n";
         }
 
         $msg['text'] = $text;
@@ -582,16 +584,16 @@ class BetService extends BaseService
 
         if ($page > 1) {
             $keyboard[] = [
-                ['text' => "👆".lang("上一页"), 'callback_data' => "betRecordNextPage@@" . ($page - 1)]
+                ['text' => "👆" . lang("上一页"), 'callback_data' => "betRecordNextPage@@" . ($page - 1)]
             ];
         }
         $allPage = ceil($count / $limit);
         if ($allPage > $page) {
             if ($page > 1) {
-                $keyboard[count($keyboard) - 1][] = ['text' => "👇".lang("下一页"), 'callback_data' => "betRecordNextPage@@" . ($page + 1)];
+                $keyboard[count($keyboard) - 1][] = ['text' => "👇" . lang("下一页"), 'callback_data' => "betRecordNextPage@@" . ($page + 1)];
             } else {
                 $keyboard[] = [
-                    ['text' => "👇".lang("下一页"), 'callback_data' => "betRecordNextPage@@" . ($page + 1)]
+                    ['text' => "👇" . lang("下一页"), 'callback_data' => "betRecordNextPage@@" . ($page + 1)]
                 ];
             }
         }
@@ -609,7 +611,7 @@ class BetService extends BaseService
      * @description: 开奖失败退回投注的
      * @param {*} $issue_no
      * @return {*}
-     */    
+     */
     public static function betFail($issue_no)
     {
         $list = self::findAll(['issue_no' => $issue_no, 'status' => self::model()::STATUS_STAY]);
@@ -627,7 +629,7 @@ class BetService extends BaseService
             $text .= "投注金额:{$v['amount']} \n";
             $text .= "投注的资金已退回您的钱包 \n";
 
-            self::asyncSendMessage($v['member_id'],$text);
+            self::asyncSendMessage($v['member_id'], $text);
             $item = [];
             $iem['status'] = self::model()::STATUS_SETTLED;
             self::model()::where('id', $v['id'])->update($item);
@@ -646,7 +648,7 @@ class BetService extends BaseService
         $list = self::findAll(['issue_no' => $issue_no, 'status' => self::model()::STATUS_STAY]);
 
         // 大小单双的
-        $otherSum = self::model()::where('issue_no',$issue_no)->where('status',self::model()::STATUS_STAY)->whereIn('keywords',['大','小','单','双'])->sum('amount');
+        $otherSum = self::model()::where('issue_no', $issue_no)->where('status', self::model()::STATUS_STAY)->whereIn('keywords', ['大', '小', '单', '双'])->sum('amount');
 
         $fakeOpenData = self::fakeLotteryDraw($issue_no, $awards, 0);
         $keywordsList = $fakeOpenData['keywordsList'];
@@ -669,9 +671,9 @@ class BetService extends BaseService
         $memberList = [];
         $bet_num = 0;
         foreach ($list->toArray() as $k => $v) {
-            if(isset($keywordsList[$v['keywords']])){
+            if (isset($keywordsList[$v['keywords']])) {
                 $keywordsList[$v['keywords']] += $v['amount'];
-            }else{
+            } else {
                 $keywordsList[$v['keywords']] = $v['amount'];
             }
             // $userInfo = UserService::findAll(['member_id' => $v['member_id']]);
@@ -690,17 +692,17 @@ class BetService extends BaseService
                 // $amount = rtrim($amount, '.');   // 如果末尾是 . 就去掉
                 $odds = $v['odds'];
 
-                if(in_array('13操',$awards) || in_array('14操', $awards)){
+                if (in_array('13操', $awards) || in_array('14操', $awards)) {
                     // 13 14特殊处理倍率
-                    if(in_array($v['keywords'],self::$OTHER_BET_1)){
-                        if($sum < 10000){
+                    if (in_array($v['keywords'], self::$OTHER_BET_1)) {
+                        if ($sum < 10000) {
                             $odds = 1.5;
-                        }else{
+                        } else {
                             $odds = 1;
                         }
                     }
 
-                    if(in_array($v['keywords'],self::$OTHER_BET_2)){
+                    if (in_array($v['keywords'], self::$OTHER_BET_2)) {
                         $odds = 1;
                     }
                 }
@@ -864,7 +866,7 @@ class BetService extends BaseService
         // self::bettingGroupNotice($text, $inlineButton, '');
         // SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
 
-        self::lotteryNotice($openList, $issue_no ,$keywordsList);
+        self::lotteryNotice($openList, $issue_no, $keywordsList);
     }
 
     /**
@@ -1042,13 +1044,13 @@ class BetService extends BaseService
         $openList = [];
 
         foreach ($fake_bet_list as $k => $v) {
-            if(in_array($v['keywords'],['大','小','单','双'])){
+            if (in_array($v['keywords'], ['大', '小', '单', '双'])) {
                 $fakeOtherSum += $v['amount'];
             }
 
-            if(isset($keywordsList[$v['keywords']])){
+            if (isset($keywordsList[$v['keywords']])) {
                 $keywordsList[$v['keywords']] += $v['amount'];
-            }else{
+            } else {
                 $keywordsList[$v['keywords']] = $v['amount'];
             }
 
@@ -1110,11 +1112,11 @@ class BetService extends BaseService
 
         }
 
-        return ['sum' => $fakeOtherSum ,'list' => $openList ,'keywordsList' => $keywordsList];
+        return ['sum' => $fakeOtherSum, 'list' => $openList, 'keywordsList' => $keywordsList];
     }
 
     // 开奖通知
-    public static function lotteryNotice($openList, $issue_no,$keywordsList = [])
+    public static function lotteryNotice($openList, $issue_no, $keywordsList = [])
     {
         $betNoticeNum = Config::where('field', 'bet_notice_num')->first()->val;
         $betNoticeNum = explode(',', $betNoticeNum);
@@ -1123,9 +1125,14 @@ class BetService extends BaseService
         $noticeNum = rand($betNoticeMini, $betNoticeMax);
         shuffle($openList);
 
-        $text = $issue_no . "期开奖结果 \n";
-        $text .= "-----本期开奖账单----- \n";
+
+        $text = lang("{issue_no}期开奖结果");
+        $text = str_replace("{issue_no}", $issue_no, $text);
+        $text .= "\n-----" . lang("本期开奖账单") . "----- \n";
         foreach ($openList as $k => $v) {
+            $language = User::where('member_id',$v['member_id'])->first()->language;
+            App::setLocale($language);
+
             $amount = number_format($v['amount'], 2);
             $v['win_amount'] = number_format($v['win_amount'], 2);
             $profit = number_format($v['profit'], 2);
@@ -1138,27 +1145,27 @@ class BetService extends BaseService
             }
 
             if (($k + 1) <= $noticeNum) {
-                $text .= "用户ID:{$v['lastStr']} \n";
-                $text .= "下注类型:[" . implode(',', $v['keywords']) . "] \n";
-                $text .= "中奖类型:[" . $openKeyword . "] \n";
-                $text .= "投注金额:{$amount} \n";
-                $text .= "中奖金额:{$v['win_amount']} \n";
-                $text .= "派彩金额:{$profit} \n";
-                $text .= "盈亏金额:{$yl} \n";
+                $text .= lang("用户ID") . ":{$v['lastStr']} \n";
+                $text .= lang("下注类型") . ":[" . implode(',', $v['keywords']) . "] \n";
+                $text .= lang("中奖类型") . ":[" . $openKeyword . "] \n";
+                $text .= lang("投注金额") . ":{$amount} \n";
+                $text .= lang("中奖金额") . ":{$v['win_amount']} \n";
+                $text .= lang("派彩金额") . ":{$profit} \n";
+                $text .= lang("盈亏金额") . ":{$yl} \n";
                 $text .= "-------------------------------- \n";
             }
 
             if ($v['is_send']) {
                 $text2 = "{$issue_no}期开奖结果 \n";
-                $text2 .= "下注类型:[" . implode(',', $v['keywords']) . "] \n";
-                $text2 .= "中奖类型:[" . $openKeyword . "] \n";
-                $text2 .= "投注金额:{$amount} \n";
-                $text2 .= "中奖金额:{$v['win_amount']} \n";
-                $text2 .= "派彩金额:{$profit} \n";
-                $text2 .= "盈亏金额:{$yl} \n";
+                $text2 .= lang('下注类型') . ":[" . implode(',', $v['keywords']) . "] \n";
+                $text2 .= lang('中奖类型') . ":[" . $openKeyword . "] \n";
+                $text2 .= lang('投注金额') . ":{$amount} \n";
+                $text2 .= lang('中奖金额') . ":{$v['win_amount']} \n";
+                $text2 .= lang('派彩金额') . ":{$profit} \n";
+                $text2 .= lang("盈亏金额") . ":{$yl} \n";
                 $keyboard = [];
                 $keyboard[] = [
-                    ['text' => "开奖历史", 'callback_data' => "showLotteryHistory@@" . $issue_no]
+                    ['text' => lang("开奖历史"), 'callback_data' => "showLotteryHistory@@" . $issue_no]
                 ];
                 // self::sendMessage($v['member_id'],$text2,$keyboard);
                 SendTelegramMessageJob::dispatch($v['member_id'], $text2, $keyboard);
@@ -1171,7 +1178,7 @@ class BetService extends BaseService
 
         // 群通知
         // self::bettingGroupNotice($text, $inlineButton, '');
-        
+
 
         SendTelegramGroupMessageJob::dispatch($text, $inlineButton, '');
 
@@ -1182,37 +1189,37 @@ class BetService extends BaseService
      * @description: 统计投注情况通知
      * @param {*} $issue_no
      * @return {*}
-     */    
+     */
     public static function statNotice($issue_no)
     {
         $keywordsList = [];
         // 虚拟投注情况
         $fake_bet_list = Cache::get('fake_bet_' . $issue_no, []);
-        foreach($fake_bet_list as $k => $v){
-            if(isset($keywordsList[$v['keywords']])){
+        foreach ($fake_bet_list as $k => $v) {
+            if (isset($keywordsList[$v['keywords']])) {
                 $keywordsList[$v['keywords']] += $v['amount'];
-            }else{
+            } else {
                 $keywordsList[$v['keywords']] = $v['amount'];
             }
         }
 
         // 真实投注
         $list = self::findAll(['issue_no' => $issue_no, 'status' => self::model()::STATUS_STAY]);
-        foreach($list->toArray() as $k => $v){
-            if(isset($keywordsList[$v['keywords']])){
+        foreach ($list->toArray() as $k => $v) {
+            if (isset($keywordsList[$v['keywords']])) {
                 $keywordsList[$v['keywords']] += $v['amount'];
-            }else{
+            } else {
                 $keywordsList[$v['keywords']] = $v['amount'];
             }
         }
 
-        $text3 = "📝 {$issue_no}期投注统计 \n";
-
-        if($keywordsList){
+        $text3 = "📝 " . lang("{issue_no}期投注统计") . " \n";
+        $text3 = str_replace("{issue_no}", $issue_no, $text3);
+        if ($keywordsList) {
             ksort($keywordsList);
-            foreach($keywordsList as $k => $v){
-                $text3 .= "玩法:{$k} \n";
-                $text3 .= "总注:{$v} \n";
+            foreach ($keywordsList as $k => $v) {
+                $text3 .= lang("玩法") . ":{$k} \n";
+                $text3 .= lang("总注") . ":{$v} \n";
                 $text3 .= "-------------- \n";
             }
         }
@@ -1224,7 +1231,7 @@ class BetService extends BaseService
     public static function todayExchangeRate($chatId)
     {
         $exchangeRate = Config::where('field', 'exchange_rate_rmb')->first()->val;
-        $text = lang("今日汇率").":1USDT = {$exchangeRate} RMB \n";
+        $text = lang("今日汇率") . ":1USDT = {$exchangeRate} RMB \n";
         // $botMsg = [
         //     'chat_id' => "@{$chatId}",
         //     'text' => $text

+ 24 - 12
lang/en/messages.php

@@ -232,22 +232,34 @@ return [
     '📋 复制地址' => '📋 Copy Address',
     '✅ 我已付款' => '✅ I have paid',
     "💰钱包余额" => "💰 Wallet Balance",
-    "历史注单"=>"Historical Notes",
-    "中奖总派彩"=>"Winning total payout",
-    "待开奖"=>"Pending draw",
-    "全部"=>"all",
-    "盈利"=>"profit",
-    "亏损"=>"loss",
-    "期数"=>"issue number",
-    "内容"=>"Content",
-    "金额"=>"amount",
-    "盈亏"=>"profit and loss",
-    "流水历史"=>"Flowing History",
+    "历史注单" => "Historical Notes",
+    "中奖总派彩" => "Winning total payout",
+    "待开奖" => "Pending draw",
+    "全部" => "all",
+    "盈利" => "profit",
+    "亏损" => "loss",
+    "期数" => "issue number",
+    "内容" => "Content",
+    "金额" => "amount",
+    "盈亏" => "profit and loss",
+    "流水历史" => "Flowing History",
     "上一页" => "Previous page",
     "下一页" => "Next page",
     "流水" => "Punning water",
     "返水" => "Return water",
     "暂无开奖记录" => "No lottery records available at the moment",
-    "今日汇率" => "Today's Exchange Rate"
+    "今日汇率" => "Today's Exchange Rate",
+    "玩法" => "Gameplay",
+    "总注" => "Total Bet",
+    "{issue_no}期投注统计" => "Betting Statistics by {issue_no}",
+    "{issue_no}期开奖结果" => "Result for {issue_no}",
+    "本期开奖账单" => "This Round's Bill",
+    "下注类型" => "Bet Type",
+    "中奖类型" => "Winning Type",
+    "投注金额" => "Bet Amount",
+    "中奖金额" => "Winning Amount",
+    "派彩金额" => "Prize Amount",
+    "盈亏金额" => "Profit and Loss Amount"
+
 
 ];

+ 23 - 12
lang/vi/messages.php

@@ -232,22 +232,33 @@ return [
     '📋 复制地址' => '📋 Sao chép địa chỉ',
     '✅ 我已付款' => '✅ Tôi đã thanh toán',
     "💰钱包余额" => "💰 Số dư ví",
-    "历史注单"=>"Ghi chú lịch sử",
-    "中奖总派彩"=>"Tổng số tiền thắng",
-    "待开奖"=>"Chờ giải thưởng",
-    "全部"=>"tất cả",
-    "盈利"=>"Lợi nhuận",
-    "亏损"=>"lỗ",
-    "期数"=>"số kỳ",
-    "内容"=>"nội dung",
-    "金额"=>"số tiền",
-    "盈亏"=>"Lợi nhuận và lỗ",
-    "流水历史"=>"Lịch sử nước chảy",
+    "历史注单" => "Ghi chú lịch sử",
+    "中奖总派彩" => "Tổng số tiền thắng",
+    "待开奖" => "Chờ giải thưởng",
+    "全部" => "tất cả",
+    "盈利" => "Lợi nhuận",
+    "亏损" => "lỗ",
+    "期数" => "số kỳ",
+    "内容" => "nội dung",
+    "金额" => "số tiền",
+    "盈亏" => "Lợi nhuận và lỗ",
+    "流水历史" => "Lịch sử nước chảy",
     "上一页" => "Trang trước",
     "下一页" => "Trang sau",
     "流水" => "Nước chảy",
     "返水" => "Trở lại nước",
     "暂无开奖记录" => "Không có kỷ lục mở thưởng",
-    "今日汇率" => "Tỷ giá hôm nay"
+    "今日汇率" => "Tỷ giá hôm nay",
+    "玩法" => "Cách chơi",
+    "总注" => "Tổng cược",
+    "{issue_no}期投注统计" => "Thống kê đặt cược cho kỳ {issue_no}",
+    "{issue_no}期开奖结果" => "Kết quả cho {issue_no}",
+    "本期开奖账单" => "Hóa đơn vòng này",
+    "下注类型" => "Loại cược",
+    "中奖类型" => "Loại thắng",
+    "投注金额" => "Số tiền cược",
+    "中奖金额" => "Số tiền thắng",
+    "派彩金额" => "Số tiền thưởng",
+    "盈亏金额" => "Số tiền lãi lỗ"
 
 ];

+ 25 - 14
lang/zh/messages.php

@@ -230,25 +230,36 @@ return [
     "- 对上述地址充值后, 请点击我已付款!" => "- 对上述地址充值后, 请点击我已付款!",
     "- 请耐心等待, 充值成功后 Bot 会通知您!" => "- 请耐心等待, 充值成功后 Bot 会通知您!",
     '📋 复制地址' => '📋 复制地址',
-    '✅ 我已付款'=>'✅ 我已付款',
-    "💰钱包余额"=>"💰钱包余额",
-    "历史注单"=>"历史注单",
-    "中奖总派彩"=>"中奖总派彩",
-    "待开奖"=>"待开奖",
-    "全部"=>"全部",
-    "盈利"=>"盈利",
-    "亏损"=>"亏损",
-    "期数"=>"期数",
-    "内容"=>"内容",
-    "金额"=>"金额",
-    "盈亏"=>"盈亏",
-    "流水历史"=>"流水历史",
+    '✅ 我已付款' => '✅ 我已付款',
+    "💰钱包余额" => "💰钱包余额",
+    "历史注单" => "历史注单",
+    "中奖总派彩" => "中奖总派彩",
+    "待开奖" => "待开奖",
+    "全部" => "全部",
+    "盈利" => "盈利",
+    "亏损" => "亏损",
+    "期数" => "期数",
+    "内容" => "内容",
+    "金额" => "金额",
+    "盈亏" => "盈亏",
+    "流水历史" => "流水历史",
     "上一页" => "上一页",
     "下一页" => "下一页",
     "流水" => "流水",
     "返水" => "返水",
     "暂无开奖记录" => "暂无开奖记录",
-    "今日汇率"=>"今日汇率",
+    "今日汇率" => "今日汇率",
+    "玩法" => "玩法",
+    "总注" => "总注",
+    "{issue_no}期投注统计" => "{issue_no}期投注统计",
+    "{issue_no}期开奖结果" => "{issue_no}期开奖结果",
+    "本期开奖账单" => "本期开奖账单",
+    "下注类型" => "下注类型",
+    "中奖类型" => "中奖类型",
+    "投注金额" => "投注金额",
+    "中奖金额" => "中奖金额",
+    "派彩金额" => "派彩金额",
+    "盈亏金额" => "盈亏金额",