All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m34s
52 lines
1.8 KiB
Go
52 lines
1.8 KiB
Go
// Package gateway 提供流量卡相关的 7 个 API 方法封装
|
|
package gateway
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
|
)
|
|
|
|
// QueryCardStatus 查询流量卡状态
|
|
// POST /flow-card/status
|
|
func (c *Client) QueryCardStatus(ctx context.Context, req *CardStatusReq) (*CardStatusResp, error) {
|
|
return doRequestWithResponse[CardStatusResp](c, ctx, "/flow-card/status", req)
|
|
}
|
|
|
|
// QueryFlow 查询流量使用情况
|
|
// POST /flow-card/flow
|
|
func (c *Client) QueryFlow(ctx context.Context, req *FlowQueryReq) (*FlowUsageResp, error) {
|
|
return doRequestWithResponse[FlowUsageResp](c, ctx, "/flow-card/flow", req)
|
|
}
|
|
|
|
// QueryRealnameStatus 查询实名认证状态
|
|
// POST /flow-card/realName
|
|
func (c *Client) QueryRealnameStatus(ctx context.Context, req *CardStatusReq) (*RealnameStatusResp, error) {
|
|
return doRequestWithResponse[RealnameStatusResp](c, ctx, "/flow-card/realName", req)
|
|
}
|
|
|
|
// StopCard 流量卡停机
|
|
// POST /flow-card/cardStop
|
|
func (c *Client) StopCard(ctx context.Context, req *CardOperationReq) error {
|
|
_, err := c.doRequest(ctx, "/flow-card/cardStop", req)
|
|
return err
|
|
}
|
|
|
|
// StartCard 流量卡复机
|
|
// POST /flow-card/cardStart
|
|
func (c *Client) StartCard(ctx context.Context, req *CardOperationReq) error {
|
|
_, err := c.doRequest(ctx, "/flow-card/cardStart", req)
|
|
return err
|
|
}
|
|
|
|
// GetRealnameLink 获取实名认证跳转链接
|
|
// POST /flow-card/RealNameVerification
|
|
func (c *Client) GetRealnameLink(ctx context.Context, req *CardStatusReq) (*RealnameLinkResp, error) {
|
|
return doRequestWithResponse[RealnameLinkResp](c, ctx, "/flow-card/RealNameVerification", req)
|
|
}
|
|
|
|
// BatchQuery 批量查询(预留接口,暂未实现)
|
|
func (c *Client) BatchQuery(ctx context.Context, req *BatchQueryReq) (*BatchQueryResp, error) {
|
|
return nil, errors.New(errors.CodeGatewayError, "批量查询接口暂未实现")
|
|
}
|