sage/wwwroot/API.md
2026-03-18 14:11:47 +08:00

176 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 元境API
## 手机注册和登录
手机登录,如果账号不存在先注册后登陆
### 生成短信验证码
* path /rbac/gen_sms_code.dspy
* method 'GET'
* parameters
cellphone: 手机号
* 返回
```
{
"status": "ok",
"data": {
"sms_code":
}
}
```
or
```
{
"status": "error",
"data": {
"message":
}
}
```
### 登录接口
* path /rbac/phone_login.dspy
* method 'POST'
* data
```
{
"cellphone":
"sms_code":
}
```
* 返回
```
{
"status": "ok",
"data": {
"userid":
"username":
"userorgid":
}
}
```
or
```
{
"status": "error",
"data": {
"message":
}
}
```
## 充值
目前支持支付宝在线充值
### 发起支付宝充值
* path /unipay/user_recharge.dspy
* method "POST"
* data
```
{
"provider": "alipay", # 充值渠道
"amount": # 充值金额
"currency": "CNY" # 币种
}
```
* 返回
```
{
"status": "ok",
"data": {
"redirct": url # 充值url
}
}
```
or
```
{
"status": "error",
"data": {
"message": 出错信息
}
}
```
## 账户管理
### 查询账户余额
* path /accounting/mybalance.dspy
* method 'GET'
* params 无
* 返回
```
{
"status": "ok",
"data": [
{
"account": # 账号名称
"balance": # 余额
}
]
}
```
or
```
{
"status": "error",
"data": {
"message": 错误信息
}
}
```
## 交易管理
### 查询产品价格
* path /platformbiz/query_product_price.dspy
* method "POST"
* data
```
{
"product_type": "llm" # llm大模型
"product_id": # 大模型id
“config_data # 不同的模型的配置数据不一样
}
```
* 返回
```
{
"status": "ok",
"data": {
"list_price": # 原价
"price": # 客户价格
"config_data" # 与请求相同
}
}
```
### 查询交易明细
* path /platformbiz/query_orders.dspy
* method "GET"
* params
```
{
"page": # 当前页,缺省第一页
"pagerows": # 每页记录数缺省80
}
```
* 返回
```
{
"total": # 总记录数
"rows": # 当前页数据数组
}
```
row:
```
{
"id": # 订单号
"order_date":
"order_detail":[
"product_type": # llm: 大模型
"productid": # 产品id
"usage": # 大模型使用信息
"amount" # 消费金额
]
}
```
##