Ken 1 giorno fa
parent
commit
b45ffaae88
1 ha cambiato i file con 0 aggiunte e 162 eliminazioni
  1. 0 162
      app/Services/BetService.php

+ 0 - 162
app/Services/BetService.php

@@ -859,168 +859,6 @@ class BetService extends BaseService
         self::lotteryNotice($openList, $issue_no, $keywordsList);
     }
 
-    /**
-     * @description: 中奖结算
-     * @param {*} $issue_no
-     * @param {*} $awards
-     * @return {*}
-     */
-    public static function betSettled2($issue_no, $awards)
-    {
-        $list = self::findAll(['issue_no' => $issue_no, 'status' => self::model()::STATUS_STAY]);
-
-        $data = [];
-        $text = $issue_no . "期开奖结果 \n";
-        $text .= "-----本期开奖账单----- \n";
-        // $text .=" 中奖类型 用户 投注金额 中奖金额 盈亏 \n";
-        $text .= "\n";
-        $betNoticeNum = Config::where('field', 'bet_notice_num')->first()->val;
-        $betNoticeNum = explode(',', $betNoticeNum);
-        $betNoticeMini = $betNoticeNum[0] ?? 26;
-        $betNoticeMax = $betNoticeNum[1] ?? 38;
-        $noticeNum = rand($betNoticeMini, $betNoticeMax);
-
-        $realNoticeNum = ceil($noticeNum / 2);
-        $openList = [];
-        $bet_num = 0;
-        foreach ($list->toArray() as $k => $v) {
-            // $userInfo = UserService::findAll(['member_id' => $v['member_id']]);
-            // $lastStr = self::getLastChar($userInfo->first_name, 1);
-            $lastStr = self::hideMiddleDigits($v['member_id'], 4);
-            $item = [];
-            $item['id'] = $v['id'];
-            $item['status'] = self::model()::STATUS_SETTLED;
-
-
-            if (in_array($v['keywords'], $awards)) {
-                // $profit = $v['amount'] * $v['odds'];
-                $amount = $v['amount'];
-                // $amount = rtrim($amount, '0');   // 去掉右侧的 0
-                // $amount = rtrim($amount, '.');   // 如果末尾是 . 就去掉
-                $odds = $v['odds'];
-                $profit = bcmul($amount, $odds, 2); // 保留两位小数
-                if ($profit > 880000) {
-                    $profit = 880000; // 单注最高奖金880000
-                }
-                $item['profit'] = $profit;
-
-                // $yl = $profit - $amount;
-                $yl = bcsub($profit, $amount, 2); // 盈利
-                // if ($k + 1 <= $realNoticeNum) {
-
-                //     // $text .= "会员下注 【" . $lastStr . "】{$v['amount']} {$profit} {$yl}\n";
-                //     $bet_num++;
-                // }
-                // 结算
-                // WalletService::updateBalance($v['member_id'], $profit);
-
-                // $walletInfo = WalletService::findOne(['member_id' => $v['member_id']]);
-                // $balance = $walletInfo['available_balance'];
-
-                // BalanceLogService::addLog($v['member_id'], $profit, $balance, ($balance + $profit), '中奖', $v['id'], '');
-
-                if (isset($openList[$v['member_id']])) {
-                    $openList[$v['member_id']]['member_id'] = $v['member_id'];
-                    $openList[$v['member_id']]['amount'] += $v['amount'];
-                    $openList[$v['member_id']]['profit'] += $profit;
-                    $openList[$v['member_id']]['lastStr'] = $lastStr;
-                    $openList[$v['member_id']]['openKeywords'][] = $v['keywords'];
-                    $openList[$v['member_id']]['keywords'][] = $v['keywords'];
-                    $openList[$v['member_id']]['win_amount'] += $v['amount'];
-
-                } else {
-                    $openList[$v['member_id']]['member_id'] = $v['member_id'];
-                    $openList[$v['member_id']]['amount'] = $v['amount'];
-                    $openList[$v['member_id']]['profit'] = $profit;
-                    $openList[$v['member_id']]['lastStr'] = $lastStr;
-                    $openList[$v['member_id']]['openKeywords'] = [];
-                    $openList[$v['member_id']]['keywords'] = [];
-                    $openList[$v['member_id']]['openKeywords'][] = $v['keywords'];
-                    $openList[$v['member_id']]['keywords'][] = $v['keywords'];
-                    $openList[$v['member_id']]['win_amount'] = $v['amount'];
-                    $openList[$v['member_id']]['is_send'] = true;
-
-                }
-            } else {
-
-                if (isset($openList[$v['member_id']])) {
-                    $openList[$v['member_id']]['member_id'] = $v['member_id'];
-                    $openList[$v['member_id']]['amount'] += $v['amount'];
-                    $openList[$v['member_id']]['lastStr'] = $lastStr;
-                    $openList[$v['member_id']]['keywords'][] = $v['keywords'];
-                } else {
-                    $openList[$v['member_id']]['member_id'] = $v['member_id'];
-                    $openList[$v['member_id']]['amount'] = $v['amount'];
-                    $openList[$v['member_id']]['profit'] = 0;
-                    $openList[$v['member_id']]['lastStr'] = $lastStr;
-                    $openList[$v['member_id']]['openKeywords'] = [];
-                    $openList[$v['member_id']]['keywords'] = [];
-                    $openList[$v['member_id']]['keywords'][] = $v['keywords'];
-                    $openList[$v['member_id']]['win_amount'] = 0;
-                    $openList[$v['member_id']]['is_send'] = true;
-                }
-
-
-                // if ($k + 1 <= $realNoticeNum) {
-                //     // $text .= "会员下注 【" . $lastStr . "】{$v['amount']} {$v['profit']} -{$v['amount']}\n";
-                //     $bet_num++;
-                // }
-            }
-
-            // self::model()::where('id', $v['id'])->update($item);
-        }
-
-        // foreach($openList as $k => $v){
-        //     $amount = $v['amount'];
-        //     // if($v['profit'] >= 0){
-        //         $profit = number_format($v['profit'],2);
-        //         $yl = bcsub($v['profit'], $v['amount'], 2); // 盈利
-        //         // $text .= "会员下注 【" . $v['lastStr'] . "】 {$amount} {$profit} {$yl}\n";
-        //         if(++$bet_num <= $realNoticeNum){
-        //             $text .= "用户ID:{$v['lastStr']} \n";
-        //             $text .= "下注类型:[".implode(',', $v['keywords'])."] \n";
-        //             $text .= "中奖类型:[".implode(',', $v['openKeywords'])."] \n";
-        //             $text .= "投注金额:{$amount} \n";
-        //             $text .= "中奖金额:{$v['win_amount']} \n";
-        //             $text .= "派彩金额:{$profit} \n";
-        //             $text .= "盈亏金额:{$yl} \n";
-        //             $text .= "-------------------------------- \n";
-        //         }
-
-
-        //         $text2 = "{$issue_no}期开奖结果 \n";
-        //         $text2 .= "下注类型:[".implode(',', $v['keywords'])."] \n";
-        //         $text2 .= "中奖类型:[".implode(',', $v['openKeywords'])."] \n";
-        //         $text2 .= "投注金额:{$amount} \n";
-        //         $text2 .= "中奖金额:{$v['win_amount']} \n";
-        //         $text2 .= "派彩金额:{$profit} \n";
-        //         $text2 .= "盈亏金额:{$yl} \n";
-        //         $keyboard = [];
-        //         $keyboard[] = [
-        //             ['text' => "开奖历史", 'callback_data' => "showLotteryHistory@@" . $issue_no]
-        //         ];
-        //         // SendTelegramMessageJob::dispatch($v['member_id'],$text2);
-        //         self::sendMessage($v['member_id'],$text2,$keyboard);
-        //     // }else{
-        //     //     $text .= "会员下注 【" . $v['lastStr'] . "】 {$amount} 0 -{$amount}\n";
-        //     // }
-
-
-        // }
-
-        $inlineButton = self::getOperateButton();
-
-        $rand_num = $noticeNum - $bet_num;
-        $fakeOpenData = self::fakeLotteryDraw($issue_no, $awards, $rand_num);
-        $openList = array_merge($openList, $fakeOpenData['list']);
-
-        // 群通知
-        // self::bettingGroupNotice($text, $inlineButton, '');
-        // SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
-        self::lotteryNotice($openList, $issue_no);
-    }
-
-
     // 虚拟开奖
     public static function fakeLotteryDraw($issue_no, $awards, $rand_num = 30)
     {