1
This commit is contained in:
@@ -3,6 +3,7 @@ package enterprise_wechat
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"go.uber.org/zap"
|
||||
"strconv"
|
||||
"testing"
|
||||
@@ -26,7 +27,6 @@ func init() {
|
||||
}
|
||||
|
||||
func TestGetToken(t *testing.T) {
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss")
|
||||
token, err := api.GetAccessToken()
|
||||
if err != nil {
|
||||
fmt.Println("err=", err)
|
||||
@@ -60,7 +60,6 @@ func TestGetAllDepartmentList(t *testing.T) {
|
||||
|
||||
// 创建员工
|
||||
func TestCreateStaff(t *testing.T) {
|
||||
api = New("ww9a156bfa070e1857", "0jBdCjSmoFiOoHIXyeCK9VbGQ82fVNJZ8uMl6JNN7X4") // 通讯录
|
||||
err := api.CreateBoss2JxStaff(&CreateBoos2JXStaffReq{
|
||||
Userid: "jx2022524_6685111",
|
||||
Name: "门店老板",
|
||||
@@ -94,7 +93,6 @@ func TestGetUserByMobile(t *testing.T) {
|
||||
|
||||
// 创建会话群聊
|
||||
func TestCreateSession(t *testing.T) {
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss") // 小程序
|
||||
err := api.CreateAppChat(&CreateAppChatParamReq{
|
||||
UserList: []string{"WangXiao", "LiuLei"},
|
||||
Name: "刘磊的企业微信群1",
|
||||
@@ -104,7 +102,30 @@ func TestCreateSession(t *testing.T) {
|
||||
fmt.Println("err======", err)
|
||||
}
|
||||
|
||||
func TestGetSuiteTicket(t *testing.T) {
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss") // 小程序
|
||||
|
||||
// 发送消息到企业微信
|
||||
func TestSendMsg(t *testing.T) {
|
||||
msg := &EnterpriseSendMsgReq{
|
||||
Touser: "LiuLei",
|
||||
Toparty: "",
|
||||
Totag: "",
|
||||
Msgtype: "textcard",
|
||||
Agentid: 1000005,
|
||||
Textcard: TextCardObject{
|
||||
Title: "异步任务",
|
||||
Description: "刚刚的同步任务下载链接",
|
||||
Url: "https://www.baidu.com",
|
||||
Btntxt: "详情",
|
||||
},
|
||||
EnableIdTrans: 0,
|
||||
EnableDuplicateCheck: 0,
|
||||
DuplicateCheckInterval: 0,
|
||||
}
|
||||
err := api.SendMsgToUser(msg)
|
||||
fmt.Println("err === ", err)
|
||||
}
|
||||
|
||||
// 获取员工信息
|
||||
func TestGetUserId(t *testing.T) {
|
||||
phone, err := api.GetUserIdByMobile("18981810340")
|
||||
globals.SugarLogger.Debugf("phone := %s,err :=%s", phone, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user