1
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"go.uber.org/zap"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -16,7 +17,9 @@ func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss")
|
||||
//api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss") // 小程序
|
||||
api = New("ww9a156bfa070e1857", "0jBdCjSmoFiOoHIXyeCK9VbGQ82fVNJZ8uMl6JNN7X4") // 通讯录
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss") // 小程序
|
||||
//api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
|
||||
//token, _ := api.GetAccessToken()
|
||||
//api.accessToken = token.BusinessDataObj.AccessToken
|
||||
@@ -36,5 +39,66 @@ func TestGetToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAPI_GetDepartmentList(t *testing.T) {
|
||||
|
||||
var aa int = 10004
|
||||
fmt.Println(aa)
|
||||
cc := strconv.Itoa(int(aa))
|
||||
bb := string(aa)
|
||||
fmt.Println(bb)
|
||||
fmt.Println(cc)
|
||||
ee := "四川省"
|
||||
fmt.Println(ee[0:6])
|
||||
}
|
||||
|
||||
// 获取所有的部门
|
||||
func TestGetAllDepartmentList(t *testing.T) {
|
||||
data, err := api.GetAllDepartmentList()
|
||||
fmt.Println(err)
|
||||
for _, v := range data {
|
||||
fmt.Println(v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// 创建员工
|
||||
func TestCreateStaff(t *testing.T) {
|
||||
err := api.CreateBoss2JxStaff(&CreateBoos2JXStaffReq{
|
||||
Userid: "jx2022524_668511",
|
||||
Name: "门店老板",
|
||||
Alias: "",
|
||||
Mobile: "18981810341",
|
||||
Department: []int{18}, // 四川省
|
||||
Order: nil,
|
||||
Position: "老板_群主",
|
||||
Gender: "1",
|
||||
Email: "",
|
||||
IsLeaderInDept: []int{1},
|
||||
Enable: 0,
|
||||
AvatarMediaid: "",
|
||||
Telephone: "",
|
||||
Address: "",
|
||||
Extattr: Extattr{},
|
||||
MainDepartment: 0,
|
||||
ToInvite: true,
|
||||
ExternalPosition: "",
|
||||
ExternalProfile: ExternalProfile{},
|
||||
})
|
||||
fmt.Println("err", err)
|
||||
}
|
||||
|
||||
// 手机账号获取用户信息
|
||||
func TestGetUserByMobile(t *testing.T) {
|
||||
mobile, err := api.GetUserIdByMobile("18981810351")
|
||||
fmt.Println(err)
|
||||
fmt.Println(mobile)
|
||||
}
|
||||
|
||||
// 创建会话群聊
|
||||
func TestCreateSession(t *testing.T) {
|
||||
api = New("ww9a156bfa070e1857", "JQsEmSTltHhNgdPIT320YJFphiYmRs-YZa-rCBwplss") // 小程序
|
||||
err := api.CreateAppChat(&CreateAppChatParamReq{
|
||||
UserList: []string{"jx2022524_668511", "LiuLei"},
|
||||
Name: "test1liulei",
|
||||
Owner: "LiuLei",
|
||||
ChatId: "11112",
|
||||
})
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user