UserInfo.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. /**
  3. * 用户个人信息
  4. * Date: 15-12-15
  5. * Time: 下午2:31
  6. */
  7. class UserInfo extends AbstractDataContent {
  8. public $guildId;//必填 用户加入的公会的ID 用户登录游戏成功后
  9. public $guildName;//必填 用户加入的公会的名称
  10. public $guildLevel;//必填 用户加入的公会的等级
  11. public $guildLeader;//必填 用户加入的公会的会长的账号ID
  12. public $zoneId;//必填 区服ID
  13. public $zoneName;//必填 区服名称
  14. public $power;//必填 个人战力值
  15. public $os;//必填 游戏平台 android或者ios,小写字母。默认为android
  16. public $roleId;//非必填 角色ID
  17. public $roleName;//非必填 角色昵称
  18. /**
  19. * @return mixed
  20. */
  21. public function getGuildId()
  22. {
  23. return $this->guildId;
  24. }
  25. /**
  26. * @param mixed $guildId
  27. */
  28. public function setGuildId($guildId)
  29. {
  30. $this->guildId = $guildId;
  31. }
  32. /**
  33. * @return mixed
  34. */
  35. public function getGuildName()
  36. {
  37. return $this->guildName;
  38. }
  39. /**
  40. * @param mixed $guildName
  41. */
  42. public function setGuildName($guildName)
  43. {
  44. $this->guildName = $guildName;
  45. }
  46. /**
  47. * @return mixed
  48. */
  49. public function getGuildLevel()
  50. {
  51. return $this->guildLevel;
  52. }
  53. /**
  54. * @param mixed $guildLevel
  55. */
  56. public function setGuildLevel($guildLevel)
  57. {
  58. $this->guildLevel = $guildLevel;
  59. }
  60. /**
  61. * @return mixed
  62. */
  63. public function getGuildLeader()
  64. {
  65. return $this->guildLeader;
  66. }
  67. /**
  68. * @param mixed $guildLeader
  69. */
  70. public function setGuildLeader($guildLeader)
  71. {
  72. $this->guildLeader = $guildLeader;
  73. }
  74. /**
  75. * @return mixed
  76. */
  77. public function getPower()
  78. {
  79. return $this->power;
  80. }
  81. /**
  82. * @param mixed $power
  83. */
  84. public function setPower($power)
  85. {
  86. $this->power = $power;
  87. }
  88. /**
  89. * @return mixed
  90. */
  91. public function getZoneId()
  92. {
  93. return $this->zoneId;
  94. }
  95. /**
  96. * @param mixed $zoneId
  97. */
  98. public function setZoneId($zoneId)
  99. {
  100. $this->zoneId = $zoneId;
  101. }
  102. /**
  103. * @return mixed
  104. */
  105. public function getZoneName()
  106. {
  107. return $this->zoneName;
  108. }
  109. /**
  110. * @param mixed $zoneName
  111. */
  112. public function setZoneName($zoneName)
  113. {
  114. $this->zoneName = $zoneName;
  115. }
  116. /**
  117. * @return mixed
  118. */
  119. public function getOs()
  120. {
  121. return $this->os;
  122. }
  123. /**
  124. * @param mixed $os
  125. */
  126. public function setOs($os)
  127. {
  128. $this->os = $os;
  129. }
  130. /**
  131. * @return mixed
  132. */
  133. public function getRoleId()
  134. {
  135. return $this->roleId;
  136. }
  137. /**
  138. * @param mixed $roleId
  139. */
  140. public function setRoleId($roleId)
  141. {
  142. $this->roleId = $roleId;
  143. }
  144. /**
  145. * @return mixed
  146. */
  147. public function getRoleName()
  148. {
  149. return $this->roleName;
  150. }
  151. /**
  152. * @param mixed $roleName
  153. */
  154. public function setRoleName($roleName)
  155. {
  156. $this->roleName = $roleName;
  157. }
  158. /**
  159. * 必填参数校验
  160. * @return
  161. * true:校验通过 false:有参数为空
  162. */
  163. public function validate()
  164. {
  165. if(!isset($this->guildId)){
  166. return false;
  167. }
  168. if(!isset($this->guildName)){
  169. return false;
  170. }
  171. if(!isset($this->guildLevel)){
  172. return false;
  173. }
  174. if(!isset($this->guildLeader)){
  175. return false;
  176. }
  177. if(!isset($this->zoneId)){
  178. return false;
  179. }
  180. if(!isset($this->zoneName)){
  181. return false;
  182. }
  183. if(!isset($this->power)){
  184. return false;
  185. }
  186. if(!$this->checkOs($this->os)){
  187. return false;
  188. }
  189. return true;
  190. }
  191. private function checkOs($roleOs){
  192. $osName = array("android", "ios");
  193. foreach ($osName as $tempOs) {
  194. if($roleOs == $tempOs){
  195. return true;
  196. }
  197. }
  198. return false;
  199. }
  200. }