CheckinOption.class.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?php
  2. include_once(__DIR__."/../../utils/Utils.class.php");
  3. class CheckinOption
  4. {
  5. public $info = null; // CheckinInfo array
  6. static public function ParseFromArray($arr)
  7. {
  8. $info = new CheckinOption();
  9. foreach($arr["info"] as $item) {
  10. $info->info[] = CheckinInfo::ParseFromArray($item);
  11. }
  12. return $info;
  13. }
  14. }
  15. // ---------------------------------------------------------------------------
  16. class CheckinInfo
  17. {
  18. public $userid = null; // string
  19. public $group = null; // CheckinGroup
  20. static public function ParseFromArray($arr)
  21. {
  22. $info = new CheckinInfo();
  23. $info->userid = Utils::arrayGet($arr, "userid");
  24. $info->group = CheckinGroup::ParseFromArray($arr["group"]);
  25. return $info;
  26. }
  27. }
  28. class CheckinGroup {
  29. public $grouptype = null; // uint, 1 固定 2自定义 3自由签到
  30. public $groupid = null; // uint,
  31. public $checkindate = null; // CheckinDate array
  32. public $spe_workdays = null; // SpeWorkDays array
  33. public $spe_offdays = null; // SpeOffDays array
  34. public $sync_holidays = null; // bool, default true
  35. public $groupname = null; // string
  36. public $need_photo = null; // bool
  37. public $wifimac_infos = null; // WifiMacInfo array
  38. public $note_can_use_local_pic = null; // bool
  39. public $allow_checkin_offworkday = null; // bool
  40. public $allow_apply_offworkday = null; // bool
  41. public $loc_infos = null; // LocInfo array
  42. public static function ParseFromArray($arr)
  43. {
  44. $info = new CheckinGroup();
  45. $info->grouptype = Utils::arrayGet($arr, "grouptype");
  46. $info->groupid = Utils::arrayGet($arr, "groupid");
  47. foreach($arr["checkindate"] as $item) {
  48. $info->checkindate[] = CheckinDate::ParseFromArray($item);
  49. }
  50. foreach($arr["spe_workdays"] as $item) {
  51. $info->spe_workdays[] = SpeWorkDays::ParseFromArray($item);
  52. }
  53. foreach($arr["spe_offdays"] as $item) {
  54. $info->spe_offdays[] = SpeOffDays::ParseFromArray($item);
  55. }
  56. $info->sync_holidays = Utils::arrayGet($arr, "sync_holidays");
  57. $info->groupname = Utils::arrayGet($arr, "groupname");
  58. $info->need_photo = Utils::arrayGet($arr, "need_photo");
  59. foreach($arr["wifimac_infos"] as $item) {
  60. $info->wifimac_infos[] = WifiMacInfo::ParseFromArray($item);
  61. }
  62. $info->note_can_use_local_pic = Utils::arrayGet($arr, "note_can_use_local_pic");
  63. $info->allow_checkin_offworkday = Utils::arrayGet($arr, "allow_checkin_offworkday");
  64. $info->allow_apply_offworkday = Utils::arrayGet($arr, "allow_apply_offworkday");
  65. foreach($arr["loc_infos"] as $item) {
  66. $info->loc_infos[] = LocInfo::ParseFromArray($item);
  67. }
  68. return $info;
  69. }
  70. }
  71. class CheckinTime {
  72. public $work_sec = null; // int
  73. public $off_work_sec = null; // int
  74. public $remind_work_sec = null; // int
  75. public $remind_off_work_sec = null; // int
  76. public static function ParseFromArray($arr)
  77. {
  78. $info = new CheckinTime();
  79. $info->work_sec = Utils::arrayGet($arr, "work_sec");
  80. $info->off_work_sec = Utils::arrayGet($arr, "off_work_sec");
  81. $info->remind_work_sec = Utils::arrayGet($arr, "remind_work_sec");
  82. $info->remind_off_work_sec = Utils::arrayGet($arr, "remind_off_work_sec");
  83. return $info;
  84. }
  85. }
  86. class CheckinDate {
  87. public $workdays = null; // int array
  88. public $checkintime = null; // CheckinTime array
  89. public $flex_time = null; // int
  90. public $noneed_offwork = null; // bool
  91. public $limit_aheadtime = null; // uint
  92. public static function ParseFromArray($arr)
  93. {
  94. $info = new CheckinDate();
  95. $info->workdays = Utils::arrayGet($arr, "workdays");
  96. foreach($arr["checkintime"] as $item) {
  97. $info->checkintime[] = CheckinTime::ParseFromArray($item);
  98. }
  99. $info->flex_time = Utils::arrayGet($arr, "flex_time");
  100. $info->noneed_offwork = Utils::arrayGet($arr, "noneed_offwork");
  101. $info->limit_aheadtime = Utils::arrayGet($arr, "limit_aheadtime");
  102. return $info;
  103. }
  104. }
  105. class SpeWorkDays {
  106. public $timestamp = null; // uint
  107. public $notes = null; // string
  108. public $checkintime = null; // CheckinTime array
  109. public static function ParseFromArray($arr)
  110. {
  111. $info = new SpeWorkDays();
  112. $info->timestamp = Utils::arrayGet($arr, "timestamp");
  113. $info->notes = Utils::arrayGet($arr, "notes");
  114. foreach($arr["checkintime"] as $item) {
  115. $info->checkintime[] = CheckinTime::ParseFromArray($item);
  116. }
  117. return $info;
  118. }
  119. }
  120. class SpeOffDays {
  121. public $timestamp = null; // uint
  122. public $notes = null; // string
  123. public $checkintime = null; // CheckinTime array
  124. public static function ParseFromArray($arr)
  125. {
  126. $info = new SpeOffDays();
  127. $info->timestamp = Utils::arrayGet($arr, "timestamp");
  128. $info->notes = Utils::arrayGet($arr, "notes");
  129. foreach($arr["checkintime"] as $item) {
  130. $info->checkintime[] = CheckinTime::ParseFromArray($item);
  131. }
  132. return $info;
  133. }
  134. }
  135. class WifiMacInfo {
  136. public $wifiname = null; // string
  137. public $wifimac = null; // string
  138. public static function ParseFromArray($arr)
  139. {
  140. $info = new WifiMacInfo();
  141. $info->wifiname = Utils::arrayGet($arr, "wifiname");
  142. $info->wifimac = Utils::arrayGet($arr, "wifimac");
  143. return $info;
  144. }
  145. }
  146. class LocInfo {
  147. public $lat = null; // uint
  148. public $lng = null; // uint
  149. public $loc_title = null; // string
  150. public $loc_detail = null; // string
  151. public $distance = null; // uint
  152. public static function ParseFromArray($arr)
  153. {
  154. $info = new LocInfo();
  155. $info->lat = Utils::arrayGet($arr, "lat");
  156. $info->lng = Utils::arrayGet($arr, "lng");
  157. $info->loc_title = Utils::arrayGet($arr, "loc_title");
  158. $info->loc_detail = Utils::arrayGet($arr, "loc_detail");
  159. $info->distance = Utils::arrayGet($arr, "distance");
  160. return $info;
  161. }
  162. }