| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- namespace App\Models;
- use App\Http\helper\NumConfig;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Redis;
- class Control extends Model
- {
- //3017,3010,3016,3014,3015,4000,917
- public $GameData = [
- 'common' => 1,
- 'Texas' => 917,
- 'BCBM' => 2009,
- // 'ABBai' => 2012,
- 'Laba' => 3010,
- 'LB20' => 3031,
- 'LB40' => 3041,
- 'LB25' => 3011,
- 'LBFruit' => 3013,
- 'LBNineLine' => 3014,
- 'Shake' => 3015,
- 'WorldCup' => 3016,
- 'OlympoClear' => 3017,
- 'AthenaClear' => 3067,
- 'TREASURE' => 3018,
- 'RAIO' => 3019,
- 'HALL' => 3020,
- 'CacheTa' => 4000,
- 'Truco' => 4010,
- 'Crash' => 4020,
- 'ClearBomb' => 4021,
- 'Joker5x1' => 5002,
- 'BigBass' => 5005,
- 'FortuneTiger' => 5006,
- 'FortuneOX' => 5007,
- 'HIVE' => 3021,
- 'NewOlympus' => 6001,
- 'Rabbit' => 5008,
- 'Aztec' => 5004,
- 'LHD' => 6021,
- 'Aviator' => 4028,
- 'Aviator2' => 4029,
- 'FortuneRabbit' => 901543462,
- 'FortuneDragon' => 901695365,
- 'FortuneMouse' => 9068,
- 'DragonHatch' => 9057,
- 'GaneshaGold' => 9042,
- 'DoubleFortune' => 9048,
- 'CashMania' => 901682240,
- 'FortuneTigerPG' => 90126,
- 'FortuneOx' => 9098,
- 'LuckyNeko' => 9089,
- 'WildBountyShowdown'=> 90135,
- 'WildBandito' => 90104,
- 'PinataWins' =>901492288,
- 'WildApe' =>901508783,
- 'SuperAce' => 9149,
- 'Crazy777' => 9135,
- 'FortuneGems' => 91109,
- 'FortuneGems2' => 91223,
- 'FortuneGems3' => 91300,
- 'MoneyComingEx' => 91302
- ];
- public $GameDataText = [
- // 'TP' => 'TP',
- // 'TPAK47' => 'TPAK47',
- // 'TPJOKER' => 'TPJOKER',
- // 'Rummy5' => 'Rummy5人',
- // 'Rummy2' => 'Rummy2人',
- // 'TPBai' => '百人TP',
- // 'Scratchcard' => '刮刮卡',
- // 'LuckyGemstone' => '幸运宝石',
- // 'Rummy10Card' => 'Rummy10Card',
- // 'ABBai' => '百人AB',
- 'common' => '其他通用',
- 'LBNineLine' => '拉霸九线',
- 'Laba' => '拉霸50线',
- 'LB25' => '拉霸25线',
- 'LB20' => '拉霸20线',
- 'LB40' => '拉霸40线',
- 'OlympoClear' => '雷神消除',
- 'AthenaClear' => '靓妞消除',
- 'FortuneTiger' => '财富老虎',
- 'FortuneOX' => '财富公牛',
- 'BigBass' => '钓鱼',
- 'WorldCup' => '拉霸世界杯',
- 'TREASURE' => '宝藏',
- 'RAIO' => '闪电',
- 'HALL' => '万圣节',
- 'Shake' => '水果摇摇乐',
- 'LBFruit' => '水果拉霸',
- 'ClearBomb' => '扫雷',
- 'Texas' => '德州扑克',
- 'CacheTa' => 'CacheTa',
- 'Truco' => 'Truco',
- 'Crash' => 'Crash',
- 'BCBM' => '奔驰宝马',
- 'Joker5x1' => '水果单线',
- 'HIVE' => '蜂巢',
- 'NewOlympus' => '新宙斯',
- 'Rabbit' => '财富兔子',
- 'Aztec' => '阿兹特克50',
- 'LHD' => '龙虎斗',
- 'Aviator' => 'Aviator',
- 'Aviator2' => 'Aviator2',
- 'FortuneRabbit' => 'Fortune Rabbit',
- 'FortuneDragon' => 'Fortune Dragon',
- 'FortuneMouse' => 'Fortune Mouse',
- 'DragonHatch' => 'Dragon Hatch',
- 'GaneshaGold' => 'Ganesha Gold',
- 'DoubleFortune' => 'Double Fortune',
- 'CashMania' => 'Cash Mania',
- 'FortuneTigerPG' => 'Fortune Tiger',
- 'FortuneOx' => 'Fortune Ox',
- 'LuckyNeko' => 'Lucky Neko',
- 'WildBountyShowdown'=> 'Wild Bounty Showdown',
- 'WildBandito' => 'Wild Bandito',
- 'PinataWins' =>'Pinata Wins',
- 'WildApe' => 'Wild Ape',
- 'Crazy777' => 'Crazy777',
- 'FortuneGems' => 'Fortune Gems',
- 'FortuneGems2' => 'Fortune Gems 2',
- 'FortuneGems3' => 'Fortune Gems 3',
- 'MoneyComingEx' => 'Money Coming Expend',
- 'SuperAce' => 'Super Ace',
- ];
- public function userControl($post, $UserID)
- {
- foreach ($this->GameData as $key => $value) {
- if ($value == 4010) {
- continue;
- }
- if ($value == 2010 || $value == 2012) {
- if ($value == 2012) $this->ConfigInsert($UserID, $value, $post['ABBai'], $post['ABBaiGear']);
- } else {
- $this->ConfigInsert($UserID, $value, $post[$key]);
- // if($value==3017){
- // $this->ConfigInsert($UserID, 3067, $post[$key]);
- // }
- }
- }
- Redis::set($UserID, \GuzzleHttp\json_encode($post));
- return true;
- }
- // 配置添加
- public function ConfigInsert($UserID, $GameID, $ControlRadian, $Gear = 0)
- {
- $ControlRadian = $Gear > 0 ? $ControlRadian + ($Gear * 1000) : $ControlRadian;
- $KindData = [
- 'UserID' => $UserID,
- 'KindID' => $GameID,
- 'ControlRadian' => $ControlRadian,
- 'ControlDate' => date('Y-m-d H:i:s')
- ];
- DB::connection('write')->table('QPTreasureDB.dbo.UserControlKind')->updateOrInsert(['UserID' => $UserID, 'KindID' => $GameID], $KindData);
- }
- /**
- * 获取单控状态
- * @param $UserID // 用户ID
- * @param $onLinUser // 在线用户
- * @return string
- */
- public function getControlState($UserID, $onLinUser = [])
- {
- $controlState = '';
- if (isset($onLinUser[$UserID])) {
- $controlUser = Redis::get($UserID);
- if (!empty($controlUser)) {
- $controlUser = \GuzzleHttp\json_decode($controlUser, true);
- }
- $GameData = array_flip($this->GameData);
- $GameName = @$GameData[$onLinUser[$UserID]]; // TpBaiGear
- $controlState = '/' . (@$this->GameDataText[$GameName] ?? '') . ':' . (@$controlUser[$GameName] ?? '') . '%' ?? '';
- }
- return $controlState;
- }
- }
|