|
@@ -158,17 +158,18 @@ class PcIssueService extends BaseService
|
|
|
BetService::betSettled($info->issue_no, $awards);
|
|
BetService::betSettled($info->issue_no, $awards);
|
|
|
DB::commit();
|
|
DB::commit();
|
|
|
return ['code' => self::YES, 'msg' => '开奖成功'];
|
|
return ['code' => self::YES, 'msg' => '开奖成功'];
|
|
|
- }catch (\Exception $e) {
|
|
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
Log::error('开奖失败: ' . $e->getMessage() . $winning_numbers);
|
|
Log::error('开奖失败: ' . $e->getMessage() . $winning_numbers);
|
|
|
return ['code' => self::NOT, 'msg' => '开奖失败'];
|
|
return ['code' => self::NOT, 'msg' => '开奖失败'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// 生成开奖图片
|
|
// 生成开奖图片
|
|
|
private static function lotteryImage($issue_no)
|
|
private static function lotteryImage($issue_no)
|
|
|
{
|
|
{
|
|
|
- $list = PcIssue::where('issue_no', '<=', $issue_no)->where('status' , PcIssue::STATUS_DRAW)->orderBy('issue_no', 'desc')->take(20)->get();
|
|
|
|
|
|
|
+ $list = PcIssue::where('issue_no', '<=', $issue_no)->where('status', PcIssue::STATUS_DRAW)->orderBy('issue_no', 'desc')->take(20)->get();
|
|
|
$records = $list->toArray();
|
|
$records = $list->toArray();
|
|
|
|
|
|
|
|
foreach ($records as $k => $v) {
|
|
foreach ($records as $k => $v) {
|
|
@@ -208,6 +209,7 @@ class PcIssueService extends BaseService
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //创建新的一期
|
|
|
private static function createIssueNo()
|
|
private static function createIssueNo()
|
|
|
{
|
|
{
|
|
|
$issue = PcIssue::orderByDesc('id')->first();
|
|
$issue = PcIssue::orderByDesc('id')->first();
|
|
@@ -225,6 +227,8 @@ class PcIssueService extends BaseService
|
|
|
'start_time' => $issue->end_time,
|
|
'start_time' => $issue->end_time,
|
|
|
'end_time' => date('Y-m-d H:i:s', $end_time),
|
|
'end_time' => date('Y-m-d H:i:s', $end_time),
|
|
|
]);
|
|
]);
|
|
|
|
|
+ $pc28Switch = Config::where('field', 'pc28_switch')->first()->val;
|
|
|
|
|
+ if ($pc28Switch == 1) static::betTing($new_str);
|
|
|
//预测
|
|
//预测
|
|
|
PcPrediction::prediction($new_str);
|
|
PcPrediction::prediction($new_str);
|
|
|
if (strtotime($issue->end_time) <= $now) {
|
|
if (strtotime($issue->end_time) <= $now) {
|
|
@@ -235,6 +239,48 @@ class PcIssueService extends BaseService
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //群通知,发送玩法规则和开始下注的通知
|
|
|
|
|
+ private static function betTing($issue_no): array
|
|
|
|
|
+ {
|
|
|
|
|
+ $info = PcIssue::where('issue_no', $issue_no)->first();
|
|
|
|
|
+ if (!$info) {
|
|
|
|
|
+ return ['code' => self::NOT, 'msg' => '期号不存在'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!in_array($info->status, [PcIssue::STATUS_DRAFT, PcIssue::STATUS_BETTING])) {
|
|
|
|
|
+ return ['code' => self::NOT, 'msg' => '期号状态不正确'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $info->status = PcIssue::STATUS_BETTING;
|
|
|
|
|
+ $info->save();
|
|
|
|
|
+ $replyInfo = KeyboardService::findOne(['button' => '玩法规则']);
|
|
|
|
|
+ if ($replyInfo) {
|
|
|
|
|
+ $text = $replyInfo->reply;
|
|
|
|
|
+ $buttons = json_decode($replyInfo->buttons, true);
|
|
|
|
|
+ $image = $replyInfo->image;
|
|
|
|
|
+ if ($image) {
|
|
|
|
|
+ $image = url($image);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($buttons)) {
|
|
|
|
|
+ $buttons = self::getOperateButton();
|
|
|
|
|
+ }
|
|
|
|
|
+ self::asyncBettingGroupNotice($text, $buttons, $image);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $replyInfo = KeyboardService::findOne(['button' => '开始下注']);
|
|
|
|
|
+ if ($replyInfo) {
|
|
|
|
|
+ $text = $replyInfo->reply;
|
|
|
|
|
+ $buttons = json_decode($replyInfo->buttons, true);
|
|
|
|
|
+ $image = $replyInfo->image;
|
|
|
|
|
+ if ($image) {
|
|
|
|
|
+ $image = url($image);
|
|
|
|
|
+ }
|
|
|
|
|
+ self::asyncBettingGroupNotice($text, $buttons, $image);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return ['code' => self::YES, 'msg' => '开始下注'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//获取随机的20个数字
|
|
//获取随机的20个数字
|
|
|
private static function getKeno(): array
|
|
private static function getKeno(): array
|
|
|
{
|
|
{
|
|
@@ -258,7 +304,6 @@ class PcIssueService extends BaseService
|
|
|
return $winningNumbers;
|
|
return $winningNumbers;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//根据指定0-27的数字 得到20个数字
|
|
//根据指定0-27的数字 得到20个数字
|
|
|
public static function getMatchingNumbers($target): array|null
|
|
public static function getMatchingNumbers($target): array|null
|
|
|
{
|
|
{
|