Kaynağa Gözat

增加音频详情接口,返回解析的文字

zhangqian 2 yıl önce
ebeveyn
işleme
3eb829393c
13 değiştirilmiş dosya ile 285 ekleme ve 113 silme
  1. 1 1
      conf/config.yaml
  2. 27 0
      controllers/audio.go
  3. 6 6
      controllers/text.go
  4. 77 22
      docs/docs.go
  5. 77 22
      docs/swagger.json
  6. 50 18
      docs/swagger.yaml
  7. 2 0
      models/audio.go
  8. 1 1
      models/db.go
  9. 40 40
      models/text.go
  10. 1 1
      models/train.go
  11. 1 1
      request/audio.go
  12. 1 1
      response/audio.go
  13. 1 0
      router/router.go

+ 1 - 1
conf/config.yaml

@@ -1,5 +1,5 @@
 web:
-  port: 8102
+  port: 8203
   host: 192.168.20.119
 db:
   dsn: root:c++java123@tcp(192.168.20.119:3306)/speech_analysis?charset=utf8&parseTime=True&loc=Local

+ 27 - 0
controllers/audio.go

@@ -211,6 +211,33 @@ func (slf AudioCtl) Process(c *gin.Context) {
 	util.ResponseFormat(c, code.UpdateSuccess, "成功")
 }
 
+// AudioInfo
+// @Tags      音频
+// @Summary   音频详情,含解析结果
+// @Produce   application/json
+// @Param     object  query request.ProcessAudio true  "参数"
+// @Success   200 {object} util.Response{data=models.Audio} "成功"
+// @Router    /api-sa/v1/audio/info [get]
+func (slf AudioCtl) AudioInfo(c *gin.Context) {
+	var params request.ProcessAudio
+	if err := c.ShouldBindQuery(&params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, err.Error())
+		return
+	}
+
+	audio, err := models.NewAudioSearch().SetID(params.ID).First()
+	if err != nil {
+		util.ResponseFormat(c, code.InternalError, "请求失败")
+		return
+	}
+	audioText, err := models.NewAudioTextSearch().SetAudioID(audio.ID).First()
+	if err == nil {
+		audio.AudioText = audioText.AudioText
+	}
+
+	util.ResponseFormat(c, code.UpdateSuccess, audio)
+}
+
 // BatchProcess
 // @Tags      音频
 // @Summary   批量处理音频

+ 6 - 6
controllers/text.go

@@ -27,7 +27,7 @@ func (slf TextCtl) AddText(c *gin.Context) {
 		return
 	}
 
-	text := models.Text{
+	text := models.Word{
 		Content:          req.Content,
 		LocomotiveNumber: req.LocomotiveNumber,
 	}
@@ -37,7 +37,7 @@ func (slf TextCtl) AddText(c *gin.Context) {
 		return
 	}
 
-	if err := models.NewTextSearch().Create(&text); err != nil {
+	if err := models.NewWordSearch().Create(&text); err != nil {
 		util.ResponseFormat(c, code.SaveFail, "添加失败,请检查是否重复")
 		return
 	}
@@ -45,11 +45,11 @@ func (slf TextCtl) AddText(c *gin.Context) {
 	util.ResponseFormat(c, code.Success, "添加成功")
 }
 
-func (slf TextCtl) paramsCheck(text models.Text) (err error) {
+func (slf TextCtl) paramsCheck(text models.Word) (err error) {
 	if text.Content == "" || text.LocomotiveNumber == "" {
 		return errors.New("参数缺失")
 	}
-	_, err = models.NewTextSearch().SetLocomotiveNumber(text.LocomotiveNumber).SetContent(text.Content).First()
+	_, err = models.NewWordSearch().SetLocomotiveNumber(text.LocomotiveNumber).SetContent(text.Content).First()
 	if err == nil {
 		return errors.New("文字重复")
 	}
@@ -61,7 +61,7 @@ func (slf TextCtl) paramsCheck(text models.Text) (err error) {
 // @Summary   文字库列表
 // @Produce   application/json
 // @Param     object  query    request.GetTextList true  "参数"
-// @Success   200   {object}  util.ResponseList{data=[]models.Text}  "成功"
+// @Success   200   {object}  util.ResponseList{data=[]models.Word}  "成功"
 // @Router    /api-sa/v1/text/list [get]
 func (slf TextCtl) List(c *gin.Context) {
 	var params request.GetTextList
@@ -75,7 +75,7 @@ func (slf TextCtl) List(c *gin.Context) {
 		return
 	}
 
-	list, total, err := models.NewTextSearch().
+	list, total, err := models.NewWordSearch().
 		SetPage(params.Page, params.PageSize).
 		SetKeyword(params.Keyword).
 		Find()

+ 77 - 22
docs/docs.go

@@ -148,6 +148,45 @@ const docTemplate = `{
                 }
             }
         },
+        "/api-sa/v1/audio/info": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "音频"
+                ],
+                "summary": "音频详情,含解析结果",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Audio"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/api-sa/v1/audio/list": {
             "get": {
                 "produces": [
@@ -432,7 +471,7 @@ const docTemplate = `{
                                         "data": {
                                             "type": "array",
                                             "items": {
-                                                "$ref": "#/definitions/models.Text"
+                                                "$ref": "#/definitions/models.Word"
                                             }
                                         }
                                     }
@@ -525,6 +564,10 @@ const docTemplate = `{
                         }
                     ]
                 },
+                "audioText": {
+                    "description": "解析出的文本",
+                    "type": "string"
+                },
                 "createdAt": {
                     "type": "string"
                 },
@@ -575,15 +618,26 @@ const docTemplate = `{
                 },
                 "updatedAt": {
                     "type": "string"
+                },
+                "words": {
+                    "description": "匹配到的文字数组",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
-        "models.Text": {
+        "models.TrainInfo": {
             "type": "object",
             "properties": {
-                "content": {
-                    "description": "音频名称",
-                    "type": "string"
+                "class": {
+                    "description": "分类  1 机车 2车次 3 车站",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.Class"
+                        }
+                    ]
                 },
                 "createdAt": {
                     "type": "string"
@@ -594,25 +648,25 @@ const docTemplate = `{
                 "id": {
                     "type": "integer"
                 },
-                "locomotiveNumber": {
-                    "description": "机车号",
+                "name": {
+                    "description": "名称",
                     "type": "string"
                 },
+                "parentID": {
+                    "description": "上级id",
+                    "type": "integer"
+                },
                 "updatedAt": {
                     "type": "string"
                 }
             }
         },
-        "models.TrainInfo": {
+        "models.Word": {
             "type": "object",
             "properties": {
-                "class": {
-                    "description": "分类",
-                    "allOf": [
-                        {
-                            "$ref": "#/definitions/constvar.Class"
-                        }
-                    ]
+                "content": {
+                    "description": "文字",
+                    "type": "string"
                 },
                 "createdAt": {
                     "type": "string"
@@ -623,14 +677,10 @@ const docTemplate = `{
                 "id": {
                     "type": "integer"
                 },
-                "name": {
-                    "description": "名称",
+                "locomotiveNumber": {
+                    "description": "机车号",
                     "type": "string"
                 },
-                "parentID": {
-                    "description": "上级id",
-                    "type": "integer"
-                },
                 "updatedAt": {
                     "type": "string"
                 }
@@ -693,7 +743,12 @@ const docTemplate = `{
             "type": "object",
             "properties": {
                 "followStatus": {
-                    "$ref": "#/definitions/constvar.BoolType"
+                    "description": "1 已关注 2未关注",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.BoolType"
+                        }
+                    ]
                 }
             }
         },

+ 77 - 22
docs/swagger.json

@@ -136,6 +136,45 @@
                 }
             }
         },
+        "/api-sa/v1/audio/info": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "音频"
+                ],
+                "summary": "音频详情,含解析结果",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Audio"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/api-sa/v1/audio/list": {
             "get": {
                 "produces": [
@@ -420,7 +459,7 @@
                                         "data": {
                                             "type": "array",
                                             "items": {
-                                                "$ref": "#/definitions/models.Text"
+                                                "$ref": "#/definitions/models.Word"
                                             }
                                         }
                                     }
@@ -513,6 +552,10 @@
                         }
                     ]
                 },
+                "audioText": {
+                    "description": "解析出的文本",
+                    "type": "string"
+                },
                 "createdAt": {
                     "type": "string"
                 },
@@ -563,15 +606,26 @@
                 },
                 "updatedAt": {
                     "type": "string"
+                },
+                "words": {
+                    "description": "匹配到的文字数组",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
-        "models.Text": {
+        "models.TrainInfo": {
             "type": "object",
             "properties": {
-                "content": {
-                    "description": "音频名称",
-                    "type": "string"
+                "class": {
+                    "description": "分类  1 机车 2车次 3 车站",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.Class"
+                        }
+                    ]
                 },
                 "createdAt": {
                     "type": "string"
@@ -582,25 +636,25 @@
                 "id": {
                     "type": "integer"
                 },
-                "locomotiveNumber": {
-                    "description": "机车号",
+                "name": {
+                    "description": "名称",
                     "type": "string"
                 },
+                "parentID": {
+                    "description": "上级id",
+                    "type": "integer"
+                },
                 "updatedAt": {
                     "type": "string"
                 }
             }
         },
-        "models.TrainInfo": {
+        "models.Word": {
             "type": "object",
             "properties": {
-                "class": {
-                    "description": "分类",
-                    "allOf": [
-                        {
-                            "$ref": "#/definitions/constvar.Class"
-                        }
-                    ]
+                "content": {
+                    "description": "文字",
+                    "type": "string"
                 },
                 "createdAt": {
                     "type": "string"
@@ -611,14 +665,10 @@
                 "id": {
                     "type": "integer"
                 },
-                "name": {
-                    "description": "名称",
+                "locomotiveNumber": {
+                    "description": "机车号",
                     "type": "string"
                 },
-                "parentID": {
-                    "description": "上级id",
-                    "type": "integer"
-                },
                 "updatedAt": {
                     "type": "string"
                 }
@@ -681,7 +731,12 @@
             "type": "object",
             "properties": {
                 "followStatus": {
-                    "$ref": "#/definitions/constvar.BoolType"
+                    "description": "1 已关注 2未关注",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.BoolType"
+                        }
+                    ]
                 }
             }
         },

+ 50 - 18
docs/swagger.yaml

@@ -58,6 +58,9 @@ definitions:
         allOf:
         - $ref: '#/definitions/constvar.AudioStatus'
         description: 音频状态
+      audioText:
+        description: 解析出的文本
+        type: string
       createdAt:
         type: string
       deletedAt:
@@ -93,42 +96,47 @@ definitions:
         type: string
       updatedAt:
         type: string
+      words:
+        description: 匹配到的文字数组
+        items:
+          type: string
+        type: array
     type: object
-  models.Text:
+  models.TrainInfo:
     properties:
-      content:
-        description: 音频名称
-        type: string
+      class:
+        allOf:
+        - $ref: '#/definitions/constvar.Class'
+        description: 分类  1 机车 2车次 3 车站
       createdAt:
         type: string
       deletedAt:
         $ref: '#/definitions/gorm.DeletedAt'
       id:
         type: integer
-      locomotiveNumber:
-        description: 机车号
+      name:
+        description: 名称
         type: string
+      parentID:
+        description: 上级id
+        type: integer
       updatedAt:
         type: string
     type: object
-  models.TrainInfo:
+  models.Word:
     properties:
-      class:
-        allOf:
-        - $ref: '#/definitions/constvar.Class'
-        description: 分类
+      content:
+        description: 文字
+        type: string
       createdAt:
         type: string
       deletedAt:
         $ref: '#/definitions/gorm.DeletedAt'
       id:
         type: integer
-      name:
-        description: 名称
+      locomotiveNumber:
+        description: 机车号
         type: string
-      parentID:
-        description: 上级id
-        type: integer
       updatedAt:
         type: string
     type: object
@@ -170,7 +178,9 @@ definitions:
   response.FollowResp:
     properties:
       followStatus:
-        $ref: '#/definitions/constvar.BoolType'
+        allOf:
+        - $ref: '#/definitions/constvar.BoolType'
+        description: 1 已关注 2未关注
     type: object
   util.Response:
     properties:
@@ -278,6 +288,28 @@ paths:
       summary: 关注/取消关注
       tags:
       - 音频
+  /api-sa/v1/audio/info:
+    get:
+      parameters:
+      - in: query
+        name: id
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 成功
+          schema:
+            allOf:
+            - $ref: '#/definitions/util.Response'
+            - properties:
+                data:
+                  $ref: '#/definitions/models.Audio'
+              type: object
+      summary: 音频详情,含解析结果
+      tags:
+      - 音频
   /api-sa/v1/audio/list:
     get:
       parameters:
@@ -456,7 +488,7 @@ paths:
             - properties:
                 data:
                   items:
-                    $ref: '#/definitions/models.Text'
+                    $ref: '#/definitions/models.Word'
                   type: array
               type: object
       summary: 文字库列表

+ 2 - 0
models/audio.go

@@ -24,6 +24,8 @@ type (
 		OccurrenceTime   string               `json:"occurrenceTime" gorm:"-"`
 		IsFollowed       constvar.BoolType    `gorm:"type:tinyint;not null;default:2;comment:是否关注"` //是否关注 1关注 2未关注
 		Score            float64              `json:"score"`                                        // 置信度
+		Words            []string             `json:"words" gorm:"-"`                               //匹配到的文字数组
+		AudioText        string               `json:"audioText" gorm:"-"`                           //解析出的文本
 	}
 
 	AudioSearch struct {

+ 1 - 1
models/db.go

@@ -75,7 +75,7 @@ func RegisterTables() error {
 	err := db.AutoMigrate(
 		Audio{},
 		AudioText{},
-		Text{},
+		Word{},
 		TrainInfo{},
 	)
 	return err

+ 40 - 40
models/text.go

@@ -7,15 +7,15 @@ import (
 )
 
 type (
-	// Text 文字
-	Text struct {
+	// Word 文字
+	Word struct {
 		gorm.Model
-		Content          string `gorm:"uniqueIndex:locomotive_number_text;type:varchar(255);not null;default:'';comment:音频名称" json:"content"`         // 音频名称
-		LocomotiveNumber string `gorm:"uniqueIndex:locomotive_number_text;type:varchar(255);not null;default:'';comment:机车号" json:"locomotiveNumber"` // 机车号
+		Content          string `gorm:"uniqueIndex:locomotive_number_Word;type:varchar(255);not null;default:'';comment:音频名称" json:"content"`         // 文字
+		LocomotiveNumber string `gorm:"uniqueIndex:locomotive_number_Word;type:varchar(255);not null;default:'';comment:机车号" json:"locomotiveNumber"` // 机车号
 	}
 
-	TextSearch struct {
-		Text
+	WordSearch struct {
+		Word
 		Order    string
 		PageNum  int
 		PageSize int
@@ -25,55 +25,55 @@ type (
 	}
 )
 
-func (slf *Text) TableName() string {
-	return "text"
+func (slf *Word) TableName() string {
+	return "word"
 }
 
-func NewTextSearch() *TextSearch {
-	return &TextSearch{Orm: mysqlx.GetDB()}
+func NewWordSearch() *WordSearch {
+	return &WordSearch{Orm: mysqlx.GetDB()}
 }
 
-func (slf *TextSearch) SetOrm(tx *gorm.DB) *TextSearch {
+func (slf *WordSearch) SetOrm(tx *gorm.DB) *WordSearch {
 	slf.Orm = tx
 	return slf
 }
 
-func (slf *TextSearch) SetPage(page, size int) *TextSearch {
+func (slf *WordSearch) SetPage(page, size int) *WordSearch {
 	slf.PageNum, slf.PageSize = page, size
 	return slf
 }
 
-func (slf *TextSearch) SetOrder(order string) *TextSearch {
+func (slf *WordSearch) SetOrder(order string) *WordSearch {
 	slf.Order = order
 	return slf
 }
 
-func (slf *TextSearch) SetID(id uint) *TextSearch {
+func (slf *WordSearch) SetID(id uint) *WordSearch {
 	slf.ID = id
 	return slf
 }
 
-func (slf *TextSearch) SetIDs(ids []uint) *TextSearch {
+func (slf *WordSearch) SetIDs(ids []uint) *WordSearch {
 	slf.IDs = ids
 	return slf
 }
 
-func (slf *TextSearch) SetKeyword(kw string) *TextSearch {
+func (slf *WordSearch) SetKeyword(kw string) *WordSearch {
 	slf.Keyword = kw
 	return slf
 }
 
-func (slf *TextSearch) SetLocomotiveNumber(number string) *TextSearch {
+func (slf *WordSearch) SetLocomotiveNumber(number string) *WordSearch {
 	slf.LocomotiveNumber = number
 	return slf
 }
 
-func (slf *TextSearch) SetContent(content string) *TextSearch {
+func (slf *WordSearch) SetContent(content string) *WordSearch {
 	slf.Content = content
 	return slf
 }
 
-func (slf *TextSearch) build() *gorm.DB {
+func (slf *WordSearch) build() *gorm.DB {
 	var db = slf.Orm.Table(slf.TableName())
 
 	if slf.ID != 0 {
@@ -105,7 +105,7 @@ func (slf *TextSearch) build() *gorm.DB {
 }
 
 // Create 单条插入
-func (slf *TextSearch) Create(record *Text) error {
+func (slf *WordSearch) Create(record *Word) error {
 	var db = slf.build()
 
 	if err := db.Create(record).Error; err != nil {
@@ -116,7 +116,7 @@ func (slf *TextSearch) Create(record *Text) error {
 }
 
 // CreateBatch 批量插入
-func (slf *TextSearch) CreateBatch(records []*Text) error {
+func (slf *WordSearch) CreateBatch(records []*Word) error {
 	var db = slf.build()
 
 	if err := db.Create(&records).Error; err != nil {
@@ -126,7 +126,7 @@ func (slf *TextSearch) CreateBatch(records []*Text) error {
 	return nil
 }
 
-func (slf *TextSearch) Save(record *Text) error {
+func (slf *WordSearch) Save(record *Word) error {
 	var db = slf.build()
 
 	if err := db.Omit("CreatedAt").Save(record).Error; err != nil {
@@ -136,7 +136,7 @@ func (slf *TextSearch) Save(record *Text) error {
 	return nil
 }
 
-func (slf *TextSearch) UpdateByMap(upMap map[string]interface{}) error {
+func (slf *WordSearch) UpdateByMap(upMap map[string]interface{}) error {
 	var (
 		db = slf.build()
 	)
@@ -148,7 +148,7 @@ func (slf *TextSearch) UpdateByMap(upMap map[string]interface{}) error {
 	return nil
 }
 
-func (slf *TextSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error {
+func (slf *WordSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error {
 	var (
 		db = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
@@ -160,19 +160,19 @@ func (slf *TextSearch) UpdateByQuery(query string, args []interface{}, upMap map
 	return nil
 }
 
-func (slf *TextSearch) Delete() error {
+func (slf *WordSearch) Delete() error {
 	var db = slf.build()
 
-	if err := db.Delete(&Text{}).Error; err != nil {
+	if err := db.Delete(&Word{}).Error; err != nil {
 		return err
 	}
 
 	return nil
 }
 
-func (slf *TextSearch) First() (*Text, error) {
+func (slf *WordSearch) First() (*Word, error) {
 	var (
-		record = new(Text)
+		record = new(Word)
 		db     = slf.build()
 	)
 
@@ -183,9 +183,9 @@ func (slf *TextSearch) First() (*Text, error) {
 	return record, nil
 }
 
-func (slf *TextSearch) Find() ([]*Text, int, error) {
+func (slf *WordSearch) Find() ([]*Word, int, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		total   int64
 		db      = slf.build()
 	)
@@ -203,9 +203,9 @@ func (slf *TextSearch) Find() ([]*Text, int, error) {
 	return records, int(total), nil
 }
 
-func (slf *TextSearch) FindNotTotal() ([]*Text, error) {
+func (slf *WordSearch) FindNotTotal() ([]*Word, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		db      = slf.build()
 	)
 
@@ -220,9 +220,9 @@ func (slf *TextSearch) FindNotTotal() ([]*Text, error) {
 }
 
 // FindByQuery 指定条件查询.
-func (slf *TextSearch) FindByQuery(query string, args []interface{}) ([]*Text, int64, error) {
+func (slf *WordSearch) FindByQuery(query string, args []interface{}) ([]*Word, int64, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		total   int64
 		db      = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
@@ -241,9 +241,9 @@ func (slf *TextSearch) FindByQuery(query string, args []interface{}) ([]*Text, i
 }
 
 // FindAll 指定条件查询&不分页.
-func (slf *TextSearch) FindAll(query string, args []interface{}) ([]*Text, error) {
+func (slf *WordSearch) FindAll(query string, args []interface{}) ([]*Word, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		db      = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
 
@@ -255,7 +255,7 @@ func (slf *TextSearch) FindAll(query string, args []interface{}) ([]*Text, error
 }
 
 //// InitDefaultData 初始化数据
-//func (slf *TextSearch) InitDefaultData() error {
+//func (slf *WordSearch) InitDefaultData() error {
 //	var (
 //		db          = slf.Orm.Table(slf.TableName())
 //		total int64 = 0
@@ -266,7 +266,7 @@ func (slf *TextSearch) FindAll(query string, args []interface{}) ([]*Text, error
 //	if total != 0 {
 //		return nil
 //	}
-//	Texts := make([]*Text, 0, 3)
-//	Texts = append(Texts, &Text{Name: "财务部", Number: "cwb"})
-//	return slf.CreateBatch(Texts)
+//	Words := make([]*Word, 0, 3)
+//	Words = append(Words, &Word{Name: "财务部", Number: "cwb"})
+//	return slf.CreateBatch(Words)
 //}

+ 1 - 1
models/train.go

@@ -12,7 +12,7 @@ type (
 	TrainInfo struct {
 		gorm.Model
 		Name     string         `gorm:"type:varchar(255);not null;default:'';comment:名称" json:"name"` //名称
-		Class    constvar.Class `gorm:"type:tinyint;not null;default:0;comment:分类" json:"class"`      //分类
+		Class    constvar.Class `gorm:"type:tinyint;not null;default:0;comment:分类" json:"class"`      //分类  1 机车 2车次 3 车站
 		ParentID uint           `gorm:"type:int;not null;default 0; comment:上级id" json:"parentID"`    //上级id
 	}
 

+ 1 - 1
request/audio.go

@@ -12,7 +12,7 @@ type GetAudioList struct {
 }
 
 type ProcessAudio struct {
-	ID uint `json:"id" binding:"required"`
+	ID uint `json:"id" form:"id" binding:"required"`
 }
 
 type BatchProcessAudio struct {

+ 1 - 1
response/audio.go

@@ -3,5 +3,5 @@ package response
 import "speechAnalysis/constvar"
 
 type FollowResp struct {
-	FollowStatus constvar.BoolType `json:"followStatus"`
+	FollowStatus constvar.BoolType `json:"followStatus"` //1 已关注 2未关注
 }

+ 1 - 0
router/router.go

@@ -27,6 +27,7 @@ func NewRouter() *gin.Engine {
 	{
 		audioAPi.POST("upload", audioCtl.Upload)              // 上传音频
 		audioAPi.GET("list", audioCtl.List)                   // 音频检索
+		audioAPi.GET("info", audioCtl.AudioInfo)              // 音频详情
 		audioAPi.GET("trainInfoList", audioCtl.TrainInfoList) // 火车信息列表
 		audioAPi.POST("process", audioCtl.Process)            // 音频处理
 		audioAPi.POST("batchProcess", audioCtl.BatchProcess)  // 音频批量处理