fixed
This commit is contained in:
@@ -12,6 +12,7 @@ namespace app\index\controller;
|
||||
use app\api\controller\BaseCommonController;
|
||||
use app\api\logic\AudioRevertLogic;
|
||||
use app\api\logic\UserLogic;
|
||||
use IFlytek\Xfyun\Speech\LfasrClient;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\facade\Request;
|
||||
@@ -27,9 +28,38 @@ class Test extends BasePublicController
|
||||
{
|
||||
function test()
|
||||
{
|
||||
$xunfei_record_config = config('xunfei_record_config');
|
||||
$appId = $xunfei_record_config['appid'];
|
||||
$secretKey = $xunfei_record_config['secretKey'];
|
||||
|
||||
// 设置转写参数
|
||||
$lfasrConfig = [
|
||||
'hasParticiple' => 'true'
|
||||
//...
|
||||
];
|
||||
|
||||
dump($xunfei_record_config);
|
||||
// 这里的$app_id、$secret_key是在开放平台控制台获得
|
||||
$client = new LfasrClient($appId, $secretKey, $lfasrConfig);
|
||||
|
||||
dump($client);
|
||||
$filePath = Tools::get_root_path().'public/iseTest.mp3';
|
||||
dump($filePath);
|
||||
// $filePath为待转写的本地文件路径,返回taskId作为后续查询进度、获取结果操作的参数
|
||||
$taskId = $client->combineUpload($filePath);
|
||||
dump($taskId);
|
||||
|
||||
// 查询进度,json格式
|
||||
$progress = $client->getProgress($taskId)->getBody()->getContents();
|
||||
dump($progress);
|
||||
|
||||
// 获取结果,json格式
|
||||
$result = $client->getResult($taskId)->getBody()->getContents();
|
||||
dump($result);
|
||||
|
||||
|
||||
//(new AudioRevertLogic())->revert('asdsssssssssss','');
|
||||
(new AudioRevertLogic())->revert_test('asdsssssssssss','');
|
||||
//(new AudioRevertLogic())->revert_test('asdsssssssssss','');
|
||||
|
||||
//revert_test
|
||||
// 使用mt_rand()生成随机数
|
||||
|
||||
Reference in New Issue
Block a user