用户扣费接口

用户扣费接口

接口状态:正常
返回接口列表

接口信息

接口地址
https://verify.rokig.fun/api.php?api=userdeduct
返回格式
json
请求方式
json
请求示例
https://api.example.com

请求参数说明

名称变量必填类型说明
接口 api GET 填写userdeduct
应用 app GET 填写后台应用APPID
用户账号 user GET/POST 填写用户账号
用户密码 password GET/POST 填写用户密码
积分增减 deduct_fen GET/POST 要扣除的积分(可选,整数,0表示不扣)
金额增减 deduct_rmb GET/POST 要扣除的余额(可选,浮点数,0表示不扣)
修改昵称 new_name GET/POST 修改用户昵称
时间戳 t GET/POST 如果开启了[时间差效验]需提交此项
数据签名 sign GET/POST 如果开启了[数据签名]需提交此项

返回参数说明

名称类型说明
code String 返回状态
fen String 积分
rmb String 金额
name String 昵称

返回示例

返回示例
{   "code":200,
    "msg":{
           "user":"123456",
           "qq":"123456",
           "name":"这个人没有名字!",
           "fen":"100",
           "rmb":"1000"
           },
    "time":1715617022,
    "check":"0adc4cb131625602a9e216d448779103"
}

错误码参照

名称类型说明
101 String 应用不存在
102 String 应用已关闭
171 String 接口维护中
172 String 接口未添加或不存在
123456789

示例代码

C++ 示例代码
// R验云网络验证 - 用户扣费 接口调用示例(C++)
// 编译:g++ -o userdeduct userdeduct.cpp -lcurl
#include <iostream>
#include <string>
#include <curl/curl.h>

// 回调函数:接收服务器返回的数据
static size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp) {
    ((std::string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
}

int main() {
    std::string appid = "你的APPID";  // 后台应用 APPID
    std::string api = "userdeduct";
    std::string url = "https://verify.rokig.fun/api.php?api=" + api + "&app=" + appid;

    // 请求参数(是=必填,否=选填)
    std::string params = "user=是&password=是&deduct_fen=否&deduct_rmb=否";

    // 发送请求
    CURL *curl = curl_easy_init();
    std::string response;
    if (curl) {
        std::string request_url = url + "&" + params;
        curl_easy_setopt(curl, CURLOPT_URL, request_url.c_str());
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
        CURLcode res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        if (res != CURLE_OK) {
            std::cerr << "请求失败: " << curl_easy_strerror(res) << std::endl;
            return 1;
        }
    }

    // 输出返回结果(JSON,code 为 200 表示成功)
    std::cout << "返回结果: " << response << std::endl;
    return 0;
}