Ken 2 周之前
父节点
当前提交
863fcac698
共有 1 个文件被更改,包括 32 次插入31 次删除
  1. 32 31
      app/Services/BetService.php

+ 32 - 31
app/Services/BetService.php

@@ -156,11 +156,12 @@ class BetService extends BaseService
 
     /**
      * @description: 投注操作
-     * @param {string} $memberId
-     * @param {string} $input
-     * @return {*}
+     * @param string $memberId
+     * @param string $input
+     * @param int $messageId
+     * @return array
      */
-    public static function bet(string $memberId, string $input, $messageId = 0)
+    public static function bet(string $memberId, string $input, $messageId = 0): array
     {
         $msg = [];
         $msg['chat_id'] = $memberId;
@@ -174,8 +175,8 @@ class BetService extends BaseService
 
         $serviceAccount = Config::where('field', 'service_customer')->first()->val;
         if ($betResult == null) {
-            $text = lang("消息格式错误!")."\n";
-            $text .= lang("任何疑问都可以联系唯一客服").":@{$serviceAccount}";
+            $text = lang("消息格式错误!") . "\n";
+            $text .= lang("任何疑问都可以联系唯一客服") . ":@{$serviceAccount}";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -188,8 +189,8 @@ class BetService extends BaseService
 
         $gameplayRuleInfo = GameplayRuleService::getGameplayRules($keywords);
         if ($gameplayRuleInfo == null) {
-            $text = lang("玩法未配置!")."\n";
-            $text .= lang("任何疑问都可以联系唯一财务").":@{$serviceAccount}";
+            $text = lang("玩法未配置!") . "\n";
+            $text .= lang("任何疑问都可以联系唯一财务") . ":@{$serviceAccount}";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -198,8 +199,8 @@ class BetService extends BaseService
         }
 
         if ($gameplayRuleInfo['odds'] <= 0) {
-            $text = lang("赔率为0 庄家通吃 禁止投注!")."\n";
-            $text .= lang("任何疑问都可以联系唯一财务").":@{$serviceAccount}";
+            $text = lang("赔率为0 庄家通吃 禁止投注!") . "\n";
+            $text .= lang("任何疑问都可以联系唯一财务") . ":@{$serviceAccount}";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -213,7 +214,7 @@ class BetService extends BaseService
         if (empty($issueInfo)) {
             $issueCloseInfo = IssueService::model()::where('status', IssueService::model()::STATUS_CLOSE)->orderBy('id', 'desc')->first();
             if (empty($issueCloseInfo)) {
-                $text = lang("暂无可下注期数,本次下注无效!")."\n";
+                $text = lang("暂无可下注期数,本次下注无效!") . "\n";
 
                 $msg['text'] = $text;
                 if ($messageId) {
@@ -221,7 +222,7 @@ class BetService extends BaseService
                 }
                 return $msg;
             } else {
-                $text = lang("封盘中,本次下注无效!")."\n";
+                $text = lang("封盘中,本次下注无效!") . "\n";
 
                 $msg['text'] = $text;
                 if ($messageId) {
@@ -233,8 +234,8 @@ class BetService extends BaseService
 
 
         if (!is_numeric($amount) || $amount <= 0) {
-            $text = lang("投注金额格式不正确!")."\n";
-            $text .= lang("任何疑问都可以联系唯一财务").":@{$serviceAccount}";
+            $text = lang("投注金额格式不正确!") . "\n";
+            $text .= lang("任何疑问都可以联系唯一财务") . ":@{$serviceAccount}";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -244,7 +245,7 @@ class BetService extends BaseService
 
         $now_date = date('Y-m-d H:i:s', time() + 30); // 提前30秒
         if ($issueInfo['end_time'] < $now_date) {
-            $text = lang("封盘中,本次下注无效!")."\n";
+            $text = lang("封盘中,本次下注无效!") . "\n";
 
             $msg['text'] = $text;
             if ($messageId) {
@@ -255,7 +256,7 @@ class BetService extends BaseService
 
         // 投注限制校验
         if ($amount < $gameplayRuleInfo['mininum']) {
-            $text = lang("下注失败,最小金额限制")."{$gameplayRuleInfo['mininum']}\n";
+            $text = lang("下注失败,最小金额限制") . "{$gameplayRuleInfo['mininum']}\n";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -265,7 +266,7 @@ class BetService extends BaseService
 
         // 投注限制校验
         if ($amount > $gameplayRuleInfo['maxinum']) {
-            $text = lang("下注失败,最大金额限制")."{$gameplayRuleInfo['maxinum']}\n";
+            $text = lang("下注失败,最大金额限制") . "{$gameplayRuleInfo['maxinum']}\n";
             $msg['text'] = $text;
             if ($messageId) {
                 $msg['reply_to_message_id'] = $messageId;
@@ -344,21 +345,21 @@ class BetService extends BaseService
 
         // }
 
-        $text = lang('下注期数').":{$issueInfo->issue_no}\n";
-        $text .= lang("下注内容")."\n";
+        $text = lang('下注期数') . ":{$issueInfo->issue_no}\n";
+        $text .= lang("下注内容") . "\n";
         $text .= "--------\n";
         $text .= "{$input}\n";
         $text .= "--------\n";
-        $text .= lang("下注成功")."\n";
+        $text .= lang("下注成功") . "\n";
         $msg['text'] = $text;
 
         // $lastStr = self::getLastChar($userInfo->first_name, 1);
         $lastStr = self::hideMiddleDigits($userInfo->member_id, 4);
 
 
-        $groupText = lang("会员下注")." 【" . $lastStr . "】 \n";
-        $groupText .= lang('下注期数').":{$issueInfo->issue_no} \n";
-        $groupText .= lang("下注内容").": \n";
+        $groupText = lang("会员下注") . " 【" . $lastStr . "】 \n";
+        $groupText .= lang('下注期数') . ":{$issueInfo->issue_no} \n";
+        $groupText .= lang("下注内容") . ": \n";
         $groupText .= "----------- \n";
         $groupText .= "{$input} \n";
         $groupText .= "----------- \n";
@@ -479,22 +480,22 @@ class BetService extends BaseService
         }
 
         if ($issue_no) {
-            $text = lang("期数")." {$issue_no} \n";
+            $text = lang("期数") . " {$issue_no} \n";
             // $text .= "\n";
             // $text .= "----------\n";
             $list = self::findAll(['member_id' => $memberId, 'issue_no' => $issue_no]);
             $list = $list->toArray();
             if (empty($list)) {
-                $text .= lang("本期暂未下注")."! \n";
+                $text .= lang("本期暂未下注") . "! \n";
             } else {
                 $keywords = implode(',', array_column($list, 'keywords'));
                 $amounts = implode(',', array_column($list, 'amount'));
 
 
-                $text .= lang("下注类型").":[" . $keywords . "] \n";
-                $text .= lang("下注金额").":" . $amounts . " \n";
-                $text .= lang("下注总额").":" . array_sum(array_column($list, 'amount')) . " \n";
-                $text .= lang("开奖状态").":".lang("等待开奖")." \n";
+                $text .= lang("下注类型") . ":[" . $keywords . "] \n";
+                $text .= lang("下注金额") . ":" . $amounts . " \n";
+                $text .= lang("下注总额") . ":" . array_sum(array_column($list, 'amount')) . " \n";
+                $text .= lang("开奖状态") . ":" . lang("等待开奖") . " \n";
             }
             // foreach ($list->toArray() as $k => $v) {
             //     $text .= "{$v['keywords']}{$v['amount']} \n";
@@ -504,7 +505,7 @@ class BetService extends BaseService
             // $text .= "----------\n";
             $msg['text'] = $text;
         } else {
-            $msg['text'] = lang("当前没有开放的投注期数")."! \n";
+            $msg['text'] = lang("当前没有开放的投注期数") . "! \n";
         }
 
         return $msg;
@@ -1130,7 +1131,7 @@ class BetService extends BaseService
         $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;
+            $language = User::where('member_id', $v['member_id'])->first()->language;
             App::setLocale($language);
 
             $amount = number_format($v['amount'], 2);