房间麦克风热点计数
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
776 B

2 years ago
package data
import (
"context"
"git.gz.internal.jumaiyx.cn/job/room-mike-hot-timer/internal/biz"
"git.gz.internal.jumaiyx.cn/job/room-mike-hot-timer/internal/data/model"
"git.gz.internal.jumaiyx.cn/pkg/log"
"github.com/pkg/errors"
"gorm.io/gorm"
)
type initValue struct {
data *Data
log log.Logger
}
func NewInitValue(data *Data, log log.Logger) biz.InitValueRepo {
return &initValue{
data: data,
log: log,
}
}
func (md *initValue) GetValue(ctx context.Context, ty int32) (int64, error) {
value := &model.InitValue{}
if err := md.data.db.Model(&model.InitValue{}).Where("type=?", ty).First(&value).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
md.log.Errorf("Get init value err:%v", err)
return 0, err
}
return value.Value, nil
}