tm_service.go 778 Bytes
package tm

import (
	"context"
	"encoding/json"
	"github.com/gogf/gf/util/gconv"
)

// serviceTm 客服
type serviceTm struct {
}

var Service = serviceTm{}

type ServiceUrlRes struct {
	Message string `json:"Message"`
	UrlData struct {
		ReturnUrl string `json:"ReturnUrl"`
	} `json:"UrlData"`
	Code string `json:"Code"`
}

// Url 客服链接
func (s *serviceTm) Url(ctx context.Context, SellerId, UserId interface{}) (res *ServiceUrlRes, err error) {
	method := "getCustomServiceUrl"

	request := map[string]string{
		"BizUid":           server.BizUid,
		"SellerId":         gconv.String(SellerId),
		"AccountType":      "ANONY",
		"ThirdPartyUserId": gconv.String(UserId),
	}

	result, err := post(ctx, method, request)
	_ = json.Unmarshal([]byte(result), &res)

	return
}