38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?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];
|
||
}
|
||
} |