守兔演出链接生成
This commit is contained in:
parent
4c4478dc84
commit
982f6981d4
@ -37,7 +37,7 @@ func (a *ShouTuShowApiImpl) GenerateLink(ctx context.Context, req GenerateLinkRe
|
|||||||
//直接替换
|
//直接替换
|
||||||
newUrl := strings.ReplaceAll(req.ActivityUrl, "subChannelId=", fmt.Sprintf("subChannelId=%s", req.Sid))
|
newUrl := strings.ReplaceAll(req.ActivityUrl, "subChannelId=", fmt.Sprintf("subChannelId=%s", req.Sid))
|
||||||
return &GenerateLinkResponse{
|
return &GenerateLinkResponse{
|
||||||
H5: newUrl,
|
MiniProgramUrl: newUrl,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
platform/shoutu-show/api_test.go
Normal file
46
platform/shoutu-show/api_test.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package shoutu_show
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/stretchr/testify/suite"
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// api-单元测试
|
||||||
|
type apiClientSuite struct {
|
||||||
|
suite.Suite
|
||||||
|
api ShouTuShowApi
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestApiClient(t *testing.T) {
|
||||||
|
suite.Run(t, new(apiClientSuite))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *apiClientSuite) SetupSuite() {
|
||||||
|
log := logx.WithContext(context.Background())
|
||||||
|
apiClient := NewApiClient(log, AuthConfig{
|
||||||
|
AppKey: "", //
|
||||||
|
AppSecret: "",
|
||||||
|
})
|
||||||
|
a.api = apiClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *apiClientSuite) Test_GenerateLink() {
|
||||||
|
req := GenerateLinkRequest{
|
||||||
|
ActivityUrl: "pages/index/index?distributorId=VCiCWwU2&subChannelId=",
|
||||||
|
Sid: "f3a8c1",
|
||||||
|
}
|
||||||
|
result, err := a.api.GenerateLink(context.Background(), req)
|
||||||
|
if !a.NoError(err) {
|
||||||
|
a.T().Errorf("========[Test_GenerateLink] response error:%s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resultByte, err := json.Marshal(result)
|
||||||
|
if err != nil {
|
||||||
|
a.T().Errorf("========[Test_GenerateLink] json_marshal error:%s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a.T().Logf("=====[Test_GenerateLink] result: %s", string(resultByte))
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ type GenerateLinkRequest struct {
|
|||||||
// GenerateLinkResponse 生成推广链接响应
|
// GenerateLinkResponse 生成推广链接响应
|
||||||
type GenerateLinkResponse struct {
|
type GenerateLinkResponse struct {
|
||||||
H5 string `json:"h5"` // H5链接
|
H5 string `json:"h5"` // H5链接
|
||||||
|
MiniProgramUrl string `json:"MiniProgramUrl"` //小程序链接
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryOrderListRequest struct {
|
type QueryOrderListRequest struct {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user