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