1 Star 0 Fork 0

我不吃植物/wechat-sdk-go

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
open_platform_base.go 2.36 KB
一键复制 编辑 原始数据 按行查看 历史
我不吃植物 提交于 2019-11-26 20:38 +08:00 . 优化业务
package wechat_sdk_go
func (op *OpenPlatform) CreatePreAuthorizationCode() ([]byte, error) {
url := "cgi-bin/component/api_create_preauthcode"
json := map[string]interface{}{
"component_appid": op.appid,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func (op *OpenPlatform) HandleAuthorize(authCode string) ([]byte, error) {
url := "cgi-bin/component/api_query_auth"
json := map[string]interface{}{
"component_appid": op.appid,
"authorization_code": authCode,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func (op *OpenPlatform) GetAuthorizerToken(appid string, refreshToken string) ([]byte, error) {
url := "cgi-bin/component/api_authorizer_token"
json := map[string]interface{}{
"component_appid": op.appid,
"authorizer_appid": appid,
"authorizer_refresh_token": refreshToken,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func (op *OpenPlatform) GetAuthorizer(appid string) ([]byte, error) {
url := "cgi-bin/component/api_get_authorizer_info"
json := map[string]interface{}{
"component_appid": op.appid,
"authorizer_appid": appid,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func (op *OpenPlatform) GetAuthorizerOption(appid string, optionName string) ([]byte, error) {
url := "cgi-bin/component/api_get_authorizer_option"
json := map[string]interface{}{
"component_appid": op.appid,
"authorizer_appid": appid,
"option_name": optionName,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func (op *OpenPlatform) SetAuthorizerOption(appid string, optionName string, optionValue string) ([]byte, error) {
url := "cgi-bin/component/api_set_authorizer_option"
json := map[string]interface{}{
"component_appid": op.appid,
"authorizer_appid": appid,
"option_name": optionName,
"option_value": optionValue,
}
rep, err := op.request.HttpPostJson(url, HttpOption{
json,
nil,
})
return handlerRequestResult(rep, err)
}
func handlerRequestResult(rep Response, err error) ([]byte, error) {
if nil != err {
return nil, err
}
return rep.GetBody()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/tq1024/wechat-sdk-go.git
git@gitee.com:tq1024/wechat-sdk-go.git
tq1024
wechat-sdk-go
wechat-sdk-go
3744ff022bcc

搜索帮助