1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Mead
- * Date: 2019/9/3
- * Time: 8:05 PM
- */
- namespace App\Servers;
- class BoxPlayVoiceServer extends BaseServer
- {
- public function main($body)
- {
- $data = $this->decode($body);
- self::log($data, 'BoxPlayVoiceServer', self::$LOG_MAJOR);
- return false;
- }
- /**
- * 解析装载的数据
- * @param $body
- * @return array
- * User: Mead
- */
- private function decode($body)
- {
- $i = 0;
- // 时间
- $time = self::stitching($body, $i, 4);
- $i += 4;
- // 执行结果
- $result = self::stitching($body, $i, 1);
- $i += 1;
- // 提示音指令
- $voice_cmd = self::stitching($body, $i, 2);
- $i += 2;
- //MsgId
- $msg_id = self::stitching($body, $i);
- $time = $this->decodeTime($time);
- return [
- 'time' => $time,
- 'result' => $result,
- 'voice_cmd' => $voice_cmd,
- 'msg_id' => $msg_id,
- ];
- }
- }
|