|
|
@@ -3,6 +3,7 @@
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
+use App\Http\Controllers\admin\GameplayRule;
|
|
|
use App\Services\BaseService;
|
|
|
use App\Models\Bet;
|
|
|
use App\Models\Config;
|
|
|
@@ -297,6 +298,57 @@ class BetService extends BaseService
|
|
|
return $msg;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // 模拟下注
|
|
|
+ public static function fakeBet()
|
|
|
+ {
|
|
|
+
|
|
|
+ // 期数验证
|
|
|
+ $issueInfo = IssueService::model()::where('status',IssueService::model()::STATUS_BETTING)->orderBy('id','desc')->first();
|
|
|
+ if($issueInfo){
|
|
|
+ $fake_bet_list = Cache::get('fake_bet_'.$issueInfo->issue_no,[]);
|
|
|
+
|
|
|
+ $gameplayRuleList = GameplayRuleService::model()::where('odds','>',0)->get();
|
|
|
+ $gameplayRuleList = $gameplayRuleList->toArray();
|
|
|
+ $randKey = array_rand($gameplayRuleList,1);
|
|
|
+ $gameplayRuleInfo = $gameplayRuleList[$randKey]??[];
|
|
|
+ if($gameplayRuleInfo){
|
|
|
+
|
|
|
+
|
|
|
+ $item = [];
|
|
|
+ $item['keywords'] = $gameplayRuleInfo['keywords'];
|
|
|
+ $item['odds'] = $gameplayRuleInfo['odds'];
|
|
|
+ $item['amount'] = rand($gameplayRuleInfo['mininum'],$gameplayRuleInfo['maxinum']);
|
|
|
+ $item['first_name'] = self::generateRandomString(6);
|
|
|
+ $item['profit'] = 0;
|
|
|
+ $input = $item['keywords'].$item['amount'];
|
|
|
+
|
|
|
+ $fake_bet_list[] = $item;
|
|
|
+
|
|
|
+ $lastStr = self::getLastChar($item['first_name'],1);
|
|
|
+
|
|
|
+ $groupText = "";
|
|
|
+ $groupText .= "私聊下注 【xxxxxx".$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);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @description: 当期下注
|
|
|
* @param {*} $memberId
|
|
|
@@ -428,6 +480,8 @@ class BetService extends BaseService
|
|
|
|
|
|
$bet_num = 0;
|
|
|
foreach($list->toArray() as $k => $v){
|
|
|
+ $userInfo = UserService::findAll(['member_id' => $v['member_id']]);
|
|
|
+ $lastStr = self::getLastChar($userInfo->first_name,1);
|
|
|
$item = [];
|
|
|
$item['id'] = $v['id'];
|
|
|
$item['status'] = self::model()::STATUS_SETTLED;
|
|
|
@@ -441,7 +495,8 @@ class BetService extends BaseService
|
|
|
|
|
|
$yl = $profit - $v['amount'];
|
|
|
if($k+1 <= 15){
|
|
|
- $text .= "私聊下注 【******】 {$yl}\n";
|
|
|
+
|
|
|
+ $text .= "私聊下注 【******".$lastStr."】 {$yl}\n";
|
|
|
$bet_num++;
|
|
|
}
|
|
|
// 结算
|
|
|
@@ -453,7 +508,7 @@ class BetService extends BaseService
|
|
|
BalanceLogService::addLog($v['member_id'],$profit,$balance,($balance+$profit),'中奖',$v['id'],'');
|
|
|
}else{
|
|
|
if($k+1 <= 15){
|
|
|
- $text .= "私聊下注 【******】 -{$v['amount']}\n";
|
|
|
+ $text .= "私聊下注 【******".$lastStr."】 -{$v['amount']}\n";
|
|
|
$bet_num++;
|
|
|
}
|
|
|
}
|
|
|
@@ -476,4 +531,6 @@ class BetService extends BaseService
|
|
|
// 群通知
|
|
|
self::bettingGroupNotice($text, $inlineButton, '');
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|