|
@@ -20,18 +20,25 @@ class Index extends BaseController{
|
|
|
|
|
|
//创建任务
|
|
|
public function addtaskone(){
|
|
|
+ $token = $_GET['token'];
|
|
|
+ if($token != md5('TeasxTyts@sg'.date('Y-m-d'))){
|
|
|
+ $res = array('error' => 1, 'errortip' => '验证失效', 'result' => array());
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
+ }
|
|
|
+
|
|
|
$overview = $_GET['overview'];
|
|
|
$audiourl = $_GET['audiourl'];
|
|
|
+ $taskKey = $_GET['TaskKey'];
|
|
|
if(!$overview){
|
|
|
- echo "请传入音频解析方向的描述";
|
|
|
- die;
|
|
|
+ $res = array('error' => 1, 'errortip' => '请传入音频解析方向的描述', 'result' => array());
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}
|
|
|
if(!$audiourl){
|
|
|
- echo "请传入音频文件链接";
|
|
|
- die;
|
|
|
+ $res = array('error' => 1, 'errortip' => '请传入音频文件链接', 'result' => array());
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}
|
|
|
|
|
|
- $taskone = $this->createTaskOneInfo($audiourl,$overview);
|
|
|
+ $taskone = $this->createTaskOneInfo($audiourl,$overview,$taskKey);
|
|
|
// print_r($taskone);
|
|
|
//判断返回输出结果
|
|
|
if($taskone['body']['Code'] == '0' && $taskone['body']['Message'] == 'success'){
|
|
@@ -41,11 +48,11 @@ class Index extends BaseController{
|
|
|
$result['TaskStatus'] = $taskone['body']['Data']['TaskStatus'];
|
|
|
|
|
|
$res = array('error' => 0, 'errortip' => '任务创建成功', 'result' => $result);
|
|
|
- exit(json_encode($res,1));
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}else{
|
|
|
$result = array();
|
|
|
$res = array('error' => 1, 'errortip' => '任务创建失败', 'result' => $result);
|
|
|
- exit(json_encode($res,1));
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}
|
|
|
print_r($result);
|
|
|
die;
|
|
@@ -53,10 +60,15 @@ class Index extends BaseController{
|
|
|
}
|
|
|
//解析任务-
|
|
|
public function gettaskinfo(){
|
|
|
+ $token = $_GET['token'];
|
|
|
+ if($token != md5('TeasxTyts@sg'.date('Y-m-d'))){
|
|
|
+ $res = array('error' => 1, 'errortip' => '验证失效', 'result' => array());
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
+ }
|
|
|
$taskid = $_GET['taskid'];
|
|
|
if(!$taskid){
|
|
|
- echo "请传入听悟任务的ID";
|
|
|
- die;
|
|
|
+ $res = array('error' => 1, 'errortip' => '请传入听悟任务的ID', 'result' => array());
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}
|
|
|
|
|
|
$taskone = $this->getTaskOneInfo($taskid);
|
|
@@ -71,11 +83,11 @@ class Index extends BaseController{
|
|
|
$result['Result']['CustomPrompt'] = $taskone['body']['Data']['Result']['CustomPrompt']?$taskone['body']['Data']['Result']['CustomPrompt']:'';
|
|
|
|
|
|
$res = array('error' => 0, 'errortip' => '任务解析成功', 'result' => $result);
|
|
|
- exit(json_encode($res,1));
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}else{
|
|
|
$result = array();
|
|
|
$res = array('error' => 1, 'errortip' => '任务解析失败', 'result' => $result);
|
|
|
- exit(json_encode($res,1));
|
|
|
+ exit(json_encode($res,JSON_UNESCAPED_UNICODE));
|
|
|
}
|
|
|
print_r($result);
|
|
|
die;
|
|
@@ -131,7 +143,7 @@ class Index extends BaseController{
|
|
|
* @param string[] $args
|
|
|
* @return void
|
|
|
*/
|
|
|
- public static function createTaskOneInfo($audiourl='',$overview=''){
|
|
|
+ public static function createTaskOneInfo($audiourl='',$overview='',$taskKey=''){
|
|
|
$client = self::createClient();
|
|
|
$params = self::createTaskApiInfo();
|
|
|
// query params
|
|
@@ -164,7 +176,7 @@ class Index extends BaseController{
|
|
|
|
|
|
$inputone = array();
|
|
|
$inputone['SourceLanguage'] = 'cn';
|
|
|
- $inputone['TaskKey'] = 'task'.'123123'.time();
|
|
|
+ $inputone['TaskKey'] = $taskKey?$taskKey:'task'.time();
|
|
|
$inputone['FileUrl'] = $audiourl?$audiourl:'https://crmapi.kedingdang.com/Intentionclient/getHuijieCallidRecordingFile?callid=9903ca31-b0c5-4d9b-aad1-cd6f97f87c43';
|
|
|
|
|
|
//设置数据项 - - 第二层
|