package contact import ( "dashoo.cn/opms_libary/plugin/dingtalk/base" "dashoo.cn/opms_libary/plugin/dingtalk/context" "encoding/json" "github.com/gogf/gf/frame/g" ) const ( QueryUserIdByPhoneUrl = "https://oapi.dingtalk.com/topapi/v2/user/getbymobile" QueryUserInfoByUserIdUrl = "https://oapi.dingtalk.com/topapi/v2/user/get" ) //Contact 通讯录 type Contact struct { base.Base } //NewContact init func NewContact(context *context.Context) *Contact { material := new(Contact) material.Context = context return material } func (c *Contact) QueryUserIdByPhone(phone string) (response QueryUserIdResponse) { body, _ := c.HTTPPostJSONWithAccessToken(QueryUserIdByPhoneUrl, g.Map{"mobile": phone}) json.Unmarshal(body, &response) return response } func (c *Contact) QueryUserInfoByUserId(userid string) (response QueryUserInfoResponse) { body, _ := c.HTTPPostJSONWithAccessToken(QueryUserInfoByUserIdUrl, g.Map{"userid": userid}) json.Unmarshal(body, &response) return response }