优化接口以及后台页面样式
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
### 1.1 Daily Push API
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/daily-push`
|
||||
* 路径:`/api/v1/mall/dailyPush`
|
||||
|
||||
#### Header(多语言,可选)
|
||||
- `lang`: `zh`/`zh-cn` 返回中文(默认);`en` 返回英文
|
||||
@@ -25,7 +25,7 @@
|
||||
- `X-Signature`:签名(HMAC_SHA256)
|
||||
|
||||
服务端签名计算:
|
||||
- `canonical = X-Timestamp + "\n" + X-Request-Id + "\nPOST\n/api/v1/playx/daily-push\n" + sha256(json_body)`
|
||||
- `canonical = X-Timestamp + "\n" + X-Request-Id + "\nPOST\n/api/v1/mall/dailyPush\n" + sha256(json_body)`
|
||||
- `expected = hash_hmac('sha256', canonical, daily_push_secret)`
|
||||
- 校验:`hash_equals(expected, X-Signature)`
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
#### 示例(未开启签名校验)
|
||||
请求:
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/daily-push' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/dailyPush' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"request_id":"req_1001",
|
||||
@@ -136,7 +136,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/daily-push' \
|
||||
#### 示例(新版批量上报)
|
||||
请求:
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/daily-push' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/dailyPush' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"report_date": "1700000000",
|
||||
@@ -181,7 +181,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/daily-push' \
|
||||
## 2. PlayX -> 积分商城(商城调用 PlayX)
|
||||
|
||||
> 下面这些接口由 PlayX 提供。商城侧仅按“请求参数 + 期望返回判定条件”发起调用与处理结果。
|
||||
> **说明**:H5 调商城的 **`/api/v1/playx/verify-token`** 在配置 **`playx.verify_token_local_only=true`**(默认)时**不会请求**本节接口,而是在商城内校验 `muser` token;远程对接 PlayX 时见 **3.3** 与下文 **2.1**。
|
||||
> **说明**:H5 调商城的 **`/api/v1/mall/verifyToken`** 在配置 **`playx.verify_token_local_only=true`**(默认)时**不会请求**本节接口,而是在商城内校验 `muser` token;远程对接 PlayX 时见 **3.3** 与下文 **2.1**。
|
||||
|
||||
### 2.1 Token Verification API(PlayX 侧实现,远程验证时使用)
|
||||
* 方法:`POST`
|
||||
@@ -406,7 +406,7 @@ curl -G 'http://localhost:1818/api/v1/temLogin' --data-urlencode 'username=demo_
|
||||
### 3.3 Token 验证(换 session)
|
||||
|
||||
* 方法:`POST`(推荐 `GET` 传 `token` 亦可)
|
||||
* 路径:`/api/v1/playx/verify-token`
|
||||
* 路径:`/api/v1/mall/verifyToken`
|
||||
|
||||
#### 配置:本地验证 vs 远程 PlayX
|
||||
|
||||
@@ -442,7 +442,7 @@ curl -G 'http://localhost:1818/api/v1/temLogin' --data-urlencode 'username=demo_
|
||||
#### 示例(本地验证)
|
||||
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/verify-token' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/verifyToken' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
--data-urlencode 'token=上一步TemLogin返回的token'
|
||||
```
|
||||
@@ -455,32 +455,32 @@ curl -X POST 'http://localhost:1818/api/v1/playx/verify-token' \
|
||||
|
||||
#### 3.x.1 地址列表
|
||||
* 方法:`GET`
|
||||
* 路径:`/api/v1/playx/address/list`
|
||||
* 路径:`/api/v1/mall/addressList`
|
||||
|
||||
返回:`data.list` 为地址数组。
|
||||
|
||||
#### 3.x.2 添加地址
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/address/add`
|
||||
* 路径:`/api/v1/mall/addressAdd`
|
||||
|
||||
Body:
|
||||
| 字段 | 必填 | 说明 |
|
||||
|------|------|------|
|
||||
| `receiver_name` | 是 | 收货人 |
|
||||
| `phone` | 是 | 电话 |
|
||||
| `region` | 是 | 地区(数组或逗号分隔字符串) |
|
||||
| `detail_address` | 是 | 详细地址 |
|
||||
| `address` | 是 | 地址补充 |
|
||||
| `default_setting` | 否 | `1` 设为默认地址 |
|
||||
|
||||
#### 3.x.3 修改地址(含设为默认)
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/address/edit`
|
||||
* 路径:`/api/v1/mall/addressEdit`
|
||||
|
||||
Body:`id` 必填,其余字段按需传入更新。
|
||||
|
||||
#### 3.x.4 删除地址
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/address/delete`
|
||||
* 路径:`/api/v1/mall/addressDelete`
|
||||
|
||||
Body:`id` 必填。若删除默认地址,服务端会自动挑选一条剩余地址设为默认(如存在)。
|
||||
|
||||
@@ -519,7 +519,7 @@ Body:`id` 必填。若删除默认地址,服务端会自动挑选一条剩
|
||||
|
||||
### 3.4 用户资产(Assets)
|
||||
* 方法:`GET`
|
||||
* 路径:`/api/v1/playx/assets`
|
||||
* 路径:`/api/v1/mall/assets`
|
||||
|
||||
#### 请求参数(鉴权)
|
||||
|
||||
@@ -541,7 +541,7 @@ Body:`id` 必填。若删除默认地址,服务端会自动挑选一条剩
|
||||
|
||||
#### 示例
|
||||
```bash
|
||||
curl -G 'http://localhost:1818/api/v1/playx/assets' --data-urlencode 'token=上一步temLogin返回的token'
|
||||
curl -G 'http://localhost:1818/api/v1/mall/assets' --data-urlencode 'token=上一步temLogin返回的token'
|
||||
```
|
||||
|
||||
响应(示例):
|
||||
@@ -564,7 +564,7 @@ curl -G 'http://localhost:1818/api/v1/playx/assets' --data-urlencode 'token=上
|
||||
|
||||
### 3.5 领取(Claim)
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/claim`
|
||||
* 路径:`/api/v1/mall/claim`
|
||||
|
||||
#### 请求 Body
|
||||
必填:
|
||||
@@ -581,7 +581,7 @@ curl -G 'http://localhost:1818/api/v1/playx/assets' --data-urlencode 'token=上
|
||||
|
||||
#### 示例
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/claim' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/claim' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
--data-urlencode 'claim_request_id=claim_001' \
|
||||
--data-urlencode 'token=上一步temLogin返回的token'
|
||||
@@ -623,7 +623,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/claim' \
|
||||
|
||||
### 3.6 商品列表
|
||||
* 方法:`GET`
|
||||
* 路径:`/api/v1/playx/items`
|
||||
* 路径:`/api/v1/mall/items`
|
||||
|
||||
#### 请求参数
|
||||
* `type`(可选):`BONUS` | `PHYSICAL` | `WITHDRAW`
|
||||
@@ -636,7 +636,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/claim' \
|
||||
#### 示例
|
||||
请求:
|
||||
```bash
|
||||
curl -G 'http://localhost:1818/api/v1/playx/items' --data-urlencode 'type=WITHDRAW'
|
||||
curl -G 'http://localhost:1818/api/v1/mall/items' --data-urlencode 'type=WITHDRAW'
|
||||
```
|
||||
|
||||
响应(示例):
|
||||
@@ -666,7 +666,7 @@ curl -G 'http://localhost:1818/api/v1/playx/items' --data-urlencode 'type=WITHDR
|
||||
|
||||
### 3.7 红利兑换(Bonus Redeem)
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/bonus/redeem`
|
||||
* 路径:`/api/v1/mall/bonusRedeem`
|
||||
|
||||
#### 请求 Body
|
||||
必填:
|
||||
@@ -680,7 +680,7 @@ curl -G 'http://localhost:1818/api/v1/playx/items' --data-urlencode 'type=WITHDR
|
||||
|
||||
#### 示例
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/bonus/redeem' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/bonusRedeem' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
--data-urlencode 'item_id=123' \
|
||||
--data-urlencode 'session_id=7b1c....'
|
||||
@@ -703,14 +703,12 @@ curl -X POST 'http://localhost:1818/api/v1/playx/bonus/redeem' \
|
||||
|
||||
### 3.8 实物兑换(Physical Redeem)
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/physical/redeem`
|
||||
* 路径:`/api/v1/mall/physicalRedeem`
|
||||
|
||||
#### 请求 Body
|
||||
必填:
|
||||
* `item_id`:商品 ID(要求 `mall_item.type=PHYSICAL` 且 `status=1`)
|
||||
* `receiver_name`:收货人
|
||||
* `receiver_phone`:收货电话
|
||||
* `receiver_address`:收货地址
|
||||
* `address_id`:收货地址 ID(`mall_address.id`,须属于当前用户资产;下单时写入 `mall_order.mall_address_id`,并将该地址快照写入 `receiver_name` / `receiver_phone` / `receiver_address`)
|
||||
鉴权:同 **3.1**(`session_id` / `token` / `user_id`)
|
||||
|
||||
#### 返回(成功)
|
||||
@@ -719,12 +717,10 @@ curl -X POST 'http://localhost:1818/api/v1/playx/bonus/redeem' \
|
||||
|
||||
#### 示例
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/physical/redeem' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/physicalRedeem' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
--data-urlencode 'item_id=200' \
|
||||
--data-urlencode 'receiver_name=张三' \
|
||||
--data-urlencode 'receiver_phone=18800001111' \
|
||||
--data-urlencode 'receiver_address=北京市朝阳区XX路XX号' \
|
||||
--data-urlencode 'address_id=10' \
|
||||
--data-urlencode 'session_id=7b1c....'
|
||||
```
|
||||
|
||||
@@ -742,7 +738,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/physical/redeem' \
|
||||
|
||||
### 3.9 提现申请(Withdraw Apply)
|
||||
* 方法:`POST`
|
||||
* 路径:`/api/v1/playx/withdraw/apply`
|
||||
* 路径:`/api/v1/mall/withdrawApply`
|
||||
|
||||
#### 请求 Body
|
||||
必填:
|
||||
@@ -756,7 +752,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/physical/redeem' \
|
||||
|
||||
#### 示例
|
||||
```bash
|
||||
curl -X POST 'http://localhost:1818/api/v1/playx/withdraw/apply' \
|
||||
curl -X POST 'http://localhost:1818/api/v1/mall/withdrawApply' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
--data-urlencode 'item_id=321' \
|
||||
--data-urlencode 'session_id=7b1c....'
|
||||
@@ -779,7 +775,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/withdraw/apply' \
|
||||
|
||||
### 3.10 订单列表
|
||||
* 方法:`GET`
|
||||
* 路径:`/api/v1/playx/orders`
|
||||
* 路径:`/api/v1/mall/orders`
|
||||
|
||||
#### 请求参数(鉴权)
|
||||
|
||||
@@ -793,7 +789,7 @@ curl -X POST 'http://localhost:1818/api/v1/playx/withdraw/apply' \
|
||||
#### 示例
|
||||
请求:
|
||||
```bash
|
||||
curl -G 'http://localhost:1818/api/v1/playx/orders' --data-urlencode 'token=上一步temLogin返回的token'
|
||||
curl -G 'http://localhost:1818/api/v1/mall/orders' --data-urlencode 'token=上一步temLogin返回的token'
|
||||
```
|
||||
|
||||
响应(示例,简化):
|
||||
@@ -828,5 +824,5 @@ curl -G 'http://localhost:1818/api/v1/playx/orders' --data-urlencode 'token=上
|
||||
---
|
||||
|
||||
### 3.11 同步额度(可选)
|
||||
当前代码未实现并未注册路由:`/api/v1/playx/sync-limit`。
|
||||
当前代码未实现并未注册路由:`/api/v1/mall/syncLimit`。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user