model

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAlbumDetail

func DecodeAlbumDetail(raw json.RawMessage) (*mmpb.Album, []*mmpb.Song, error)

DecodeAlbumDetail 解析专辑详情响应的原始 JSON。

func DecodeAlbumList

func DecodeAlbumList(raw json.RawMessage) ([]*mmpb.Album, error)

DecodeAlbumList 解析专辑列表响应,只取专辑数组(最新专辑等不带分页的接口用)。

func DecodeAlbumListWithMore

func DecodeAlbumListWithMore(raw json.RawMessage) ([]*mmpb.Album, bool, error)

DecodeAlbumListWithMore 解析带 more 标记的专辑列表响应(新碟上架用)。

func DecodeAlbumListWithTotal

func DecodeAlbumListWithTotal(raw json.RawMessage) ([]*mmpb.Album, int32, error)

DecodeAlbumListWithTotal 解析带 total 的专辑列表响应(全部新碟/收藏列表用)。

func DecodeArtistInfo

func DecodeArtistInfo(raw json.RawMessage) (*mmpb.Artist, []*mmpb.Song, error)

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

func DecodeWordLyric(blob string) (*mmpb.WordLyric, error)

DecodeWordLyric 把网易云逐字歌词文本(yrc)解析成结构化 WordLyric。

yrc 格式:每行 `[lineStartMs,lineDurMs](wordStartMs,wordDurMs,0)字(...)...` - 行头方括号标注行级时间戳 - 每字圆括号三元组 (startMs,durMs,0),第三字段为固定标记 - 字内间隙/标点可能 dur=0 blob 为空时返回空 WordLyric(无逐字歌词),不报错。

func MapAlbum

func MapAlbum(a rawAlbum) *mmpb.Album

MapAlbum 把网易云原始专辑结构转成 proto Album。

func MapAlbums

func MapAlbums(in []rawAlbum) []*mmpb.Album

MapAlbums 把网易云原始专辑数组转成 proto Album 列表。 新碟列表、收藏列表、最新专辑等列表接口复用。

func MapArtist

func MapArtist(a rawArtist) *mmpb.Artist

MapArtist 把网易云原始歌手结构转成 proto Artist。

func MapArtists

func MapArtists(in []rawArtist) []*mmpb.Artist

MapArtists 把网易云原始歌手数组转成 proto Artist 列表。

func MapPlaylist

func MapPlaylist(raw json.RawMessage) (*mmpb.Playlist, error)

MapPlaylist 把网易云原始歌单结构转成 proto Playlist。

func MapSong

func MapSong(s rawSong) *mmpb.Song

MapSong 把网易云原始歌曲结构转成 proto Song。

func MapSongs

func MapSongs(in []rawSong) []*mmpb.Song

MapSongs 把网易云原始歌曲数组转成 proto Song 列表。

func MapUser

func MapUser(u rawUser) *mmpb.User

MapUser 把网易云原始用户结构转成 proto User。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL