34 lines
793 B
Go
34 lines
793 B
Go
package youpiaopiao
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
// YouPiaoPiaoApi 有票票
|
|
type YouPiaoPiaoApi interface {
|
|
// GenerateH5Url 生成H5链接
|
|
GenerateH5Url(ctx context.Context, req GenerateH5UrlRequest) (string, error)
|
|
}
|
|
type youpiaopiaoApiImpl struct {
|
|
log logx.Logger
|
|
client *Client
|
|
}
|
|
|
|
func newYoupiaopiaoApiImpl(log logx.Logger, client *Client) YouPiaoPiaoApi {
|
|
return &youpiaopiaoApiImpl{
|
|
log: log,
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// GenerateH5Url 生成H5推广链接
|
|
func (a *youpiaopiaoApiImpl) GenerateH5Url(ctx context.Context, req GenerateH5UrlRequest) (string, error) {
|
|
if len(req.ActivityUrl) == 0 {
|
|
return "", errors.New("url参数不能为空")
|
|
}
|
|
return fmt.Sprintf("%s&entpara=%s", req.ActivityUrl, req.Sid), nil
|
|
}
|