StatusTransform.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Mead
  5. * Date: 2019/9/3
  6. * Time: 8:05 PM
  7. */
  8. namespace App\Servers\Weikemu\Transforms;
  9. use App\Models\BoxSettingTraitModel;
  10. use App\Models\WarningLogTraitModel;
  11. use App\Servers\BaseServer;
  12. /**
  13. * 状态报文
  14. * Class LoginServer
  15. * @package App\Servers
  16. */
  17. class StatusTransform extends BaseServer
  18. {
  19. use BoxSettingTraitModel, WarningLogTraitModel;
  20. public function main($body)
  21. {
  22. $data = $this->decode($body);
  23. return $this->response();
  24. }
  25. /**
  26. * 状态响应
  27. * @param $login_type
  28. * @return array
  29. * User: Mead
  30. */
  31. public function response($login_type = '00')
  32. {
  33. $body = [
  34. '5b',
  35. '0000'
  36. ];
  37. return $body;
  38. }
  39. /**
  40. * 解析装载的状态消息
  41. * @param $body
  42. * @return array
  43. * User: Mead
  44. */
  45. private function decode($body)
  46. {
  47. $top34Data = $this->decodeWeiKeMuTop34($body);
  48. // $i = 34;
  49. return $top34Data;
  50. }
  51. /**
  52. * 处理设备序列号
  53. * @param $no
  54. * @return bool|string
  55. * User: Mead
  56. */
  57. private
  58. static function box_no($no)
  59. {
  60. return substr($no, 0, 9);
  61. }
  62. }