38 lines
1009 B
Markdown
38 lines
1009 B
Markdown
# Mini Program API Documentation
|
|
|
|
## Authentication
|
|
### Login
|
|
- **URL**: `/api/wechat/login/`
|
|
- **Method**: `POST`
|
|
- **Body**: `{ "code": "wx_login_code" }`
|
|
- **Response**: `{ "token": "...", "openid": "..." }`
|
|
|
|
### Update User Info
|
|
- **URL**: `/api/wechat/update/`
|
|
- **Method**: `POST`
|
|
- **Header**: `Authorization: Bearer <token>`
|
|
- **Body**: `{ "nickname": "...", "avatar_url": "..." }`
|
|
|
|
## Distributor
|
|
### Register
|
|
- **URL**: `/api/distributor/register/`
|
|
- **Method**: `POST`
|
|
- **Body**: `{ "invite_code": "optional" }`
|
|
|
|
### Info
|
|
- **URL**: `/api/distributor/info/`
|
|
- **Method**: `GET`
|
|
- **Response**: `{ "level": 1, "commission_rate": 0.1, ... }`
|
|
|
|
### Withdraw
|
|
- **URL**: `/api/distributor/withdraw/`
|
|
- **Method**: `POST`
|
|
- **Body**: `{ "amount": 100 }`
|
|
|
|
## Orders & Payment
|
|
### Prepay (Mini Program)
|
|
- **URL**: `/api/orders/{id}/prepay_miniprogram/`
|
|
- **Method**: `POST`
|
|
- **Response**: `{ "timeStamp": "...", "nonceStr": "...", "package": "...", "paySign": "..." }`
|
|
- **Use with**: `wx.requestPayment`
|