|
|
@@ -377,52 +377,55 @@ class BetService extends BaseService
|
|
|
|
|
|
$gameplayRuleList = GameplayRuleService::model()::where('odds', '>', 0)->get();
|
|
|
$gameplayRuleList = $gameplayRuleList->toArray();
|
|
|
- $randKey = array_rand($gameplayRuleList, 1);
|
|
|
- $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? [];
|
|
|
- if ($gameplayRuleInfo) {
|
|
|
- if(in_array($gameplayRuleInfo['keywords'], $noRule)){
|
|
|
- return;
|
|
|
|
|
|
+ $betTimes = rand(1,4); // 每次下注次数
|
|
|
+ for ($i = 0; $i < $betTimes; $i++) {
|
|
|
+ $randKey = array_rand($gameplayRuleList, 1);
|
|
|
+ $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? [];
|
|
|
+ if ($gameplayRuleInfo) {
|
|
|
+ if(in_array($gameplayRuleInfo['keywords'], $noRule)){
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+ if($gameplayRuleInfo['maxinum'] < $betMax){
|
|
|
+ $betMax = $gameplayRuleInfo['maxinum'];
|
|
|
+ }
|
|
|
+ if($gameplayRuleInfo['mininum'] > $betMini){
|
|
|
+ $betMini = $gameplayRuleInfo['mininum'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $amount = rand($betMini, $betMax);
|
|
|
+ $amount = floor($amount / 10) * 10;
|
|
|
+ $input = $gameplayRuleInfo['keywords'] . $amount;
|
|
|
+ // $amount = number_format($amount,2);
|
|
|
+ $item = [];
|
|
|
+ $item['keywords'] = $gameplayRuleInfo['keywords'];
|
|
|
+ $item['odds'] = $gameplayRuleInfo['odds'];
|
|
|
+ $item['amount'] = $amount;
|
|
|
+ $item['first_name'] = self::generateRandomString(6);
|
|
|
+ $item['member_id'] = self::generateRandomNumber(10);
|
|
|
+ $item['profit'] = 0;
|
|
|
+ // $input = $item['keywords'] . $item['amount'];
|
|
|
+
|
|
|
+ $fake_bet_list[] = $item;
|
|
|
+
|
|
|
+ $lastStr = self::hideMiddleDigits($item['member_id'], 4);
|
|
|
+
|
|
|
+ $groupText = "";
|
|
|
+ $groupText .= "会员下注 【" . $lastStr . "】 \n";
|
|
|
+ $groupText .= "下注期数:{$issueInfo->issue_no} \n";
|
|
|
+ $groupText .= "下注内容: \n";
|
|
|
+ $groupText .= "----------- \n";
|
|
|
+ $groupText .= "{$input} \n";
|
|
|
+ $groupText .= "----------- \n";
|
|
|
+
|
|
|
+
|
|
|
+ $inlineButton = self::getOperateButton();
|
|
|
+
|
|
|
+ // 群通知
|
|
|
+ self::bettingGroupNotice($groupText, $inlineButton); // 群通知
|
|
|
}
|
|
|
- if($gameplayRuleInfo['maxinum'] < $betMax){
|
|
|
- $betMax = $gameplayRuleInfo['maxinum'];
|
|
|
- }
|
|
|
- if($gameplayRuleInfo['mininum'] > $betMini){
|
|
|
- $betMini = $gameplayRuleInfo['mininum'];
|
|
|
- }
|
|
|
-
|
|
|
- $amount = rand($betMini, $betMax);
|
|
|
- $amount = floor($amount / 10) * 10;
|
|
|
- $input = $gameplayRuleInfo['keywords'] . $amount;
|
|
|
- // $amount = number_format($amount,2);
|
|
|
- $item = [];
|
|
|
- $item['keywords'] = $gameplayRuleInfo['keywords'];
|
|
|
- $item['odds'] = $gameplayRuleInfo['odds'];
|
|
|
- $item['amount'] = $amount;
|
|
|
- $item['first_name'] = self::generateRandomString(6);
|
|
|
- $item['member_id'] = self::generateRandomNumber(10);
|
|
|
- $item['profit'] = 0;
|
|
|
- // $input = $item['keywords'] . $item['amount'];
|
|
|
-
|
|
|
- $fake_bet_list[] = $item;
|
|
|
-
|
|
|
- $lastStr = self::hideMiddleDigits($item['member_id'], 4);
|
|
|
-
|
|
|
- $groupText = "";
|
|
|
- $groupText .= "会员下注 【" . $lastStr . "】 \n";
|
|
|
- $groupText .= "下注期数:{$issueInfo->issue_no} \n";
|
|
|
- $groupText .= "下注内容: \n";
|
|
|
- $groupText .= "----------- \n";
|
|
|
- $groupText .= "{$input} \n";
|
|
|
- $groupText .= "----------- \n";
|
|
|
-
|
|
|
-
|
|
|
- $inlineButton = self::getOperateButton();
|
|
|
-
|
|
|
- // 群通知
|
|
|
- self::bettingGroupNotice($groupText, $inlineButton); // 群通知
|
|
|
}
|
|
|
-
|
|
|
Cache::put('fake_bet_' . $issueInfo->issue_no, $fake_bet_list, 500);
|
|
|
}
|
|
|
|
|
|
@@ -668,6 +671,7 @@ class BetService extends BaseService
|
|
|
$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 {
|
|
|
@@ -686,6 +690,7 @@ class BetService extends BaseService
|
|
|
$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) {
|
|
|
@@ -705,67 +710,62 @@ class BetService extends BaseService
|
|
|
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){
|
|
|
- if(empty($v['openKeywords'])){
|
|
|
- $openKeyword = '-';
|
|
|
- }else{
|
|
|
- $openKeyword = implode(',', $v['openKeywords']);
|
|
|
- }
|
|
|
- $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 .= "-------------------------------- \n";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $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";
|
|
|
-
|
|
|
- $keyboard = [];
|
|
|
- $keyboard[] = [
|
|
|
- ['text' => "开奖历史", 'callback_data' => "showLotteryHistory@@" . $issue_no]
|
|
|
- ];
|
|
|
- SendTelegramMessageJob::dispatch($v['member_id'],$text2,$keyboard);
|
|
|
- // self::sendMessage($v['member_id'],$text2);
|
|
|
- // }else{
|
|
|
- // $text .= "会员下注 【" . $v['lastStr'] . "】 {$amount} 0 -{$amount}\n";
|
|
|
- // }
|
|
|
+ // 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){
|
|
|
+ // if(empty($v['openKeywords'])){
|
|
|
+ // $openKeyword = '-';
|
|
|
+ // }else{
|
|
|
+ // $openKeyword = implode(',', $v['openKeywords']);
|
|
|
+ // }
|
|
|
+ // $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 .= "-------------------------------- \n";
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+ // $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";
|
|
|
+
|
|
|
+ // $keyboard = [];
|
|
|
+ // $keyboard[] = [
|
|
|
+ // ['text' => "开奖历史", 'callback_data' => "showLotteryHistory@@" . $issue_no]
|
|
|
+ // ];
|
|
|
+ // SendTelegramMessageJob::dispatch($v['member_id'],$text2,$keyboard);
|
|
|
+ // // self::sendMessage($v['member_id'],$text2);
|
|
|
+ // // }else{
|
|
|
+ // // $text .= "会员下注 【" . $v['lastStr'] . "】 {$amount} 0 -{$amount}\n";
|
|
|
+ // // }
|
|
|
|
|
|
- }
|
|
|
+ // }
|
|
|
|
|
|
$inlineButton = self::getOperateButton();
|
|
|
|
|
|
$rand_num = $noticeNum - $bet_num;
|
|
|
- $text .= self::fakeLotteryDraw($issue_no, $awards, $rand_num);
|
|
|
- // for ($i = 0; $i < $rand_num; $i++) {
|
|
|
- // // 生成 -100000 到 100000 的随机数,但排除 -10 到 10 的范围
|
|
|
- // $randomNumber = random_int(-1000000, 1000000) / 100;
|
|
|
- // if ($randomNumber >= -10 && $randomNumber <= 10) {
|
|
|
- // // 如果落在 -10 到 10 之间,重新生成或调整
|
|
|
- // $randomNumber = $randomNumber < 0 ? -random_int(10, 100000) : random_int(10, 100000);
|
|
|
- // }
|
|
|
- // $text .= "私聊下注 【******】 {$randomNumber}\n";
|
|
|
- // }
|
|
|
+ $fakeOpenList = self::fakeLotteryDraw($issue_no, $awards, $rand_num);
|
|
|
|
|
|
+ $openList = array_merge($openList, $fakeOpenList);
|
|
|
+
|
|
|
// 群通知
|
|
|
// self::bettingGroupNotice($text, $inlineButton, '');
|
|
|
- SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
|
|
|
+ // SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
|
|
|
+
|
|
|
+ self::lotteryNotice($openList,$issue_no);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -847,6 +847,7 @@ class BetService extends BaseService
|
|
|
$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 {
|
|
|
@@ -865,6 +866,7 @@ class BetService extends BaseService
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -877,61 +879,54 @@ class BetService extends BaseService
|
|
|
// 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";
|
|
|
- // }
|
|
|
+ // 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;
|
|
|
- $text .= self::fakeLotteryDraw($issue_no, $awards, $rand_num);
|
|
|
- // for ($i = 0; $i < $rand_num; $i++) {
|
|
|
- // // 生成 -100000 到 100000 的随机数,但排除 -10 到 10 的范围
|
|
|
- // $randomNumber = random_int(-1000000, 1000000) / 100;
|
|
|
- // if ($randomNumber >= -10 && $randomNumber <= 10) {
|
|
|
- // // 如果落在 -10 到 10 之间,重新生成或调整
|
|
|
- // $randomNumber = $randomNumber < 0 ? -random_int(10, 100000) : random_int(10, 100000);
|
|
|
- // }
|
|
|
- // $text .= "私聊下注 【******】 {$randomNumber}\n";
|
|
|
- // }
|
|
|
+ $fakeOpenList = self::fakeLotteryDraw($issue_no, $awards, $rand_num);
|
|
|
+ $openList = array_merge($openList, $fakeOpenList);
|
|
|
|
|
|
// 群通知
|
|
|
// self::bettingGroupNotice($text, $inlineButton, '');
|
|
|
- SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
|
|
|
+ // SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
|
|
|
+ self::lotteryNotice($openList,$issue_no);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -942,13 +937,14 @@ class BetService extends BaseService
|
|
|
$fake_bet_list = Cache::get('fake_bet_' . $issue_no, []);
|
|
|
$text = "";
|
|
|
|
|
|
+ $openList = [];
|
|
|
+
|
|
|
foreach ($fake_bet_list as $k => $v) {
|
|
|
// $lastStr = self::getLastChar($v['first_name'], 1);
|
|
|
$lastStr = self::hideMiddleDigits($v['member_id'], 4);
|
|
|
if (in_array($v['keywords'], $awards)) {
|
|
|
$amount = $v['amount'];
|
|
|
- // $amount = rtrim($amount, '0'); // 去掉右侧的 0
|
|
|
- // $amount = rtrim($amount, '.'); // 如果末尾是 . 就去掉
|
|
|
+
|
|
|
$odds = $v['odds'];
|
|
|
$profit = bcmul($amount, $odds, 2); // 保留两位小数
|
|
|
if ($profit > 880000) {
|
|
|
@@ -957,48 +953,109 @@ class BetService extends BaseService
|
|
|
$item['profit'] = $profit;
|
|
|
$v['amount'] = number_format($amount,2);
|
|
|
|
|
|
- // $yl = $profit - $amount;
|
|
|
- $yl = bcsub($profit, $amount, 2); // 盈利
|
|
|
- // if ($k + 1 <= $rand_num) {
|
|
|
- // $text .= "会员下注 【" . $lastStr . "】 {$v['amount']} {$profit} {$yl}\n";
|
|
|
- // }
|
|
|
- if ($k + 1 <= $rand_num) {
|
|
|
- $text .= "用户ID:{$lastStr} \n";
|
|
|
- $text .= "下注类型:[".$v['keywords']."] \n";
|
|
|
- $text .= "中奖类型:[".$v['keywords']."] \n";
|
|
|
- $text .= "投注金额:{$v['amount']} \n";
|
|
|
- $text .= "中奖金额:{$v['amount']} \n";
|
|
|
- $text .= "派彩金额:{$profit} \n";
|
|
|
- $text .= "盈亏金额:{$yl} \n";
|
|
|
- $text .= "-------------------------------- \n";
|
|
|
+ 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'] = false;
|
|
|
+
|
|
|
}
|
|
|
} else {
|
|
|
- $amount = number_format($v['amount'],2);
|
|
|
- $v['amount'] = $v['amount'];
|
|
|
- // if ($k + 1 <= $rand_num) {
|
|
|
- // $text .= "会员下注 【" . $lastStr . "】 {$v['amount']} {$v['profit']} -{$v['amount']}\n";
|
|
|
- // }
|
|
|
+
|
|
|
+ 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'] = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return $openList;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开奖通知
|
|
|
+ public static function lotteryNotice($openList,$issue_no)
|
|
|
+ {
|
|
|
+ $betNoticeNum = Config::where('field', 'bet_notice_num')->first()->val;
|
|
|
+ $betNoticeNum = explode(',', $betNoticeNum);
|
|
|
+ $betNoticeMini = $betNoticeNum[0] ?? 26;
|
|
|
+ $betNoticeMax = $betNoticeNum[1] ?? 38;
|
|
|
+ $noticeNum = rand($betNoticeMini, $betNoticeMax);
|
|
|
+ shuffle($openList);
|
|
|
+
|
|
|
+ $text = $issue_no . "期开奖结果 \n";
|
|
|
+ $text .= "-----本期开奖账单----- \n";
|
|
|
+ foreach($openList as $k => $v){
|
|
|
+ $amount = $v['amount'];
|
|
|
$profit = number_format($v['profit'],2);
|
|
|
$yl = bcsub($v['profit'], $v['amount'], 2); // 盈利
|
|
|
- // $text .= "会员下注 【" . $v['lastStr'] . "】 {$amount} {$profit} {$yl}\n";
|
|
|
-
|
|
|
- if ($k + 1 <= $rand_num) {
|
|
|
- $text .= "用户ID:{$lastStr} \n";
|
|
|
- $text .= "下注类型:[".$v['keywords']."] \n";
|
|
|
- $text .= "中奖类型:[-] \n";
|
|
|
+ if(($k+1) <= $noticeNum){
|
|
|
+ $text .= "用户ID:{$v['lastStr']} \n";
|
|
|
+ $text .= "下注类型:[".implode(',', $v['keywords'])."] \n";
|
|
|
+ $text .= "中奖类型:[".implode(',', $v['openKeywords'])."] \n";
|
|
|
$text .= "投注金额:{$amount} \n";
|
|
|
- $text .= "中奖金额:0 \n";
|
|
|
- $text .= "派彩金额:0 \n";
|
|
|
- $text .= "盈亏金额:-{$amount} \n";
|
|
|
+ $text .= "中奖金额:{$v['win_amount']} \n";
|
|
|
+ $text .= "派彩金额:{$profit} \n";
|
|
|
+ $text .= "盈亏金额:{$yl} \n";
|
|
|
$text .= "-------------------------------- \n";
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ if($v['is_send']){
|
|
|
+ $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,$keyboard);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
- return $text;
|
|
|
+ $inlineButton = self::getOperateButton();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 群通知
|
|
|
+ // self::bettingGroupNotice($text, $inlineButton, '');
|
|
|
+ SendTelegramGroupMessageJob::dispatch($text,$inlineButton,'');
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public static function todayExchangeRate($chatId)
|
|
|
{
|
|
|
$exchangeRate = Config::where('field', 'exchange_rate_rmb')->first()->val;
|