12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package yb_community_question_audio
- import (
- "hongze/hongze_yb/global"
- )
- func (item *YbCommunityQuestionAudio) Create() (err error) {
- err = global.DEFAULT_MYSQL.Create(item).Error
- return
- }
- func GetListByQuestrionIds(idArr []int) (list []*YbCommunityQuestionAudio, err error) {
- if len(idArr) == 0 {
- return
- }
- err = global.DEFAULT_MYSQL.
- Model(YbCommunityQuestionAudio{}).
- Select("community_question_audio_id, community_question_id, audio_url, audio_play_seconds, audio_size, sort").
- Where("community_question_id IN ?", idArr).
- Order("community_question_id ASC, sort ASC").
- Scan(&list).Error
- return
- }
- func GetListByQuestionId(questionId int) (list []*YbCommunityQuestionAudio, err error) {
- err = global.DEFAULT_MYSQL.
- Model(YbCommunityQuestionAudio{}).
- Select("community_question_audio_id, community_question_id, audio_url, audio_play_seconds, audio_size, sort").
- Where("community_question_id = ?", questionId).
- Order("sort ASC").
- Scan(&list).Error
- return
- }
- // GetByAudioId 根据问答音频ID, 查询音频详情
- func GetByAudioId(audioId int)(item *YbCommunityQuestionAudio, err error) {
- err = global.DEFAULT_MYSQL.
- Model(YbCommunityQuestionAudio{}).
- Select("community_question_audio_id, community_question_id, audio_url, audio_play_seconds, audio_size, sort").
- Where("community_question_audio_id = ?", audioId).
- First(&item).Error
- return
- }
|