From 774158ff1644cacc279d84115cc8aaeb40589ce3 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 12 一月 2021 11:30:35 +0800
Subject: [PATCH] 调整DoDelete的参数问题

---
 voiceApi.go |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/voiceApi.go b/voiceApi.go
index 2043436..8297558 100644
--- a/voiceApi.go
+++ b/voiceApi.go
@@ -41,4 +41,43 @@
 	bytes, _ := json.Marshal(res.Data)
 	err = json.Unmarshal(bytes, &voiceArr)
 	return res.Success, voiceArr
-}
\ No newline at end of file
+}
+
+func (api VoiceApi) Add(id,name,mp3File,g711aFile string) (bool, interface{}) {
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/voice/add"
+	client := NewClient()
+    paramBody := map[string]interface{}{
+        "id": id,
+        "name": name,
+        "mp3File": mp3File,
+        "g711aFile": g711aFile,
+    }
+	respBody, err := client.DoPostRequest(url,CONTENT_TYPE_FORM, paramBody, nil, nil)
+	if err !=nil {
+		return false, nil
+	}
+	var res Result
+	if err = json.Unmarshal(respBody, &res); err != nil {
+		logPrint(err)
+		return false, nil
+	}
+	return res.Success, res.Data 
+}
+
+func (api VoiceApi) Del(id string) (bool, interface{}) {
+    url := api.getBasicUrl() + DATA_URL_PREFIX + "/voice/del"
+    client := NewClient()
+    paramQuery := map[string]string {
+        "id": id,
+    }
+    respBody, err := client.DoDeleteRequest(url,CONTENT_TYPE_FORM, nil, paramQuery, nil)
+    if err !=nil {
+        return false, nil
+    }
+    var res Result
+    if err = json.Unmarshal(respBody, &res); err != nil {
+        logPrint(err)
+        return false, nil
+    }
+    return res.Success, res.Data
+}

--
Gitblit v1.8.0