Control.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. namespace App\Models;
  3. use App\Http\helper\NumConfig;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Support\Facades\DB;
  6. use Illuminate\Support\Facades\Redis;
  7. class Control extends Model
  8. {
  9. //3017,3010,3016,3014,3015,4000,917
  10. public $GameData = [
  11. 'common' => 1,
  12. 'Texas' => 917,
  13. 'BCBM' => 2009,
  14. // 'ABBai' => 2012,
  15. 'Laba' => 3010,
  16. 'LB20' => 3031,
  17. 'LB40' => 3041,
  18. 'LB25' => 3011,
  19. 'LBFruit' => 3013,
  20. 'LBNineLine' => 3014,
  21. 'Shake' => 3015,
  22. 'WorldCup' => 3016,
  23. 'OlympoClear' => 3017,
  24. 'AthenaClear' => 3067,
  25. 'TREASURE' => 3018,
  26. 'RAIO' => 3019,
  27. 'HALL' => 3020,
  28. 'CacheTa' => 4000,
  29. 'Truco' => 4010,
  30. 'Crash' => 4020,
  31. 'ClearBomb' => 4021,
  32. 'Joker5x1' => 5002,
  33. 'BigBass' => 5005,
  34. 'FortuneTiger' => 5006,
  35. 'FortuneOX' => 5007,
  36. 'HIVE' => 3021,
  37. 'NewOlympus' => 6001,
  38. 'Rabbit' => 5008,
  39. 'Aztec' => 5004,
  40. 'LHD' => 6021,
  41. 'Aviator' => 4028,
  42. 'Aviator2' => 4029,
  43. 'FortuneRabbit' => 901543462,
  44. 'FortuneDragon' => 901695365,
  45. 'FortuneMouse' => 9068,
  46. 'DragonHatch' => 9057,
  47. 'GaneshaGold' => 9042,
  48. 'DoubleFortune' => 9048,
  49. 'CashMania' => 901682240,
  50. 'FortuneTigerPG' => 90126,
  51. 'FortuneOx' => 9098,
  52. 'LuckyNeko' => 9089,
  53. 'WildBountyShowdown'=> 90135,
  54. 'WildBandito' => 90104,
  55. 'PinataWins' =>901492288,
  56. 'WildApe' =>901508783,
  57. 'SuperAce' => 9149,
  58. 'Crazy777' => 9135,
  59. 'FortuneGems' => 91109,
  60. 'FortuneGems2' => 91223,
  61. 'FortuneGems3' => 91300,
  62. 'MoneyComingEx' => 91302
  63. ];
  64. public $GameDataText = [
  65. // 'TP' => 'TP',
  66. // 'TPAK47' => 'TPAK47',
  67. // 'TPJOKER' => 'TPJOKER',
  68. // 'Rummy5' => 'Rummy5人',
  69. // 'Rummy2' => 'Rummy2人',
  70. // 'TPBai' => '百人TP',
  71. // 'Scratchcard' => '刮刮卡',
  72. // 'LuckyGemstone' => '幸运宝石',
  73. // 'Rummy10Card' => 'Rummy10Card',
  74. // 'ABBai' => '百人AB',
  75. 'common' => '其他通用',
  76. 'LBNineLine' => '拉霸九线',
  77. 'Laba' => '拉霸50线',
  78. 'LB25' => '拉霸25线',
  79. 'LB20' => '拉霸20线',
  80. 'LB40' => '拉霸40线',
  81. 'OlympoClear' => '雷神消除',
  82. 'AthenaClear' => '靓妞消除',
  83. 'FortuneTiger' => '财富老虎',
  84. 'FortuneOX' => '财富公牛',
  85. 'BigBass' => '钓鱼',
  86. 'WorldCup' => '拉霸世界杯',
  87. 'TREASURE' => '宝藏',
  88. 'RAIO' => '闪电',
  89. 'HALL' => '万圣节',
  90. 'Shake' => '水果摇摇乐',
  91. 'LBFruit' => '水果拉霸',
  92. 'ClearBomb' => '扫雷',
  93. 'Texas' => '德州扑克',
  94. 'CacheTa' => 'CacheTa',
  95. 'Truco' => 'Truco',
  96. 'Crash' => 'Crash',
  97. 'BCBM' => '奔驰宝马',
  98. 'Joker5x1' => '水果单线',
  99. 'HIVE' => '蜂巢',
  100. 'NewOlympus' => '新宙斯',
  101. 'Rabbit' => '财富兔子',
  102. 'Aztec' => '阿兹特克50',
  103. 'LHD' => '龙虎斗',
  104. 'Aviator' => 'Aviator',
  105. 'Aviator2' => 'Aviator2',
  106. 'FortuneRabbit' => 'Fortune Rabbit',
  107. 'FortuneDragon' => 'Fortune Dragon',
  108. 'FortuneMouse' => 'Fortune Mouse',
  109. 'DragonHatch' => 'Dragon Hatch',
  110. 'GaneshaGold' => 'Ganesha Gold',
  111. 'DoubleFortune' => 'Double Fortune',
  112. 'CashMania' => 'Cash Mania',
  113. 'FortuneTigerPG' => 'Fortune Tiger',
  114. 'FortuneOx' => 'Fortune Ox',
  115. 'LuckyNeko' => 'Lucky Neko',
  116. 'WildBountyShowdown'=> 'Wild Bounty Showdown',
  117. 'WildBandito' => 'Wild Bandito',
  118. 'PinataWins' =>'Pinata Wins',
  119. 'WildApe' => 'Wild Ape',
  120. 'Crazy777' => 'Crazy777',
  121. 'FortuneGems' => 'Fortune Gems',
  122. 'FortuneGems2' => 'Fortune Gems 2',
  123. 'FortuneGems3' => 'Fortune Gems 3',
  124. 'MoneyComingEx' => 'Money Coming Expend',
  125. 'SuperAce' => 'Super Ace',
  126. ];
  127. public function userControl($post, $UserID)
  128. {
  129. foreach ($this->GameData as $key => $value) {
  130. if ($value == 4010) {
  131. continue;
  132. }
  133. if ($value == 2010 || $value == 2012) {
  134. if ($value == 2012) $this->ConfigInsert($UserID, $value, $post['ABBai'], $post['ABBaiGear']);
  135. } else {
  136. $this->ConfigInsert($UserID, $value, $post[$key]);
  137. // if($value==3017){
  138. // $this->ConfigInsert($UserID, 3067, $post[$key]);
  139. // }
  140. }
  141. }
  142. Redis::set($UserID, \GuzzleHttp\json_encode($post));
  143. return true;
  144. }
  145. // 配置添加
  146. public function ConfigInsert($UserID, $GameID, $ControlRadian, $Gear = 0)
  147. {
  148. $ControlRadian = $Gear > 0 ? $ControlRadian + ($Gear * 1000) : $ControlRadian;
  149. $KindData = [
  150. 'UserID' => $UserID,
  151. 'KindID' => $GameID,
  152. 'ControlRadian' => $ControlRadian,
  153. 'ControlDate' => date('Y-m-d H:i:s')
  154. ];
  155. DB::connection('write')->table('QPTreasureDB.dbo.UserControlKind')->updateOrInsert(['UserID' => $UserID, 'KindID' => $GameID], $KindData);
  156. }
  157. /**
  158. * 获取单控状态
  159. * @param $UserID // 用户ID
  160. * @param $onLinUser // 在线用户
  161. * @return string
  162. */
  163. public function getControlState($UserID, $onLinUser = [])
  164. {
  165. $controlState = '';
  166. if (isset($onLinUser[$UserID])) {
  167. $controlUser = Redis::get($UserID);
  168. if (!empty($controlUser)) {
  169. $controlUser = \GuzzleHttp\json_decode($controlUser, true);
  170. }
  171. $GameData = array_flip($this->GameData);
  172. $GameName = @$GameData[$onLinUser[$UserID]]; // TpBaiGear
  173. $controlState = '/' . (@$this->GameDataText[$GameName] ?? '') . ':' . (@$controlUser[$GameName] ?? '') . '%' ?? '';
  174. }
  175. return $controlState;
  176. }
  177. }