123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace App\Services\Vendor\Xunfei;
- /**
- * 讯飞语音转化文字
- */
- class XunFei
- {
- /**
- * 预处理方法
- */
- public function prepare($filesize, $fileBasename)
- {
- $extData = [
- 'file_len' => $filesize,
- 'file_name' => 'name.' . $fileBasename,
- 'slice_num' => 1,
- ];
- $xunfei = new Voice2Text();
- return $xunfei->prepare($extData);
- }
- /**
- * 上传方法
- */
- public function upload($taskId, $fileContent)
- {
- $extData = [
- 'task_id' => $taskId,
- 'slice_id' => 'aaaaaaaaaa',
- 'content' => $fileContent,
- ];
- $xunfei = new Voice2Text();
- return $xunfei->upload($extData);
- }
- /**
- * 合并文件
- */
- public function merge($taskId)
- {
- $extData = [
- 'task_id' => $taskId,
- ];
- $xunfei = new Voice2Text();
- return $xunfei->merge($extData);
- }
- /**
- * 获取进度
- */
- public function getProgress($taskId)
- {
- $extData = [
- 'task_id' => $taskId,
- ];
- $xunfei = new Voice2Text();
- return $xunfei->getProgress($extData);
- }
- /**
- * 获取结果
- */
- public function getResult($taskId)
- {
- $extData = [
- 'task_id' => $taskId,
- ];
- $xunfei = new Voice2Text();
- return $xunfei->getResult($extData);
- }
- }
|