From a83dca2eb2a0b4c55f1f81434893b79bd94d3982 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 7 Mar 2026 11:29:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Gateway=20=E6=B5=81?= =?UTF-8?q?=E9=87=8F=E5=8D=A1=E6=8E=A5=E5=8F=A3=E8=B7=AF=E5=BE=84=E3=80=81?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E6=A8=A1=E5=9E=8B=E5=92=8C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=E4=B8=8E=E4=B8=8A=E6=B8=B8=E6=96=87=E6=A1=A3=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 时间戳从 UnixMilli (13位) 改为 Unix (10位秒级) - 实名状态接口路径 /realname-status → /realName - 实名链接接口路径 /realname-link → /RealNameVerification - RealnameStatusResp: status string → realStatus bool + iccid - FlowUsageResp: usedFlow int64 → used float64 + iccid - RealnameLinkResp: link → url --- internal/gateway/client.go | 2 +- internal/gateway/flow_card.go | 4 ++-- internal/gateway/models.go | 13 ++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/gateway/client.go b/internal/gateway/client.go index 8d57a26..cb627a7 100644 --- a/internal/gateway/client.go +++ b/internal/gateway/client.go @@ -72,7 +72,7 @@ func (c *Client) doRequest(ctx context.Context, path string, businessData interf return nil, err } - timestamp := time.Now().UnixMilli() + timestamp := time.Now().Unix() sign := generateSign(c.appID, encryptedData, timestamp, c.appSecret) reqBody := map[string]interface{}{ diff --git a/internal/gateway/flow_card.go b/internal/gateway/flow_card.go index 01fa689..7683bf8 100644 --- a/internal/gateway/flow_card.go +++ b/internal/gateway/flow_card.go @@ -58,7 +58,7 @@ func (c *Client) QueryRealnameStatus(ctx context.Context, req *CardStatusReq) (* }, } - resp, err := c.doRequest(ctx, "/flow-card/realname-status", businessData) + resp, err := c.doRequest(ctx, "/flow-card/realName", businessData) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func (c *Client) GetRealnameLink(ctx context.Context, req *CardStatusReq) (*Real }, } - resp, err := c.doRequest(ctx, "/flow-card/realname-link", businessData) + resp, err := c.doRequest(ctx, "/flow-card/RealNameVerification", businessData) if err != nil { return nil, err } diff --git a/internal/gateway/models.go b/internal/gateway/models.go index 873036f..5f000e5 100644 --- a/internal/gateway/models.go +++ b/internal/gateway/models.go @@ -32,9 +32,9 @@ type FlowQueryReq struct { // FlowUsageResp 是查询流量使用的响应 type FlowUsageResp struct { - UsedFlow int64 `json:"usedFlow" description:"已用流量"` - Unit string `json:"unit" description:"流量单位(MB)"` - Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"` + ICCID string `json:"iccid" description:"ICCID"` + Used float64 `json:"used" description:"当月已用流量(MB)"` + Unit string `json:"unit" description:"流量单位(MB)"` } // CardOperationReq 是停机/复机请求 @@ -45,14 +45,13 @@ type CardOperationReq struct { // RealnameStatusResp 是实名认证状态的响应 type RealnameStatusResp struct { - Status string `json:"status" description:"实名认证状态"` - Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"` + ICCID string `json:"iccid" description:"ICCID"` + RealStatus bool `json:"realStatus" description:"实名状态(true=已实名, false=未实名)"` } // RealnameLinkResp 是实名认证链接的响应 type RealnameLinkResp struct { - Link string `json:"link" description:"实名认证跳转链接(HTTPS URL)"` - Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"` + URL string `json:"url" description:"实名认证跳转链接(HTTPS URL)"` } // BatchQueryReq 是批量查询的请求