|
|
@@ -31,6 +31,30 @@ class PcIssueService extends BaseService
|
|
|
|
|
|
|
|
|
public static function index(): void
|
|
|
+ {
|
|
|
+ //创建新的期号
|
|
|
+ PcIssueService::createIssueNo();
|
|
|
+ //将未开奖的进行开奖
|
|
|
+ PcIssueService:: kaiJiang();
|
|
|
+ //对该封盘的进行封盘
|
|
|
+ PcIssueService:: fengPan();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private static function fengPan()
|
|
|
+ {
|
|
|
+ $list = PcIssue::where('status', PcIssue::STATUS_BETTING)->get();
|
|
|
+ $now = time();
|
|
|
+ foreach ($list as $item) {
|
|
|
+ if (strtotime($item->end_time) - 30 <= $now) {
|
|
|
+ $item->status = PcIssue::STATUS_CLOSE;
|
|
|
+ $item->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static function kaiJiang(): void
|
|
|
{
|
|
|
$list = PcIssue::where('status', PcIssue::STATUS_CLOSE)->get();
|
|
|
$now = time();
|
|
|
@@ -48,6 +72,26 @@ class PcIssueService extends BaseService
|
|
|
|
|
|
private static function createIssueNo()
|
|
|
{
|
|
|
+ $issue = PcIssue::orderByDesc('id')->first();
|
|
|
+ $now = time();
|
|
|
+ if (strtotime($issue->end_time) <= $now) {
|
|
|
+ $issue_no = $issue->issue_no;
|
|
|
+ $number = preg_replace('/\D/', '', $issue_no);
|
|
|
+ $number = (int)$number + 1;
|
|
|
+ $new_str = "P" . $number;
|
|
|
+ $end_time = strtotime($issue->end_time) + 210;
|
|
|
+ $status = $end_time - 30 > $now ? PcIssue::STATUS_BETTING : PcIssue::STATUS_CLOSE;
|
|
|
+ $issue = PcIssue::create([
|
|
|
+ 'issue_no' => $new_str,
|
|
|
+ 'status' => $status,
|
|
|
+ 'start_time' => $issue->end_time,
|
|
|
+ 'end_time' => date('Y-m-d H:i:s', $end_time),
|
|
|
+ ]);
|
|
|
+ if (strtotime($issue->end_time) <= $now) {
|
|
|
+ static::createIssueNo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|