diff --git a/platform/tong-cheng/api.go b/platform/tong-cheng/api.go index b4dc4b8..4150382 100644 --- a/platform/tong-cheng/api.go +++ b/platform/tong-cheng/api.go @@ -16,8 +16,8 @@ import ( // TongChengApi 同程酒店的api // Api defines the interface of tong-cheng api type TongChengApi interface { - // GenerateLink 生成链接 - GenerateLink(ctx context.Context, req GenerateLinkRequest, env string) (*ExternalChannelConfigResponse, error) + // GetExternalChannelConfig 获取渠道配置信息 + GetExternalChannelConfig(ctx context.Context, req GetExternalChannelConfigRequest, env string) (*ExternalChannelConfigResponse, error) // QueryOrderList 查询订单列表 QueryOrderList(ctx context.Context, req QueryOrderListRequest, env string) (*ExternalOrderData, error) } @@ -35,7 +35,7 @@ func newTongChengApiImpl(log logx.Logger, client *Client) TongChengApi { } // GenerateLink 生成短链 -func (t *tongChengApiImpl) GenerateLink(ctx context.Context, req GenerateLinkRequest, env string) (*ExternalChannelConfigResponse, error) { +func (t *tongChengApiImpl) GetExternalChannelConfig(ctx context.Context, req GetExternalChannelConfigRequest, env string) (*ExternalChannelConfigResponse, error) { var url string token := t.client.authConfig.Token tn := time.Now() @@ -50,7 +50,7 @@ func (t *tongChengApiImpl) GenerateLink(ctx context.Context, req GenerateLinkReq } args := util.StructToMap(queryArgs) request := &client.HttpRequest{Headers: t.client.headers, QueryArgs: args} - response := new(GetExternalChannelConfigResp) + response := new(GetExternalChannelConfigResponse) if env == EnvHuidu { url = HDApiDomain + GetLinkUri } else { @@ -61,7 +61,7 @@ func (t *tongChengApiImpl) GenerateLink(ctx context.Context, req GenerateLinkReq } if response.Code != 200 { t.log.WithFields(logx.LogField{Key: "data", Value: map[string]any{"req": req, "resp": response}}). - Errorf("[tongChengApiImpl][GenerateLink] response result error: %s", response.Msg) + Errorf("[tongChengApiImpl][GetExternalChannelConfig] response result error: %s", response.Msg) return nil, errors.New(response.Msg) } return response.Data, nil diff --git a/platform/tong-cheng/types.go b/platform/tong-cheng/types.go index bd8b26f..366c4ab 100644 --- a/platform/tong-cheng/types.go +++ b/platform/tong-cheng/types.go @@ -12,7 +12,7 @@ type CommonResponse struct { } // 生成链接请求 -type GenerateLinkRequest struct { +type GetExternalChannelConfigRequest struct { Trackid string `json:"trackid"` // 跟踪id,排查问题使用,guid即可 } @@ -25,7 +25,7 @@ type GetExternalChannelConfigReq struct { } // 获取外部渠道配置响应 -type GetExternalChannelConfigResp struct { +type GetExternalChannelConfigResponse struct { CommonResponse Data *ExternalChannelConfigResponse `json:"data"` // 数据 }