Documentation
¶
Overview ¶
Package model 的专辑实体映射与专辑详情解码。
Package model 的歌手实体映射与歌手详情解码。
Package model 的登录认证解码。
Package model 的歌单实体映射。
Package model 的每日推荐解码。
Package model 是网易云领域映射层。
每个领域实体定义「网易云原始 JSON 的 struct 镜像 + map 到 proto 的函数」, 写一次后全局复用。例如 MapSong 被歌曲详情、每日推荐、歌单曲目、专辑曲目、 搜索(单曲)等几十个接口复用。
这是「该复用的复用」的落点,把看似 357 次的映射塌缩为约 30 次领域映射 + 接口级组装。
Package model 的用户实体映射。
Package model 的用户详情解码。
Index ¶
- func DecodeAlbumDetail(raw json.RawMessage) (*mmpb.Album, []*mmpb.Song, error)
- func DecodeAlbumList(raw json.RawMessage) ([]*mmpb.Album, error)
- func DecodeAlbumListWithMore(raw json.RawMessage) ([]*mmpb.Album, bool, error)
- func DecodeAlbumListWithTotal(raw json.RawMessage) ([]*mmpb.Album, int32, error)
- func DecodeArtistInfo(raw json.RawMessage) (*mmpb.Artist, []*mmpb.Song, error)
- func DecodeDailyRecommend(raw json.RawMessage) ([]*mmpb.Song, error)
- func DecodeLoginResponse(raw json.RawMessage) (*mmpb.Session, error)
- func DecodePersonalFM(raw json.RawMessage) ([]*mmpb.Song, error)
- func DecodeQrcodeKey(raw json.RawMessage) (string, error)
- func DecodeQrcodeStatus(raw json.RawMessage) (mmpb.QrcodeCode, string, error)
- func DecodeRecommendNewSongs(raw json.RawMessage) ([]*mmpb.Song, error)
- func DecodeRecommendPlaylists(raw json.RawMessage) ([]*mmpb.Playlist, error)
- func DecodeSongDetail(raw json.RawMessage) ([]*mmpb.Song, error)
- func DecodeUserDetail(raw json.RawMessage) (*mmpb.UserDetail, error)
- func DecodeUserPlaylists(raw json.RawMessage, ownerUserID int64, filter mmpb.PlaylistFilter) ([]*mmpb.Playlist, int32, error)
- func DecodeUserSubCount(raw json.RawMessage) (*mmpb.UserSubCount, error)
- func DecodeWordLyric(blob string) (*mmpb.WordLyric, error)
- func MapAlbum(a rawAlbum) *mmpb.Album
- func MapAlbums(in []rawAlbum) []*mmpb.Album
- func MapArtist(a rawArtist) *mmpb.Artist
- func MapArtists(in []rawArtist) []*mmpb.Artist
- func MapPlaylist(raw json.RawMessage) (*mmpb.Playlist, error)
- func MapSong(s rawSong) *mmpb.Song
- func MapSongs(in []rawSong) []*mmpb.Song
- func MapUser(u rawUser) *mmpb.User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeAlbumDetail ¶
DecodeAlbumDetail 解析专辑详情响应的原始 JSON。
func DecodeAlbumList ¶
func DecodeAlbumList(raw json.RawMessage) ([]*mmpb.Album, error)
DecodeAlbumList 解析专辑列表响应,只取专辑数组(最新专辑等不带分页的接口用)。
func DecodeAlbumListWithMore ¶
DecodeAlbumListWithMore 解析带 more 标记的专辑列表响应(新碟上架用)。
func DecodeAlbumListWithTotal ¶
DecodeAlbumListWithTotal 解析带 total 的专辑列表响应(全部新碟/收藏列表用)。
func DecodeArtistInfo ¶
DecodeArtistInfo 解析歌手详情响应的原始 JSON。
func DecodeDailyRecommend ¶
func DecodeDailyRecommend(raw json.RawMessage) ([]*mmpb.Song, error)
DecodeDailyRecommend 解析每日推荐响应的原始 JSON。
func DecodeLoginResponse ¶
func DecodeLoginResponse(raw json.RawMessage) (*mmpb.Session, error)
DecodeLoginResponse 解析登录响应,提取用户信息(不含 cookie,cookie 由 service 层从 Set-Cookie 取)。
func DecodePersonalFM ¶
func DecodePersonalFM(raw json.RawMessage) ([]*mmpb.Song, error)
DecodePersonalFM 解析私人 FM 响应的原始 JSON。
func DecodeQrcodeKey ¶
func DecodeQrcodeKey(raw json.RawMessage) (string, error)
DecodeQrcodeKey 解析二维码 key 获取响应。
func DecodeQrcodeStatus ¶
func DecodeQrcodeStatus(raw json.RawMessage) (mmpb.QrcodeCode, string, error)
DecodeQrcodeStatus 解析二维码轮询响应。
func DecodeRecommendNewSongs ¶
func DecodeRecommendNewSongs(raw json.RawMessage) ([]*mmpb.Song, error)
DecodeRecommendNewSongs 解析推荐新音乐响应(歌曲嵌在 result[i].song 下,字段用全名)。
func DecodeRecommendPlaylists ¶
func DecodeRecommendPlaylists(raw json.RawMessage) ([]*mmpb.Playlist, error)
DecodeRecommendPlaylists 解析推荐歌单列表响应(兼容 recommend/result 两种字段名)。
func DecodeSongDetail ¶
func DecodeSongDetail(raw json.RawMessage) ([]*mmpb.Song, error)
DecodeSongDetail 解析歌曲详情响应的原始 JSON。
func DecodeUserDetail ¶
func DecodeUserDetail(raw json.RawMessage) (*mmpb.UserDetail, error)
DecodeUserDetail 解析用户详情响应。
func DecodeUserPlaylists ¶
func DecodeUserPlaylists(raw json.RawMessage, ownerUserID int64, filter mmpb.PlaylistFilter) ([]*mmpb.Playlist, int32, error)
DecodeUserPlaylists 解析用户歌单列表响应。 filter 按 creator.userId == ownerUserID 判断创建/收藏。 ownerUserID 为 0 时按网易云返回顺序原样返回(无法判断创建/收藏)。
func DecodeUserSubCount ¶
func DecodeUserSubCount(raw json.RawMessage) (*mmpb.UserSubCount, error)
DecodeUserSubCount 解析用户数量统计响应。
func DecodeWordLyric ¶
DecodeWordLyric 把网易云逐字歌词文本(yrc)解析成结构化 WordLyric。
yrc 格式:每行 `[lineStartMs,lineDurMs](wordStartMs,wordDurMs,0)字(...)...` - 行头方括号标注行级时间戳 - 每字圆括号三元组 (startMs,durMs,0),第三字段为固定标记 - 字内间隙/标点可能 dur=0 blob 为空时返回空 WordLyric(无逐字歌词),不报错。
func MapArtists ¶
MapArtists 把网易云原始歌手数组转成 proto Artist 列表。
func MapPlaylist ¶
func MapPlaylist(raw json.RawMessage) (*mmpb.Playlist, error)
MapPlaylist 把网易云原始歌单结构转成 proto Playlist。
Types ¶
This section is empty.