Skip to content

Commit

Permalink
Merge pull request #64 from royalrick/develop
Browse files Browse the repository at this point in the history
增加接口: 获取直播间分享二维码
  • Loading branch information
royalrick authored Sep 22, 2021
2 parents 975c5b1 + 2501004 commit a475d35
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions livebroadcast/get_shared_code.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package livebroadcast

import "github.com/medivhzhan/weapp/v3/request"

const apigetSharedCode = "/wxaapi/broadcast/room/getsharedcode"

type getSharedCodeRequest struct {
// 房间ID
RoomId int64 `json:"roomId"`
// 自定义参数
Params int64 `json:"params"`
}

type getSharedCodeResponse struct {
request.CommonError
// 分享二维码地址
CdnUrl string `json:"cdnUrl"`
// 分享路径
PagePath string `json:"pagePath"`
// 分享海报地址
PosterUrl string `json:"posterUrl"`
}

// 获取直播间分享二维码
func (cli *LiveBroadcast) GetSharedCode(req *getSharedCodeRequest) (*getSharedCodeResponse, error) {

api, err := cli.conbineURI(apigetSharedCode, req)
if err != nil {
return nil, err
}

res := new(getSharedCodeResponse)
err = cli.request.Get(api, res)
if err != nil {
return nil, err
}

return res, nil
}

0 comments on commit a475d35

Please sign in to comment.