同程名称修改
This commit is contained in:
parent
4491ffc8c2
commit
44a65de1ba
14
index.go
14
index.go
@ -5,12 +5,12 @@ import (
|
||||
|
||||
didiunion "gitee.com/chengdu-lenntc/third-platform-sdk/platform/didi-union"
|
||||
elemeunion "gitee.com/chengdu-lenntc/third-platform-sdk/platform/eleme-union"
|
||||
elonghotel "gitee.com/chengdu-lenntc/third-platform-sdk/platform/elong-hotel"
|
||||
"gitee.com/chengdu-lenntc/third-platform-sdk/platform/jutuike"
|
||||
meituancsr "gitee.com/chengdu-lenntc/third-platform-sdk/platform/meituan-csr"
|
||||
"gitee.com/chengdu-lenntc/third-platform-sdk/platform/meituan-media"
|
||||
meituanunion "gitee.com/chengdu-lenntc/third-platform-sdk/platform/meituan-union"
|
||||
t3_union "gitee.com/chengdu-lenntc/third-platform-sdk/platform/t3-union"
|
||||
tong_cheng "gitee.com/chengdu-lenntc/third-platform-sdk/platform/tong-cheng"
|
||||
)
|
||||
|
||||
// Platform 第三方平台
|
||||
@ -29,8 +29,8 @@ const (
|
||||
PlatformMeituanMedia = "meituan_media"
|
||||
// PlatformJutuike 聚推客
|
||||
PlatformJutuike = "jutuike"
|
||||
// PlatformTongCheng 同程酒店
|
||||
PlatformTongCheng = "tong_cheng"
|
||||
// PlatformElongHotel 同程酒店
|
||||
PlatformElongHotel = "elong_hotel"
|
||||
)
|
||||
|
||||
// PlatformNameMap 平台名称
|
||||
@ -42,7 +42,7 @@ var PlatformNameMap = map[string]string{
|
||||
PlatformT3Union: "t3联盟",
|
||||
PlatformMeituanMedia: "美团-美天赚",
|
||||
PlatformJutuike: "聚推客",
|
||||
PlatformTongCheng: "同程酒店",
|
||||
PlatformElongHotel: "同程酒店",
|
||||
}
|
||||
|
||||
// GetPlatformName 获取平台名称
|
||||
@ -85,7 +85,7 @@ func NewJutuikeApi(log logx.Logger, conf jutuike.AuthConfig) jutuike.JutuikeApi
|
||||
return jutuike.NewApiClient(log, conf)
|
||||
}
|
||||
|
||||
// NewTongChengApi 同程酒店
|
||||
func NewTongChengApi(log logx.Logger, conf tong_cheng.AuthConfig) tong_cheng.TongChengApi {
|
||||
return tong_cheng.NewApiClient(log, conf)
|
||||
// NewElongHotelApi 同程酒店
|
||||
func NewElongHotelApi(log logx.Logger, conf elonghotel.AuthConfig) elonghotel.ElongHotelApi {
|
||||
return elonghotel.NewApiClient(log, conf)
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package tong_cheng
|
||||
package elong_hotel
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -14,9 +14,9 @@ import (
|
||||
"gitee.com/chengdu-lenntc/third-platform-sdk/util"
|
||||
)
|
||||
|
||||
// TongChengApi 同程酒店的api
|
||||
// Api defines the interface of tong-cheng api
|
||||
type TongChengApi interface {
|
||||
// ElongHotelApi 同程酒店的api
|
||||
// Api defines the interface of elong_hotel api
|
||||
type ElongHotelApi interface {
|
||||
// GetExternalChannelConfig 获取渠道配置信息
|
||||
GetExternalChannelConfig(ctx context.Context, req GetExternalChannelConfigRequest, env string) (*ExternalChannelConfigResponse, error)
|
||||
// GenerateUrl 生成链接
|
||||
@ -25,20 +25,20 @@ type TongChengApi interface {
|
||||
QueryOrderList(ctx context.Context, req QueryOrderListRequest, env string) (*ExternalOrderData, error)
|
||||
}
|
||||
|
||||
type tongChengApiImpl struct {
|
||||
type elongHotelApiImpl struct {
|
||||
log logx.Logger
|
||||
client *Client
|
||||
}
|
||||
|
||||
func newTongChengApiImpl(log logx.Logger, client *Client) TongChengApi {
|
||||
return &tongChengApiImpl{
|
||||
func newElongHotelApiImpl(log logx.Logger, client *Client) ElongHotelApi {
|
||||
return &elongHotelApiImpl{
|
||||
log: log,
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateLink 生成短链
|
||||
func (t *tongChengApiImpl) GetExternalChannelConfig(ctx context.Context, req GetExternalChannelConfigRequest, env string) (*ExternalChannelConfigResponse, error) {
|
||||
func (t *elongHotelApiImpl) GetExternalChannelConfig(ctx context.Context, req GetExternalChannelConfigRequest, env string) (*ExternalChannelConfigResponse, error) {
|
||||
var url string
|
||||
token := t.client.authConfig.Token
|
||||
tn := time.Now()
|
||||
@ -64,14 +64,14 @@ func (t *tongChengApiImpl) GetExternalChannelConfig(ctx context.Context, req Get
|
||||
}
|
||||
if response.Code != 200 {
|
||||
t.log.WithFields(logx.LogField{Key: "data", Value: map[string]any{"req": req, "resp": response}}).
|
||||
Errorf("[tongChengApiImpl][GetExternalChannelConfig] response result error: %s", response.Msg)
|
||||
Errorf("[elongHotelApiImpl][GetExternalChannelConfig] response result error: %s", response.Msg)
|
||||
return nil, errors.New(response.Msg)
|
||||
}
|
||||
return response.Data, nil
|
||||
}
|
||||
|
||||
// GenerateUrl 生成链接
|
||||
func (t *tongChengApiImpl) GenerateUrl(ctx context.Context, req GenerateUrlRequest) (string, error) {
|
||||
func (t *elongHotelApiImpl) GenerateUrl(ctx context.Context, req GenerateUrlRequest) (string, error) {
|
||||
if len(req.ActivityUrl) == 0 {
|
||||
return "", errors.New("url参数不能为空")
|
||||
}
|
||||
@ -101,7 +101,7 @@ func (t *tongChengApiImpl) GenerateUrl(ctx context.Context, req GenerateUrlReque
|
||||
}
|
||||
|
||||
// QueryOrderList 查询订单列表
|
||||
func (t *tongChengApiImpl) QueryOrderList(ctx context.Context, req QueryOrderListRequest, env string) (*ExternalOrderData, error) {
|
||||
func (t *elongHotelApiImpl) QueryOrderList(ctx context.Context, req QueryOrderListRequest, env string) (*ExternalOrderData, error) {
|
||||
var url string
|
||||
args := util.StructToMap(req)
|
||||
request := &client.HttpRequest{Headers: t.client.headers, QueryArgs: args}
|
||||
@ -116,7 +116,7 @@ func (t *tongChengApiImpl) QueryOrderList(ctx context.Context, req QueryOrderLis
|
||||
}
|
||||
if response.Code != 200 {
|
||||
t.log.WithFields(logx.LogField{Key: "data", Value: map[string]any{"req": req, "resp": response}}).
|
||||
Errorf("[tongChengApiImpl][QueryOrderList] response result error: %s", response.Msg)
|
||||
Errorf("[elongHotelApiImpl][QueryOrderList] response result error: %s", response.Msg)
|
||||
return nil, errors.New(response.Msg)
|
||||
}
|
||||
return response.Data, nil
|
||||
@ -1,4 +1,4 @@
|
||||
package tong_cheng
|
||||
package elong_hotel
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -12,7 +12,7 @@ import (
|
||||
// api-单元测试
|
||||
type apiClientSuite struct {
|
||||
suite.Suite
|
||||
api TongChengApi
|
||||
api ElongHotelApi
|
||||
}
|
||||
|
||||
func TestApiClient(t *testing.T) {
|
||||
@ -1,4 +1,4 @@
|
||||
package tong_cheng
|
||||
package elong_hotel
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@ -19,9 +19,9 @@ type Client struct {
|
||||
headers map[string]string
|
||||
}
|
||||
|
||||
func NewApiClient(log logx.Logger, conf AuthConfig) TongChengApi {
|
||||
func NewApiClient(log logx.Logger, conf AuthConfig) ElongHotelApi {
|
||||
clt := newClient(log, conf)
|
||||
return newTongChengApiImpl(log, clt)
|
||||
return newElongHotelApiImpl(log, clt)
|
||||
}
|
||||
|
||||
func newClient(log logx.Logger, conf AuthConfig) *Client {
|
||||
@ -1,4 +1,4 @@
|
||||
package tong_cheng
|
||||
package elong_hotel
|
||||
|
||||
// 相关地址
|
||||
const (
|
||||
1
platform/elong-hotel/sign.go
Normal file
1
platform/elong-hotel/sign.go
Normal file
@ -0,0 +1 @@
|
||||
package elong_hotel
|
||||
@ -1,4 +1,4 @@
|
||||
package tong_cheng
|
||||
package elong_hotel
|
||||
|
||||
import (
|
||||
"google.golang.org/genproto/googleapis/type/decimal"
|
||||
@ -1 +0,0 @@
|
||||
package tong_cheng
|
||||
Loading…
Reference in New Issue
Block a user