Socket/app/services/scan/ScanCommonService.php
2026-01-28 23:48:20 +08:00

38 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\services\scan;
use app\models\process\NumberTab;
use freedom\utils\RedisUtil;
/**
* TODO 扫描登录公共处理类
* Class ScanDtService
* @package app\services\scan
*/
class ScanCommonService
{
/**
* TODO 扫描公共验证方法
* @param array $event
* @param array $tableInfo
* @return array
*/
public static function checkScan(array $event, array $tableInfo): array
{
if ($tableInfo['is_scavenging'] != 1) return ['status' => false, 'msg' => 'This Table Is Not Scan'];
if (!isset($event['number_tab_id'])) return ['status' => false, 'msg' => 'Not NumberTabId'];
$numberTabInfo = NumberTab::getByTableIdOrderByIdDesc($tableInfo);
if (!$numberTabInfo) return ['status' => false, 'msg' => 'NumberTabId Error'];
if ($numberTabInfo['bet_status'] != 2) return ['status' => false, 'msg' => 'BetStatus No 2'];
//判断redis是否存在Card数据如果不存在则创建
if ($tableInfo['game_id'] == 1 || $tableInfo['game_id'] == 2){
$cardInfo = RedisUtil::getCardPosition($numberTabInfo['id']);
} else {
$cardInfo = RedisUtil::getCard($numberTabInfo['id']);
}
return ['status' => true, 'numberTabInfo' => $numberTabInfo, 'cardInfo' => $cardInfo];
}
}