SUBSCRIBE_ACTION_API.md 3.1 KB

订阅广告配置 API 文档

本文档描述了订阅广告配置相关的接口规范。

1. 订阅广告列表

  • URL: /v2/subscribe/action/list
  • Method: GET
  • 描述: 查询所有订阅广告配置(不分页)。

请求参数

无

响应参数 (data 字段)

返回 List<TSubscribeAction> 数组。

数组中每个对象的结构如下:

字段名 类型 说明
id integer 主键ID
title string 标题
description string 描述
image string 图片URL
type integer 类型(0:首页广告,1:订阅页面)
lang string 多语言配置
createTime string 创建时间

示例请求

GET /v2/subscribe/action/list

示例响应

{
  "code": 200,
  "message": "success",
  "success": true,
  "data": [
    {
      "id": 1,
      "title": "Summer Sale",
      "description": "50% off for annual plan",
      "image": "https://example.com/banner.png",
      "type": 1,
      "lang": "{\"en\":\"Summer Sale\",\"zh\":\"夏季促销\"}",
      "createTime": "2023-10-01 12:00:00"
    }
  ],
  "timestamp": 1698806000000
}

2. 添加订阅广告

  • URL: /v2/subscribe/action/add
  • Method: POST
  • 描述: 添加新的订阅广告配置。

请求参数 (Body)

字段名 类型 必填 说明
title string 是 标题
description string 否 描述
image string 否 图片URL
type integer 是 类型(0:首页广告,1:订阅页面)
lang string 否 多语言配置

示例请求

POST /v2/subscribe/action/add
Content-Type: application/json

{
  "title": "New Year Sale",
  "description": "Best deal ever",
  "image": "https://example.com/newyear.png",
  "type": 0,
  "lang": "{\"en\":\"New Year Sale\"}"
}

响应参数 (data 字段)

返回 boolean,表示是否成功。

3. 更新订阅广告

  • URL: /v2/subscribe/action/update
  • Method: POST
  • 描述: 更新现有的订阅广告配置。

请求参数 (Body)

字段名 类型 必填 说明
id integer 是 主键ID
title string 否 标题
description string 否 描述
image string 否 图片URL
type integer 否 类型(0:首页广告,1:订阅页面)
lang string 否 多语言配置

示例请求

POST /v2/subscribe/action/update
Content-Type: application/json

{
  "id": 1,
  "title": "Updated Title",
  "type": 1
}

响应参数 (data 字段)

返回 boolean,表示是否成功。

4. 删除订阅广告

  • URL: /v2/subscribe/action/delete
  • Method: POST
  • 描述: 根据ID删除订阅广告配置。

请求参数 (Query)

字段名 类型 必填 说明
id integer 是 主键ID

示例请求

POST /v2/subscribe/action/delete?id=1

响应参数 (data 字段)

返回 boolean,表示是否成功。