余额查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/balance/info \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/balance/info"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chenyu.cn/api/open/v2/balance/info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/balance/info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/balance/info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chenyu.cn/api/open/v2/balance/info")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/balance/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"balance": 123,
"card_balance": 123
}
}财务接口
余额查询
查询账户余额信息
GET
/
api
/
open
/
v2
/
balance
/
info
余额查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/balance/info \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/balance/info"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chenyu.cn/api/open/v2/balance/info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/balance/info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/balance/info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chenyu.cn/api/open/v2/balance/info")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/balance/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"balance": 123,
"card_balance": 123
}
}余额查询
查询当前账户的余额信息,包括可用余额、冻结余额等详细信息。请求参数
无需请求参数。响应参数
integer
响应码
string
响应信息
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/balance/info"
headers = {
"Authorization": "Bearer your_api_key"
}
response = requests.get(url, headers=headers)
result = response.json()
if result['code'] == 0:
balance_info = result['data']
print(f"充值余额: {balance_info['balance']}")
print(f"算力卡余额: {balance_info['card_balance']}")
else:
print(f"查询失败: {result['msg']}")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/balance/info';
const headers = {
'Authorization': 'Bearer your_api_key'
};
axios.get(url, { headers })
.then(response => {
const result = response.data;
if (result.code === 0) {
const balanceInfo = result.data;
console.log(`充值余额: ${balanceInfo.balance}`);
console.log(`算力卡余额: ${balanceInfo.card_balance}`);
} else {
console.log(`查询失败: ${result.msg}`);
}
})
.catch(error => {
console.error('Error:', error.response.data);
});
curl -X GET "https://www.chenyu.cn/api/open/v2/balance/info" \
-H "Authorization: Bearer your_api_key"
响应示例
{
"code": 0,
"msg": "查询成功",
"data": {
"balance": 1250.50,
"card_balance": 500.00
}
}
{
"code": -1,
"msg": "查询失败"
}
⌘I