中捷乐淘-取链
This commit is contained in:
parent
e186c08583
commit
460013ba5e
@ -1,6 +1,7 @@
|
|||||||
package zjdg
|
package zjdg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
"repository.lenntc.com/lenntc/third-platform-sdk/client"
|
"repository.lenntc.com/lenntc/third-platform-sdk/client"
|
||||||
@ -10,7 +11,9 @@ import (
|
|||||||
// ZjdgApi 中捷乐淘-淘宝一分购
|
// ZjdgApi 中捷乐淘-淘宝一分购
|
||||||
type ZjdgApi interface {
|
type ZjdgApi interface {
|
||||||
// ZoneAdd 获取推广编号-创建
|
// ZoneAdd 获取推广编号-创建
|
||||||
ZoneAdd(req *ZoneAddRequest) (*ZoneAddResponse, error)
|
ZoneAdd(ctx context.Context, req ZoneAddRequest) (*ZoneAddResponse, error)
|
||||||
|
// GenerateH5Url 生成H5链接
|
||||||
|
GenerateH5Url(ctx context.Context, req GenerateH5UrlRequest) (string, error)
|
||||||
}
|
}
|
||||||
type zjdgApiImpl struct {
|
type zjdgApiImpl struct {
|
||||||
log logx.Logger
|
log logx.Logger
|
||||||
@ -25,7 +28,7 @@ func newZjdgApiImpl(log logx.Logger, client *Client) ZjdgApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ZoneAdd 获取推广编号
|
// ZoneAdd 获取推广编号
|
||||||
func (a *zjdgApiImpl) ZoneAdd(req *ZoneAddRequest) (*ZoneAddResponse, error) {
|
func (a *zjdgApiImpl) ZoneAdd(ctx context.Context, req ZoneAddRequest) (*ZoneAddResponse, error) {
|
||||||
// 响应示例 {"code":0,"message":"获取成功","data":"1963667","token_id":""}
|
// 响应示例 {"code":0,"message":"获取成功","data":"1963667","token_id":""}
|
||||||
zoneAddUrl := fmt.Sprintf("%s%s", ZoneAddUrl, a.client.authConfig.UserId)
|
zoneAddUrl := fmt.Sprintf("%s%s", ZoneAddUrl, a.client.authConfig.UserId)
|
||||||
args := util.StructToMap(req)
|
args := util.StructToMap(req)
|
||||||
@ -41,3 +44,8 @@ func (a *zjdgApiImpl) ZoneAdd(req *ZoneAddRequest) (*ZoneAddResponse, error) {
|
|||||||
AdZoneId: response.Data,
|
AdZoneId: response.Data,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *zjdgApiImpl) GenerateH5Url(ctx context.Context, req GenerateH5UrlRequest) (string, error) {
|
||||||
|
promotionUrl := fmt.Sprintf(PromotionUrl, req.Sid, a.client.authConfig.UserId)
|
||||||
|
return promotionUrl, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ func (a *apiClientSuite) SetupSuite() {
|
|||||||
|
|
||||||
func (a *apiClientSuite) Test_ZoneAdd() {
|
func (a *apiClientSuite) Test_ZoneAdd() {
|
||||||
req := ZoneAddRequest{}
|
req := ZoneAddRequest{}
|
||||||
result, err := a.api.ZoneAdd(&req)
|
result, err := a.api.ZoneAdd(context.Background(), req)
|
||||||
if !a.NoError(err) {
|
if !a.NoError(err) {
|
||||||
a.T().Errorf("========[Test_GenerateLink] response error:%s", err)
|
a.T().Errorf("========[Test_GenerateLink] response error:%s", err)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package zjdg
|
package zjdg
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ZoneAddUrl = "https://p.zjdg.cn/cpa/api/ugApi.ashx?method=getadzone_nologin&userid="
|
ZoneAddUrl = "https://p.zjdg.cn/cpa/api/ugApi.ashx?method=getadzone_nologin&userid="
|
||||||
|
PromotionUrl = "http://2025.zjdg.cn/ditui/qrcode?adzoneid=%s&userid=%s"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
package zjdg
|
package zjdg
|
||||||
|
|
||||||
|
// GenerateH5UrlRequest 生成H5链接请求
|
||||||
|
type GenerateH5UrlRequest struct {
|
||||||
|
ActivityUrl string `json:"activityUrl"` // 活动url
|
||||||
|
Sid string `json:"sid"` // 二级分销ID
|
||||||
|
}
|
||||||
|
|
||||||
type ZoneAddRequest struct {
|
type ZoneAddRequest struct {
|
||||||
}
|
}
|
||||||
type ZoneAddResponse struct {
|
type ZoneAddResponse struct {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user