| | |
| | | SetTrainNumber(params.TrainNumber). |
| | | SetDriverNumber(params.DriverNumber). |
| | | SetStation(params.StationNumber). |
| | | SetBeginTime(params.BeginTime). |
| | | SetEndTime(params.EndTime). |
| | | SetIsFollowed(params.IsFollowed). |
| | | Find() |
| | | |
| | | if err != nil { |
| | |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "开始时间", |
| | | "name": "beginTime", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "司机号", |
| | | "name": "driverNumber", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "结束时间", |
| | | "name": "endTime", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "type": "integer", |
| | | "x-enum-comments": { |
| | | "BoolTypeFalse": "false", |
| | | "BoolTypeTrue": "true" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "BoolTypeTrue", |
| | | "BoolTypeFalse" |
| | | ], |
| | | "description": "是否关注 1关注 2未关注", |
| | | "name": "isFollowed", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "关键字", |
| | | "name": "keyword", |
| | | "in": "query" |
| | |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "开始时间", |
| | | "name": "beginTime", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "司机号", |
| | | "name": "driverNumber", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "结束时间", |
| | | "name": "endTime", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "type": "integer", |
| | | "x-enum-comments": { |
| | | "BoolTypeFalse": "false", |
| | | "BoolTypeTrue": "true" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "BoolTypeTrue", |
| | | "BoolTypeFalse" |
| | | ], |
| | | "description": "是否关注 1关注 2未关注", |
| | | "name": "isFollowed", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "关键字", |
| | | "name": "keyword", |
| | | "in": "query" |
| | |
| | | /api-sa/v1/audio/list: |
| | | get: |
| | | parameters: |
| | | - description: 开始时间 |
| | | in: query |
| | | name: beginTime |
| | | type: string |
| | | - description: 司机号 |
| | | in: query |
| | | name: driverNumber |
| | | type: string |
| | | - description: 结束时间 |
| | | in: query |
| | | name: endTime |
| | | type: string |
| | | - description: 是否关注 1关注 2未关注 |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | in: query |
| | | name: isFollowed |
| | | type: integer |
| | | x-enum-comments: |
| | | BoolTypeFalse: "false" |
| | | BoolTypeTrue: "true" |
| | | x-enum-varnames: |
| | | - BoolTypeTrue |
| | | - BoolTypeFalse |
| | | - description: 关键字 |
| | | in: query |
| | | name: keyword |
| | |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | IDs []uint |
| | | BeginTime time.Time |
| | | EndTime time.Time |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AudioSearch) SetBeginTime(time time.Time) *AudioSearch { |
| | | slf.BeginTime = time |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AudioSearch) SetEndTime(time time.Time) *AudioSearch { |
| | | slf.EndTime = time |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AudioSearch) SetIsFollowed(isFollowed constvar.BoolType) *AudioSearch { |
| | | slf.IsFollowed = isFollowed |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AudioSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | |
| | | db = db.Where("id in ?", slf.IDs) |
| | | } |
| | | |
| | | if !slf.BeginTime.IsZero() { |
| | | db = db.Where("occurrence_at >= ?", slf.BeginTime) |
| | | } |
| | | |
| | | if !slf.EndTime.IsZero() { |
| | | db = db.Where("occurrence_at <= ?", slf.EndTime) |
| | | } |
| | | |
| | | if slf.IsFollowed != 0 { |
| | | db = db.Where("is_followed = ?", slf.IsFollowed) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | |
| | | package request |
| | | |
| | | import "speechAnalysis/constvar" |
| | | import ( |
| | | "speechAnalysis/constvar" |
| | | "time" |
| | | ) |
| | | |
| | | type GetAudioList struct { |
| | | PageInfo |
| | |
| | | TrainNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:车次" form:"trainNumber"` // 车次 |
| | | DriverNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:司机号" form:"driverNumber"` // 司机号 |
| | | StationNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:车站号" form:"stationNumber"` // 车站号 |
| | | BeginTime time.Time `json:"beginTime"` //开始时间 |
| | | EndTime time.Time `json:"endTime"` //结束时间 |
| | | IsFollowed constvar.BoolType `json:"isFollowed"` //是否关注 1关注 2未关注 |
| | | } |
| | | |
| | | type ProcessAudio struct { |