抖音二维码
This commit is contained in:
47
platformapi/tiktok/tiktok_qr_code.go
Normal file
47
platformapi/tiktok/tiktok_qr_code.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package tiktok
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
// 获取抖音小程序二维码
|
||||
func (a *API) GetTiktokQrCode() error {
|
||||
param := &QrCode{
|
||||
AppName: "douyin",
|
||||
AccessToken: "",
|
||||
Path: "pages/index/index",
|
||||
Width: 0,
|
||||
LineColor: nil,
|
||||
Background: nil,
|
||||
SetIcon: true,
|
||||
}
|
||||
a.CheckTokenIsExist()
|
||||
param.AccessToken = a.msgToken
|
||||
qrCode, err := a.AccessAPI2(GetTiktokQrCode, utils.Struct2MapByJson(param))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("qrcode", qrCode)
|
||||
return err
|
||||
}
|
||||
|
||||
//type QrCodeRes struct {
|
||||
// ErrCode int64 `json:"errcode"`
|
||||
// ErrCode int64 `json:"errcode"`
|
||||
//}
|
||||
|
||||
type QrCode struct {
|
||||
AppName string `json:"appname"` // 是打开二维码的字节系 app 名称,默认为今日头条,取值如下表所示
|
||||
AccessToken string `json:"access_token"` // 服务端 API 调用标识,获取方法
|
||||
Path string `json:"path"` // 小程序/小游戏启动参数,小程序则格式为 encode({path}?{query}),
|
||||
Width int `json:"width"` // 二维码宽度
|
||||
LineColor *LineColor `json:"line_color"` // 二维码线条颜色
|
||||
Background *LineColor `json:"background"` // 二维码背景颜色
|
||||
SetIcon bool `json:"set_icon"` // 是否展示小程序/小游戏 icon
|
||||
}
|
||||
type LineColor struct {
|
||||
R int `json:"r"`
|
||||
G int `json:"g"`
|
||||
B int `json:"b"`
|
||||
}
|
||||
Reference in New Issue
Block a user