按钮广告配置 — API 文档

简要说明:把下面的 HOST 替换为你的服务地址,例如 http://192.168.1.100:3000

按钮配置(简化)

用途:App 启动时拉取每个按钮的当前可用配置。响应仅包含每个按钮的 `button_key`、`ad_type`、`enabled`、`reward` 四个字段。
请求
GET HOST/api/v1/apps/<app_key>/buttons
示例返回
{
  "app_key":"com.example.app",
  "buttons":[
    {
      "button_key":"watch_ad_for_coins",
      "ad_type":"rewarded_video",
      "enabled": true,
      "reward": 50
    },
    {
      "button_key":"double_reward_btn",
      "ad_type":"none",
      "enabled": false,
      "reward": 0
    }
  ],
  "fetched_at":"2025-12-22T08:45:30.000Z"
}
支持的 ad_type:none, rewarded_video, interstitial, banner, splash(开屏)

单按钮查询(方便 App 请求单个按钮)

用途:直接获取某个按钮的当前配置。响应包含 `button_key`、`ad_type`、`enabled`、`reward`。
请求
GET HOST/api/v1/apps/<app_key>/buttons/<button_key>
示例(可直接复制)
curl:
curl -s "http://HOST/api/v1/apps/com.example.app/buttons/watch_ad_for_coins"
JavaScript (浏览器 / RN):
fetch('http://HOST/api/v1/apps/com.example.app/buttons/watch_ad_for_coins')
  .then(r => r.json()).then(console.log).catch(console.error);
PowerShell:
Invoke-RestMethod -Method Get -Uri "http://HOST/api/v1/apps/com.example.app/buttons/watch_ad_for_coins"
成功示例返回
{
  "button_key": "watch_ad_for_coins",
  "ad_type": "rewarded_video",
  "enabled": true,
  "reward": 50,
  "fetched_at": "2025-12-23Txx:xx:xx.xxxZ"
}

注意

除上面 GET 接口外,项目中其它写接口(如更新、发放奖励等)已被禁用,仅保留后台管理页面的本地编辑功能。若需要恢复写操作,请联系开发者以添加认证与保护措施。

常见错误与状态码

返回管理页面 若需 CORS、限流或生产级验证,请联系开发者