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