BoxSettingServer.php 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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;
  9. use App\Models\CacheLogTraitModel;
  10. class BoxSettingServer extends BaseServer
  11. {
  12. use CacheLogTraitModel;
  13. public function main($body)
  14. {
  15. $data = $this->decode($body);
  16. $this->cacheLog($data['msg_id'], $data['setting']);
  17. self::log($data, 'BoxSettingServer', self::$LOG_MAJOR);
  18. return false;
  19. }
  20. /**
  21. * 解析装载的数据
  22. * @param $body
  23. * @return array
  24. * User: Mead
  25. */
  26. private function decode($body)
  27. {
  28. list($setting, $msg) = explode(BikeControl::SPLIT_TAG, implode('', $body));
  29. // $msg = $this->decodeMsgId($msg);
  30. $setting = $this->decodeSetting($setting);
  31. return [
  32. 'setting' => $setting,
  33. 'msg_id' => $msg,
  34. ];
  35. }
  36. }