Skip to content

Commit d0774b3

Browse files
authored
Merge pull request #129 from ArtisanCloud/develop
refact(wecom): external contact request media struct
2 parents fb5de63 + 14de118 commit d0774b3

File tree

5 files changed

+28
-41
lines changed

5 files changed

+28
-41
lines changed

src/work/externalContact/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (comp *Client) GetFollowUsers() (*response.ResponseGetFollowUserList, error
3737
}
3838

3939
// 获取外部联系人列表.
40-
// https://work.weixin.qq.com/api/doc/90000/90135/92113
40+
// https://developer.work.weixin.qq.com/document/path/92113
4141
func (comp *Client) List(userID string) (*response.ResponseGetList, error) {
4242

4343
result := &response.ResponseGetList{}
@@ -50,7 +50,7 @@ func (comp *Client) List(userID string) (*response.ResponseGetList, error) {
5050
}
5151

5252
// 获取外部联系人详情.
53-
// https://work.weixin.qq.com/api/doc/90000/90135/92114
53+
// https://developer.work.weixin.qq.com/document/path/92114
5454
func (comp *Client) Get(externalUserID string, cursor string) (*weCom.ResponseGetExternalContact, error) {
5555

5656
result := &weCom.ResponseGetExternalContact{}

src/work/externalContact/contactWay/request/requestAddContactWay.go

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
package request
22

3-
type Text struct {
4-
Content string `json:"content"`
5-
}
6-
7-
type Image struct {
8-
MediaID string `json:"media_id"`
9-
}
10-
11-
type MiniProgram struct {
12-
Title string `json:"title"`
13-
PicMediaID string `json:"pic_media_id"`
14-
Appid string `json:"appid"`
15-
Page string `json:"page"`
16-
}
17-
18-
type Link struct {
19-
Title string `json:"title"`
20-
PicURL string `json:"picurl"`
21-
Desc string `json:"desc"`
22-
URL string `json:"url"`
23-
}
3+
import "github.com/ArtisanCloud/PowerWeChat/v2/src/work/externalContact/messageTemplate/request"
244

255
type Conclusions struct {
26-
Text *Text `json:"text"`
27-
Image *Image `json:"image"`
28-
Link *Link `json:"link"`
29-
MiniProgram *MiniProgram `json:"miniprogram"`
6+
Text *request.TextOfMessage `json:"text"`
7+
Image *request.Image `json:"image"`
8+
Link *request.Link `json:"link"`
9+
MiniProgram *request.MiniProgram `json:"miniprogram"`
3010
}
3111

3212
type RequestAddContactWay struct {

src/work/externalContact/messageTemplate/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (comp *Client) GetGroupMsgSendResult(msgID string, userID string, limit int
8181
}
8282

8383
// 发送新客户欢迎语
84-
// https://work.weixin.qq.com/api/doc/90000/90135/93338
84+
// https://developer.work.weixin.qq.com/document/path/92599
8585
func (comp *Client) SendWelcomeMsg(options *request.RequestSendWelcomeMsg) (*response2.ResponseWork, error) {
8686

8787
result := &response2.ResponseWork{}
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
package request
22

3-
import "github.com/ArtisanCloud/PowerWeChat/v2/src/kernel/power"
3+
type Attachment struct {
4+
MsgType string `json:"msgtype"`
5+
Image *Image `json:"image,omitempty"`
6+
Link *Link `json:"link,omitempty"`
7+
MiniProgram *MiniProgram `json:"miniprogram,omitempty"`
8+
Video *Video `json:"video,omitempty"`
9+
File *File `json:"file,omitempty"`
10+
}
411

512
type RequestSendWelcomeMsg struct {
6-
WelcomeCode string `json:"welcome_code"`
7-
Text *TextOfMessage `json:"text"`
8-
Attachments []*power.HashMap `json:"attachments"`
13+
WelcomeCode string `json:"welcome_code"`
14+
Text *TextOfMessage `json:"text"`
15+
Attachments []*Attachment `json:"attachments"`
916
}

src/work/user/client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (comp *Client) Get(userID string) (*response.ResponseGetUserDetail, error)
8989
}
9090

9191
// 获取部门的成员
92-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90200
92+
// https://developer.work.weixin.qq.com/document/path/90200
9393
func (comp *Client) GetDepartmentUsers(departmentID int, fetchChild int) (*response.ResponseGetSimpleUserList, error) {
9494

9595
result := &response.ResponseGetSimpleUserList{}
@@ -103,7 +103,7 @@ func (comp *Client) GetDepartmentUsers(departmentID int, fetchChild int) (*respo
103103
}
104104

105105
// 获取部门成员详情
106-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90201
106+
// https://developer.work.weixin.qq.com/document/path/90201
107107
func (comp *Client) GetDetailedDepartmentUsers(departmentID int, fetchChild int) (*response.ResponseGetUserList, error) {
108108

109109
result := &response.ResponseGetUserList{}
@@ -117,7 +117,7 @@ func (comp *Client) GetDetailedDepartmentUsers(departmentID int, fetchChild int)
117117
}
118118

119119
// userid与openid互换
120-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90202
120+
// https://developer.work.weixin.qq.com/document/path/90202
121121
func (comp *Client) UserIdToOpenID(userID string) (*response.ResponseUserIDToOpenID, error) {
122122

123123
result := &response.ResponseUserIDToOpenID{}
@@ -129,8 +129,8 @@ func (comp *Client) UserIdToOpenID(userID string) (*response.ResponseUserIDToOpe
129129
return result, err
130130
}
131131

132-
// userid与openid互换
133-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90202
132+
// openid转userid
133+
// https://developer.work.weixin.qq.com/document/path/90202
134134
func (comp *Client) OpenIDToUserID(openID string) (*response.ResponseOpenIDToUserID, error) {
135135

136136
result := &response.ResponseOpenIDToUserID{}
@@ -142,8 +142,8 @@ func (comp *Client) OpenIDToUserID(openID string) (*response.ResponseOpenIDToUse
142142
return result, err
143143
}
144144

145-
// userid与openid互换
146-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90202
145+
// 手机号获取userid
146+
// https://developer.work.weixin.qq.com/document/path/95402
147147
func (comp *Client) MobileToUserID(mobile string) (*response.ResponseMobileToUserID, error) {
148148

149149
result := &response.ResponseMobileToUserID{}
@@ -156,7 +156,7 @@ func (comp *Client) MobileToUserID(mobile string) (*response.ResponseMobileToUse
156156
}
157157

158158
// 二次验证
159-
// https://open.work.weixin.qq.com/api/doc/90000/90135/90203
159+
// https://developer.work.weixin.qq.com/document/path/90203
160160
func (comp *Client) Accept(userID string) (*response2.ResponseWork, error) {
161161

162162
result := &response2.ResponseWork{}
@@ -180,7 +180,7 @@ func (comp *Client) Invite(params *power.HashMap) (*response.ResponseMobileToUse
180180
}
181181

182182
// 获取加入企业二维码
183-
// https://open.work.weixin.qq.com/api/doc/90000/90135/91714
183+
// https://developer.work.weixin.qq.com/document/path/91714
184184
func (comp *Client) GetJoinQrCode(sizeType int) (*response.ResponseJoinCode, error) {
185185

186186
if sizeType < 1 || sizeType > 4 {

0 commit comments

Comments
 (0)