TaskSystem/app/api/controller/XunFeiController.php
2023-09-12 12:36:32 +08:00

46 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use IFlytek\Xfyun\Speech\TcClient;
/**
* 讯飞
* Class WechatController
*/
class XunFeiController extends BaseApiController
{
public array $notNeedLogin = ['ceshi'];
private $app_id='2eda6c2e';
private $api_key='MDEyMzE5YTc5YmQ5NjMwOTU1MWY4N2Y2';
private $api_secret='12ec1f9d113932575fc4b114a2f60ffd';
public function ceshi()
{
// 这里的$app_id、$api_key、$api_secret是在开放平台控制台获得
$client = new TcClient($this->app_id, $this->api_key, $this->api_secret);
// 文本纠错请求返回格式为json字符串
$content = $client->request('历史上有很多注明的人物,其中唐太宗李世民就是一位。')->getBody()->getContents();
halt($content);
// 黑白名单上传请求成功返回true失败返回false失败请检查uid、res_id是否设置
// $client = new TcClient($this->app_id, $this->api_key, $api_secret, $uid, $res_id);
// $client->listUpload($white_list, $black_list);
}
}