嘿嘿

嘿嘿主要版块就三个,主界面,帖子,一切功能包含在这三个板块中

主界面

主界面:由若干个贴子构成,给个贴子的简单介绍和图片即可。

主界面可以发布贴子,按tag搜索贴子。

  • 搜索贴子只能按tag搜索,可以通过同时输入多个tag进行搜索。

主界面api

url:/api/post/feeds

  • http verb:get

  • 参数:page pagesize tags

  • 传参方式:query

  • response:200

[{
    id:string,
    description:string,
    topic:string,
    tags:string[],
    pictureUrl:string
}]

帖子

这个是核心功能

  • 发布贴子:每一个贴子至少需要两个tag,一个官方tag池里的,一个自定义tag。

  • 贴子的主体部分:标题,正文,封面。无格式要求,支持markdown语法,自动渲染。贴子顶端或低端要有阅读数量,赞的数量,回复数量,不显示发帖者(没有作者这个信息)。

  • 回复:回复只有正文,可以添加图片(作为正文)。回复可以是一个贴子,要求和正常贴子相同。

  • 回复可以设置是否为私密(就是是否只有你回复的那个人能看到)

  • 用户可以赞一个贴子(一人一贴限一次)

贴子api

url:/api/post/{id}

  • http verb:get

  • 参数:id

  • 传参方式:url

  • response:200

{
    userBrief:{
        username: string,
        id: string
    },
    id:string,
    description:string,
    pictureUrl:string,
    topic:string,
    tags:string[]
}

url:/api/post/{id?}

  • http verb:post

  • 参数:id?(取决于是新建还是修改) body

    • body:

      {
          userBrief:{
              username: string,
              id: string
          },
          id:string,
          description:string,
          pictureUrl:string,
          topic:string,
          tags:string[]
      }

      Note


      • 修改功能可以先不做,我不确定是否需要修改功能--by lbx

      • 后端无视传入参数中的userbrief参数

      • 如果做修改功能,务必对用户身份是否是post作者进行检查

  • 传参方式:url

  • response:200

{
    userBrief:{
        username: string,
        id: string
    },
    id:string,
    description:string,
    pictureUrl:string,
    topic:string,
    tags:string[]
}

回复:

url:/replyhub/

Important


回复相关的任务使用signalr进行实时通信(无论是发表回复还是获取回复)。用户每次发表回复其他用户的回复区都会同步更新

signalr无所谓dto,按需求写就好

需要三个函数:

  • list

  • post

  • join

具体作用以后解释

菜单

我发过的贴子,我收藏的贴子,我回复过的贴子,三个按钮,点进去以后是帖子的列表。

  • 我发过的贴子:帖子的列表,如果贴子有更新需要有提示,参考微信,贴吧的消息提示。

  • 我收藏的贴子:同上,更新需提示

  • 我回复的贴子:同上

  • 排序:按时间,赞的数量,回复的数量排序,方式自定(后期功能,可以先不做,理解参考各平台热度)。

菜单页面api

我发的贴子:

url:/api/post/mine

  • http verb:get

  • 参数:page pagesize tags

  • 传参方式:query

  • reponse:200

{
    userBrief:{
        username: string,
        id: string
    },
    id:string,
    description:string,
    pictureUrl:string,
    topic:string,
    tags:string[]
}

我回复的贴子:

url:/api/post/replied

  • http verb:get

  • 参数:page pagesize tags

  • 传参方式:query

  • reponse:200

{
    userBrief:{
        username: string,
        id: string
    },
    id:string,
    description:string,
    pictureUrl:string,
    topic:string,
    tags:string[]
}

我收藏的贴子:

url:/api/post/stared

  • http verb:get

  • 参数:page pagesize tags

  • 传参方式:query

  • reponse:200

{
    userBrief:{
        username: string,
        id: string
    },
    id:string,
    description:string,
    pictureUrl:string,
    topic:string,
    tags:string[]
}

用户账号相关api

这个做的太多了,我就大概说一下

详细的就不写了

与普通的主要区别是:用户第一次打开小程序的时候,使用它的微信身份自动注册

然后将用户cookie写入缓存,之后每次打开小程序读取缓存设置cookie。


本文章使用limfx的vsocde插件快速发布