feat(app): update
This commit is contained in:
@ -75,7 +75,7 @@ func TransAudioToText(fileUrl string) (result string, err error) {
|
||||
fmt.Println("录音文件识别请求失败,Http错误码: ", postResponse.GetHttpStatus())
|
||||
return
|
||||
}
|
||||
var postMapResult map[string]interface{}
|
||||
var postMapResult map[string]any
|
||||
err = json.Unmarshal([]byte(postResponseContent), &postMapResult)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -111,7 +111,7 @@ func TransAudioToText(fileUrl string) (result string, err error) {
|
||||
fmt.Println("识别结果查询请求失败,Http错误码:", getResponse.GetHttpStatus())
|
||||
break
|
||||
}
|
||||
var getMapResult map[string]interface{}
|
||||
var getMapResult map[string]any
|
||||
err = json.Unmarshal([]byte(getResponseContent), &getMapResult)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -120,11 +120,11 @@ func TransAudioToText(fileUrl string) (result string, err error) {
|
||||
if statusText == STATUS_RUNNING || statusText == STATUS_QUEUEING {
|
||||
time.Sleep(10 * time.Second)
|
||||
} else if statusText == STATUS_SUCCESS {
|
||||
var resResult = getMapResult[KEY_RESULT].(map[string]interface{})
|
||||
fmt.Println("result:", resResult["Sentences"].([]interface{}))
|
||||
ss := resResult["Sentences"].([]interface{})
|
||||
var resResult = getMapResult[KEY_RESULT].(map[string]any)
|
||||
fmt.Println("result:", resResult["Sentences"].([]any))
|
||||
ss := resResult["Sentences"].([]any)
|
||||
for _, seg := range ss {
|
||||
item := seg.(map[string]interface{})
|
||||
item := seg.(map[string]any)
|
||||
result += item["Text"].(string)
|
||||
}
|
||||
break
|
||||
|
||||
@ -44,7 +44,7 @@ func Get(url string) (response string) {
|
||||
// 发送POST请求
|
||||
// url:请求地址,data:POST请求提交的数据,contentType:请求体格式,如:application/json
|
||||
// response:请求返回的内容
|
||||
func Post(url string, data interface{}, header map[string]string) (response string) {
|
||||
func Post(url string, data any, header map[string]string) (response string) {
|
||||
jsonStr, _ := json.Marshal(data)
|
||||
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
|
||||
if err != nil {
|
||||
|
||||
@ -78,7 +78,7 @@ func ListToSet(list []string) (set []string) {
|
||||
return
|
||||
}
|
||||
|
||||
func ToJson(source interface{}) []byte {
|
||||
func ToJson(source any) []byte {
|
||||
b, _ := json.Marshal(source)
|
||||
return b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user