Game.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /**
  3. * Game.php UTF-8
  4. * 游戏信息
  5. *
  6. * @date : 2018/1/19 15:21
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\queue\request;
  13. class Game extends Request {
  14. private $pkg_name = ''; /* 游戏包名 */
  15. private $app_ver = ''; /* 游戏版本 */
  16. private $h_ver = 0; /* 聚合SDK版本编号 */
  17. private $sdk_ver = ''; /* 客户端渠道SDK版本编号 */
  18. private $h_app_id = 0; /* 游戏ID */
  19. public function __construct($data = []) {
  20. if (!empty($data)) {
  21. $this->setData($data);
  22. }
  23. }
  24. /**
  25. * 设置数据
  26. *
  27. * @param array $data
  28. */
  29. public function setData($data = []) {
  30. if (empty($data)) {
  31. return;
  32. }
  33. $this->setPkgName(get_val($data, 'pkg_name', ''));
  34. $this->setAppVer(get_val($data, 'app_ver', ''));
  35. $this->setHVer(get_val($data, 'h_ver', 0));
  36. $this->setSdkVer(get_val($data, 'sdk_ver', ''));
  37. $this->setHAppId(get_val($data, 'h_app_id', 0));
  38. }
  39. /**
  40. * 变量转数组
  41. *
  42. * @return array
  43. */
  44. public function toArray() {
  45. $_data = [
  46. 'pkg_name' => $this->getPkgName(),
  47. 'app_ver' => $this->getAppVer(),
  48. 'h_ver' => $this->getHVer(),
  49. 'sdk_ver' => $this->getSdkVer(),
  50. 'app_id' => $this->getHAppId(),
  51. ];
  52. return $_data;
  53. }
  54. /**
  55. * 校验参数合法性
  56. */
  57. public function check() {
  58. // TODO: wuyonghong 2018/5/30 校验游戏参数合法性
  59. return true;
  60. }
  61. /**
  62. * @return string
  63. */
  64. public function getPkgName() {
  65. return $this->pkg_name;
  66. }
  67. /**
  68. * @param string $pkg_name
  69. */
  70. public function setPkgName($pkg_name) {
  71. $this->pkg_name = $pkg_name;
  72. }
  73. /**
  74. * @return string
  75. */
  76. public function getAppVer() {
  77. return $this->app_ver;
  78. }
  79. /**
  80. * @param string $app_ver
  81. */
  82. public function setAppVer($app_ver) {
  83. $this->app_ver = $app_ver;
  84. }
  85. /**
  86. * @return int
  87. */
  88. public function getHVer() {
  89. return $this->h_ver;
  90. }
  91. /**
  92. * @param int $h_ver
  93. */
  94. public function setHVer($h_ver) {
  95. $this->h_ver = $h_ver;
  96. }
  97. /**
  98. * @return string
  99. */
  100. public function getSdkVer() {
  101. return $this->sdk_ver;
  102. }
  103. /**
  104. * @param string $sdk_ver
  105. */
  106. public function setSdkVer($sdk_ver) {
  107. $this->sdk_ver = $sdk_ver;
  108. }
  109. /**
  110. * @return int
  111. */
  112. public function getHAppId() {
  113. return $this->h_app_id;
  114. }
  115. /**
  116. * @param int $h_app_id
  117. */
  118. public function setHAppId($h_app_id) {
  119. $this->h_app_id = $h_app_id;
  120. }
  121. }