bilibili-backup/app/service/bbq/topic/api/common.go
2019-04-22 02:59:20 +00:00

35 lines
797 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package api
import (
"context"
"encoding/json"
"go-common/library/log"
)
// Transform2Interface 转换成interface
func Transform2Interface(ctx context.Context, data []byte) (inter interface{}, err error) {
err = json.Unmarshal(data, &inter)
if err != nil {
log.Errorw(ctx, "log", "transform to interface fail", "data", string(data))
return
}
return
}
// 话题的状态
const (
TopicStateAvailable = 0
TopicStateUnAvailable = 1
TopicVideoStateAvailable = 0
TopicVideoStateUnAvailable = 1
)
// 话题热门类型的enum用于TopicInfo->HotType字段
// 开始时使用了hot_type但其实就是表示特殊的话题状态
const (
TopicHotTypeHot = 1 // 热门
TopicHotTypeHistory = 2 // 历史,暂时只有客户端使用
TopicHotTypeStick = 4 // 置顶
)