微信小程序开发 - WMusicPlayer服务端设计

使用 java 原生的servlet技术方案,并未使用任何框架

servlet


  • AudioSelectServlet

    • 作用:获取播放音乐的音频流

    • 请求参数:songid

    • 返回值:audioStream

      response.setHeader("Content-Type", "audio/mpeg");

  • songSelectServlet

    • 作用:根据歌曲id查询歌曲的具体信息

    • 请求参数:歌曲id

    • 返回值:JSON

      namesingerlengthcoverUrlaudioUrl
      歌曲名称歌手时常封面url音频流url
  • SheetSelectServlet

    • 作用:获取歌单的详细信息及其包含的歌曲

    • 请求参数:sheetid

    • 返回值:JSON

      nameuseridcoverUrlsonglistdata
      歌单名称歌单所有者的id封面url歌单中所有歌曲的id,name,singer组成的列表歌单最后更新日期
  • SheetlistSelectServlet

    • 作用:获取所有歌单

    • 请求参数:NULL

    • 返回值:JSON

      sheetlist,每一项:

      sheetidnamecoverUrltopSonglist
      歌单id歌单名称歌单封面歌单前三首歌曲的name,singer组成的列表
  • IndexSelectServlet

    • 作用:获取填充首页所需要的信息

    • 请求参数:NULL

    • 返回值:JSON

      bestSheetlistnewSonglisthotSonglist
      最受欢迎的前三个歌单列表,包含sheetid,name,coverUrl,topSonglist最新发布的前六首歌曲,包含songid,name,singer,coverUrl收听最多的前六首歌曲,包含songid,name,singer,coverUrl
  • UserLoginServlet

    • 作用:用户登录

    • 请求参数:userName,password

    • 返回值:JSON

      errMsg
      “ok” / “failed”
  • UserRegisterServlet

    • 作用:用户注册

    • 请求参数:userName,password,email

    • 返回值:JSON

      errMsg
      “ok” / “failed”
  • CommentSelectServlet

    • 作用:获取用户对歌曲的评价

    • 请求参数:songid

    • 返回值:JSON

      commentlist,每一项:

      iduserAvatarUrluserNamecontentdatethumbUpthumbDown
      评论id用户头像url用户名评论内容评论日期点赞反对
  • CommentUpdateServlet

    • 作用:用户更新评论,点赞 / 反对 / 删除

    • 请求参数:commentid,mode(1/ -1/ 0 - 点赞 / 反对 / 删除)

    • 返回值:JSON

      errMsg
      “ok” / “failed”

model


  • Song

    idnamesingerlengthcoverUrlaudioUrldatehot
    uintstringstringuintstringstringstringuint
  • Sheet

    idnameuseridcoverUrldatehot
    uintstringuintstringstringuint
  • SheetMap

    idsheetidsongid
    uintuintuint
  • User

    idopenidnameavatarUrl
    uintStringstringstring
  • Comment

    idsongiduseridcontentdatethumbUpthumbDown
    uintuintuintstringstringuintuint

dao


  • SongDao

    • public int insert(Song song) throws SQLException;

    • public Song SelectById(int id) throws SQLException;

  • SheetDao

  • SonglistDao

  • UserDao

  • CommentDao

filter


  • EncodingFilter

util

  • DBUtil

config


  • source.properties

    source.audioBasePath
    source.sheetCoverBasePath
    source.songCoverBasePath
    source.userAvatarBasePath

  • jdbc.properties

    jdbc.url=jdbc:mysql://localhost:3306/wmusic?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    jdbc.username=root
    jdbc.password= ***
    jdbc.driver=com.mysql.cj.jdbc.Driver


  • 源代码阅读请到 WmusicPlayer项目 GitHub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值