-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from royalrick/develop
增加接口: 获取直播间分享二维码
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |