菜单
本页目录

主题适配

目前此插件为主题端提供了 /douban 路由,模板为 douban.html,也提供了 Finder API,可以将瞬间列表渲染到任何地方。

模板变量

路由信息

  • 模板路径:/templates/douban.html
  • 访问路径:/douban

变量

  • douban
  • genres
  • types

变量类型

Finder API

listAllGenres()

描述

获取全部种类。

参数

返回值

DoubanGenresVo

示例

<div>
  <div th:each="genres : ${doubanFinder.listAllGenres()}">
    <a th:href="${genres}" target="_blank" th:text="${genres}"></a>
  </div>
</div>

listAllType()

描述

获取全部类型。

参数

返回值

DoubanTypeVo

示例

<div>
  <div th:each="type : ${doubanFinder.listAllType()}">
    <a th:href="|/douban?type=${type.key}|" target="_blank" th:text="${type.name}"></a>
  </div>
</div>

list(page, size)

描述

根据分页参数获取豆瓣内容。

参数

  • page: int - 分页页码,从 1 开始
  • size: int - 分页条数

返回值

ListResult

示例

<th:block th:with="doubans = ${doubanFinder.list(1, 10)}">
    <div th:each="douban : ${doubans.items}">
        <a th:href="${douban.spec.link}" target="_blank" th:text="${douban.spec.name}"></a>
        <div>
            <img th:src="|https://dou.img.lithub.cc/${data.spec.type}/${data.spec.id}.jpg|"
                alt="avatar">
            <span th:text="${data.spec.type}"></span>
            <span th:text="${data.spec.score}"></span>
        </div>
    </div>
</th:block>

listByType(page, size, type)

描述

根据类型和分页参数获取豆瓣内容。

参数

  • page: int - 分页页码,从 1 开始
  • size: int - 分页条数
  • type: string - 类型

返回值

ListResult

示例

<th:block th:with="doubans = ${doubanFinder.listByType(1, 10,'movie')}">
    <div th:each="douban : ${doubans.items}">
        <a th:href="${douban.spec.link}" target="_blank" th:text="${douban.spec.name}"></a>
        <div>
            <img th:src="|https://dou.img.lithub.cc/${data.spec.type}/${data.spec.id}.jpg|"
                alt="avatar">
            <span th:text="${data.spec.type}"></span>
            <span th:text="${data.spec.score}"></span>
        </div>
    </div>
</th:block>

list(page, size, type, status)

描述

根据类型和状态和分页参数获取豆瓣内容。

参数

  • page: int - 分页页码,从 1 开始
  • size: int - 分页条数
  • type: string - 类型
  • status: string - 状态

返回值

ListResult

示例

<th:block th:with="doubans = ${doubanFinder.list(1, 10,'movie','done')}">
    <div th:each="douban : ${doubans.items}">
        <a th:href="${douban.spec.link}" target="_blank" th:text="${douban.spec.name}"></a>
        <div>
            <img th:src="|https://dou.img.lithub.cc/${data.spec.type}/${data.spec.id}.jpg|"
                alt="avatar">
            <span th:text="${data.spec.type}"></span>
            <span th:text="${data.spec.score}"></span>
        </div>
    </div>
</th:block>

list(type, status)

描述

根据类型和状态获取豆瓣内容。

参数

  • type: string - 类型
  • status: string - 状态

返回值

DoubanTypeVo

示例

<th:block th:with="doubans = ${doubanFinder.list('movie','done')}">
    <div th:each="douban : ${doubans}">
        <a th:href="${douban.spec.link}" target="_blank" th:text="${douban.spec.name}"></a>
        <div>
            <img th:src="|https://dou.img.lithub.cc/${data.spec.type}/${data.spec.id}.jpg|"
                alt="avatar">
            <span th:text="${data.spec.type}"></span>
            <span th:text="${data.spec.score}"></span>
        </div>
    </div>
</th:block>

类型定义

DoubanMovieVo

{
  "metadata": {
    "name": "string",                                         // 唯一标识
    "generateName": "string",
    "version": 0,
    "creationTimestamp": "2024-01-16T16:13:17.925131783Z",    // 创建时间
  },
  "apiVersion": "friend.moony.la/v1alpha1",
  "kind": "FriendPost",
  "spec": {
    "name": "string",                                         // 标题
    "poster": "string",                                       // 封面
    "link": "string",                                         // 链接
    "id": "string",                                           // ID
    "score": "string",                                        // 评分
    "year": "string",                                         // 内容
    "type": "string",                                         // 类型
    "pubdate": "string",                                      // 发布时间
    "cardSubtitle": "string",                                 // 描述
    "dataType": "string",                                     // 数据类型
    "genres": "Set<string>",                                  // 种类
  },
  "faves": {
    "remark": "string",                                       // 我的短评
    "createTime": "Instant",                                  // 观看时间
    "score": "string",                                        // 我的评分
    "status": "string",                                       // 状态
  }
}

DoubanTypeVo

{
  "name": "string",                                     // 名称
  "key": "string",                                      // 类型
  "doubanCount": "Integer",                             // 豆瓣数
}

DoubanGenresVo

{
  "name": "string",                                      // 种类
  "doubanCount": "Integer",                              // 豆瓣数
}