Skip to content

Commit

Permalink
支持个人小程序
Browse files Browse the repository at this point in the history
  • Loading branch information
icepy committed Apr 27, 2018
1 parent 63e50e9 commit fc3dcb2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ DingTalk Golang SDK https://github.com/icepy

# Feature Overview

- 支持ISV,企业,SSO,SNS免登
- 支持ISV,企业,SSO,SNS(H5 Web App)免登
- 支持个人小程序免登
- 支持对access_token自动续期过期管理(已使用独占锁,请勿再加锁)
- 支持注册钉钉事件回调
- 支持对钉钉事件回调消息签名的加解密
Expand Down
4 changes: 2 additions & 2 deletions src/dingtalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ func NewDingTalkCompanyClient(config *DTConfig) *DingTalkClient {
return NewDingTalkClient("company", config)
}

func NewDingTalkMiniClient() {

func NewDingTalkMiniClient(config *DTConfig) *DingTalkClient {
return NewDingTalkClient("personalMini", config)
}
10 changes: 10 additions & 0 deletions src/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ func (dtc *DingTalkClient) httpRPC(path string, params url.Values, requestData i
panic(errors.New("ERROR: *DTIsvGetCompanyInfo Error"))
}
}
if dtc.DevType == "personalMini"{
if dtc.SNSAccessToken != "" && path != "sns/getuserinfo" {
if params == nil {
params = url.Values{}
}
if params.Get("access_token") == "" {
params.Set("access_token", dtc.SNSAccessToken)
}
}
}
return dtc.httpRequest("oapi", path, params, requestData, responseData)
}

Expand Down

0 comments on commit fc3dcb2

Please sign in to comment.