|
@@ -57,8 +57,7 @@ class IssueService extends BaseService
|
|
|
* @description: 模型
|
|
* @description: 模型
|
|
|
* @return {string}
|
|
* @return {string}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function model(): string
|
|
|
|
|
|
|
+ public static function model(): string
|
|
|
{
|
|
{
|
|
|
return Issue::class;
|
|
return Issue::class;
|
|
|
}
|
|
}
|
|
@@ -67,8 +66,7 @@ class IssueService extends BaseService
|
|
|
* @description: 枚举
|
|
* @description: 枚举
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function enum(): string
|
|
|
|
|
|
|
+ public static function enum(): string
|
|
|
{
|
|
{
|
|
|
return '';
|
|
return '';
|
|
|
}
|
|
}
|
|
@@ -78,8 +76,7 @@ class IssueService extends BaseService
|
|
|
* @param {array} $search 查询内容
|
|
* @param {array} $search 查询内容
|
|
|
* @return {array}
|
|
* @return {array}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function getWhere(array $search = []): array
|
|
|
|
|
|
|
+ public static function getWhere(array $search = []): array
|
|
|
{
|
|
{
|
|
|
$where = [];
|
|
$where = [];
|
|
|
if (isset($search['issue_no']) && !empty($search['issue_no'])) {
|
|
if (isset($search['issue_no']) && !empty($search['issue_no'])) {
|
|
@@ -109,8 +106,7 @@ class IssueService extends BaseService
|
|
|
* @param array $search
|
|
* @param array $search
|
|
|
* @return \App\Models\Coin|null
|
|
* @return \App\Models\Coin|null
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function findOne(array $search): ?Issue
|
|
|
|
|
|
|
+ public static function findOne(array $search): ?Issue
|
|
|
{
|
|
{
|
|
|
return self::model()::where(self::getWhere($search))->first();
|
|
return self::model()::where(self::getWhere($search))->first();
|
|
|
}
|
|
}
|
|
@@ -120,8 +116,7 @@ class IssueService extends BaseService
|
|
|
* @param array $search
|
|
* @param array $search
|
|
|
* @return \Illuminate\Database\Eloquent\Collection
|
|
* @return \Illuminate\Database\Eloquent\Collection
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function findAll(array $search = [])
|
|
|
|
|
|
|
+ public static function findAll(array $search = [])
|
|
|
{
|
|
{
|
|
|
return self::model()::where(self::getWhere($search))->get();
|
|
return self::model()::where(self::getWhere($search))->get();
|
|
|
}
|
|
}
|
|
@@ -131,8 +126,7 @@ class IssueService extends BaseService
|
|
|
* @param array $search
|
|
* @param array $search
|
|
|
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
|
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function paginate(array $search = [])
|
|
|
|
|
|
|
+ public static function paginate(array $search = [])
|
|
|
{
|
|
{
|
|
|
$limit = isset($search['limit']) ? $search['limit'] : 15;
|
|
$limit = isset($search['limit']) ? $search['limit'] : 15;
|
|
|
$paginator = self::model()::where(self::getWhere($search))->orderBy('issue_no', 'desc')->paginate($limit);
|
|
$paginator = self::model()::where(self::getWhere($search))->orderBy('issue_no', 'desc')->paginate($limit);
|
|
@@ -144,8 +138,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $params
|
|
* @param {*} $params
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function submit($params = [])
|
|
|
|
|
|
|
+ public static function submit($params = [])
|
|
|
{
|
|
{
|
|
|
$result = false;
|
|
$result = false;
|
|
|
$msg['code'] = self::NOT;
|
|
$msg['code'] = self::NOT;
|
|
@@ -184,8 +177,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $id
|
|
* @param {*} $id
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function betting($id)
|
|
|
|
|
|
|
+ public static function betting($id)
|
|
|
{
|
|
{
|
|
|
$info = self::findOne(['id' => $id]);
|
|
$info = self::findOne(['id' => $id]);
|
|
|
if (!$info) {
|
|
if (!$info) {
|
|
@@ -239,8 +231,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $id
|
|
* @param {*} $id
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function closeBetting($id)
|
|
|
|
|
|
|
+ public static function closeBetting($id)
|
|
|
{
|
|
{
|
|
|
$info = self::findOne(['id' => $id]);
|
|
$info = self::findOne(['id' => $id]);
|
|
|
if (!$info) {
|
|
if (!$info) {
|
|
@@ -289,8 +280,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $id
|
|
* @param {*} $id
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function lotteryDrawFail($id)
|
|
|
|
|
|
|
+ public static function lotteryDrawFail($id)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
$result = false;
|
|
$result = false;
|
|
@@ -336,8 +326,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $recordImage 开奖图片
|
|
* @param {*} $recordImage 开奖图片
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function lotteryDraw($id, $winning_numbers, $combo, $recordImage, $keno = null)
|
|
|
|
|
|
|
+ public static function lotteryDraw($id, $winning_numbers, $combo, $recordImage, $keno = null)
|
|
|
{
|
|
{
|
|
|
$info = self::findOne(['id' => $id]);
|
|
$info = self::findOne(['id' => $id]);
|
|
|
if (!$info) {
|
|
if (!$info) {
|
|
@@ -438,8 +427,7 @@ class IssueService extends BaseService
|
|
|
|
|
|
|
|
|
|
|
|
|
// 虚拟开奖
|
|
// 虚拟开奖
|
|
|
- public
|
|
|
|
|
- static function fakeLotteryDraw($issue_no, $awards)
|
|
|
|
|
|
|
+ public static function fakeLotteryDraw($issue_no, $awards)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
$fake_bet_list = Cache::get('fake_bet_' . $issue_no, []);
|
|
$fake_bet_list = Cache::get('fake_bet_' . $issue_no, []);
|
|
@@ -477,8 +465,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $winning_numbers
|
|
* @param {*} $winning_numbers
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function award($winning_numbers)
|
|
|
|
|
|
|
+ public static function award($winning_numbers)
|
|
|
{
|
|
{
|
|
|
$result = [];
|
|
$result = [];
|
|
|
|
|
|
|
@@ -574,8 +561,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $number
|
|
* @param {*} $number
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function calculateOddEven($number)
|
|
|
|
|
|
|
+ public static function calculateOddEven($number)
|
|
|
{
|
|
{
|
|
|
if ($number & 1) {
|
|
if ($number & 1) {
|
|
|
return GameplayRuleEnum::SINGLE;
|
|
return GameplayRuleEnum::SINGLE;
|
|
@@ -589,8 +575,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $number
|
|
* @param {*} $number
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function calculateSumSize($number)
|
|
|
|
|
|
|
+ public static function calculateSumSize($number)
|
|
|
{
|
|
{
|
|
|
if ($number >= GameplayRuleEnum::SUM_BIG) {
|
|
if ($number >= GameplayRuleEnum::SUM_BIG) {
|
|
|
return GameplayRuleEnum::BIG;
|
|
return GameplayRuleEnum::BIG;
|
|
@@ -606,8 +591,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $number
|
|
* @param {*} $number
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function calculateSumExtremeSize($number)
|
|
|
|
|
|
|
+ public static function calculateSumExtremeSize($number)
|
|
|
{
|
|
{
|
|
|
$result = '';
|
|
$result = '';
|
|
|
if ($number >= GameplayRuleEnum::SUM_EXTREME_BIG) {
|
|
if ($number >= GameplayRuleEnum::SUM_EXTREME_BIG) {
|
|
@@ -628,8 +612,7 @@ class IssueService extends BaseService
|
|
|
* @param {int} $c
|
|
* @param {int} $c
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function isBaoZi(int $a, int $b, int $c)
|
|
|
|
|
|
|
+ public static function isBaoZi(int $a, int $b, int $c)
|
|
|
{
|
|
{
|
|
|
$result = '';
|
|
$result = '';
|
|
|
if ($a === $b && $b === $c) {
|
|
if ($a === $b && $b === $c) {
|
|
@@ -646,8 +629,7 @@ class IssueService extends BaseService
|
|
|
* @param {int} $c
|
|
* @param {int} $c
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function isPair($a, $b, $c)
|
|
|
|
|
|
|
+ public static function isPair($a, $b, $c)
|
|
|
{
|
|
{
|
|
|
$result = '';
|
|
$result = '';
|
|
|
// 确保输入都是个位数
|
|
// 确保输入都是个位数
|
|
@@ -672,8 +654,7 @@ class IssueService extends BaseService
|
|
|
* @param {int} $c
|
|
* @param {int} $c
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function isStraight($a, $b, $c)
|
|
|
|
|
|
|
+ public static function isStraight($a, $b, $c)
|
|
|
{
|
|
{
|
|
|
$result = '';
|
|
$result = '';
|
|
|
// 确保输入都是个位数(0-9)
|
|
// 确保输入都是个位数(0-9)
|
|
@@ -708,8 +689,7 @@ class IssueService extends BaseService
|
|
|
* @param int $number 输入数字
|
|
* @param int $number 输入数字
|
|
|
* @return int 尾数
|
|
* @return int 尾数
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function getLastDigit($number)
|
|
|
|
|
|
|
+ public static function getLastDigit($number)
|
|
|
{
|
|
{
|
|
|
// 确保输入是整数
|
|
// 确保输入是整数
|
|
|
$number = (int)$number;
|
|
$number = (int)$number;
|
|
@@ -725,8 +705,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $number
|
|
* @param {*} $number
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function calculateOneSize($number)
|
|
|
|
|
|
|
+ public static function calculateOneSize($number)
|
|
|
{
|
|
{
|
|
|
if ($number >= GameplayRuleEnum::ONE_BIG) {
|
|
if ($number >= GameplayRuleEnum::ONE_BIG) {
|
|
|
return GameplayRuleEnum::BIG;
|
|
return GameplayRuleEnum::BIG;
|
|
@@ -742,8 +721,7 @@ class IssueService extends BaseService
|
|
|
* @param {*} $number
|
|
* @param {*} $number
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function getSection($number)
|
|
|
|
|
|
|
+ public static function getSection($number)
|
|
|
{
|
|
{
|
|
|
$result = '';
|
|
$result = '';
|
|
|
if ($number >= GameplayRuleEnum::SECTION_1[0] && $number <= GameplayRuleEnum::SECTION_1[1]) {
|
|
if ($number >= GameplayRuleEnum::SECTION_1[0] && $number <= GameplayRuleEnum::SECTION_1[1]) {
|
|
@@ -762,8 +740,7 @@ class IssueService extends BaseService
|
|
|
* @description: 近期开奖记录
|
|
* @description: 近期开奖记录
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
- public
|
|
|
|
|
- static function currentLotteryResults($memberId)
|
|
|
|
|
|
|
+ public static function currentLotteryResults($memberId)
|
|
|
{
|
|
{
|
|
|
// $result = self::model()::where('status', self::model()::STATUS_DRAW)->orderBy('id','desc')->take(16)->get();
|
|
// $result = self::model()::where('status', self::model()::STATUS_DRAW)->orderBy('id','desc')->take(16)->get();
|
|
|
// $text = "📅 近期开奖记录\n";
|
|
// $text = "📅 近期开奖记录\n";
|
|
@@ -848,8 +825,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public
|
|
|
|
|
- static function getCombo($winArr)
|
|
|
|
|
|
|
+ public static function getCombo($winArr)
|
|
|
{
|
|
{
|
|
|
// 组合
|
|
// 组合
|
|
|
$sum = array_sum($winArr);
|
|
$sum = array_sum($winArr);
|
|
@@ -1300,8 +1276,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取最新的开奖数据
|
|
// 获取最新的开奖数据
|
|
|
- public
|
|
|
|
|
- static function getLatestIssue2()
|
|
|
|
|
|
|
+ public static function getLatestIssue2()
|
|
|
{
|
|
{
|
|
|
$url = "https://ydpc28.co/api/pc28/list";
|
|
$url = "https://ydpc28.co/api/pc28/list";
|
|
|
$result = file_get_contents($url);
|
|
$result = file_get_contents($url);
|
|
@@ -1385,8 +1360,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 封盘倒数
|
|
// 封盘倒数
|
|
|
- public
|
|
|
|
|
- static function syncCountdownIssue()
|
|
|
|
|
|
|
+ public static function syncCountdownIssue()
|
|
|
{
|
|
{
|
|
|
$info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time', 'asc')->first();
|
|
$info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time', 'asc')->first();
|
|
|
if ($info) {
|
|
if ($info) {
|
|
@@ -1417,8 +1391,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 停止下注
|
|
// 停止下注
|
|
|
- public
|
|
|
|
|
- static function syncCloseIssue()
|
|
|
|
|
|
|
+ public static function syncCloseIssue()
|
|
|
{
|
|
{
|
|
|
$now_date = date('Y-m-d H:i:s', time() + 30); // 提前30秒
|
|
$now_date = date('Y-m-d H:i:s', time() + 30); // 提前30秒
|
|
|
$list = self::findAll(['status' => self::model()::STATUS_BETTING]);
|
|
$list = self::findAll(['status' => self::model()::STATUS_BETTING]);
|
|
@@ -1431,8 +1404,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 生成开奖图片
|
|
// 生成开奖图片
|
|
|
- public
|
|
|
|
|
- static function lotteryImage($issue_no)
|
|
|
|
|
|
|
+ public static function lotteryImage($issue_no)
|
|
|
{
|
|
{
|
|
|
$list = self::model()::where('issue_no', '<=', $issue_no)->where(self::getWhere(['status' => self::model()::STATUS_DRAW]))->orderBy('issue_no', 'desc')->take(20)->get();
|
|
$list = self::model()::where('issue_no', '<=', $issue_no)->where(self::getWhere(['status' => self::model()::STATUS_DRAW]))->orderBy('issue_no', 'desc')->take(20)->get();
|
|
|
$records = $list->toArray();
|
|
$records = $list->toArray();
|
|
@@ -1475,8 +1447,7 @@ class IssueService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 发送开奖图片
|
|
// 发送开奖图片
|
|
|
- public
|
|
|
|
|
- static function sendLotteryImage($chatId, $issueNo)
|
|
|
|
|
|
|
+ public static function sendLotteryImage($chatId, $issueNo)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
$recordImage = self::lotteryImage($issueNo);
|
|
$recordImage = self::lotteryImage($issueNo);
|