dingtalk

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeText       = "text"
	MessageTypeImage      = "image"
	MessageTypeVoice      = "voice"
	MessageTypeFile       = "file"
	MessageTypeLink       = "link"
	MessageTypeMarkdown   = "markdown"
	MessageTypeActionCard = "action_card"
)

Variables

View Source
var DingTalkCryptoMap = make(map[uint64]*dingTalkCrypto)

Functions

func GetDecryptMsg

func GetDecryptMsg(source *model.ThirdSource, signature, timestamp, nonce, secretMsg string) (msg string, err error)

func GetEncryptMsg

func GetEncryptMsg(source *model.ThirdSource, msg string) (result map[string]string, err error)

func GetStaffIdByCode

func GetStaffIdByCode(source *model.ThirdSource, authCode string) (string, error)

func GetStaffIdListInDepartment

func GetStaffIdListInDepartment(source *model.ThirdSource, dingtalkDeptId string) ([]string, error)

func GetUser

func GetUser(source *model.ThirdSource, staffId string) (string, error)

func GetUserOutsideDingtalk

func GetUserOutsideDingtalk(source *model.ThirdSource, code string) (staffId, unionId string, err error)

GetUserOutsideDingtalk 根据code获取用户信息(浙政钉外三方应用扫码登录)

func SendMessage

func SendMessage(source *model.ThirdSource, dingStaffIdList []string, msg *Message) (taskId string, err error)

Types

type DeptLeaderInfo

type DeptLeaderInfo struct {
	DeptId int
	Leader bool
}

type GetDepartmentResponse

type GetDepartmentResponse struct {
	DeptId   string
	Name     string
	ParentId string

	OrderNum    int
	HasChildren bool

	OriginalJson string
}

func GetChildrenDepartments

func GetChildrenDepartments(source *model.ThirdSource, parentId string) ([]*GetDepartmentResponse, error)

func GetDepartment

func GetDepartment(source *model.ThirdSource, externalDeptId string) (*GetDepartmentResponse, error)

type GetUserResponse

type GetUserResponse struct {
	StaffId        string
	UnionId        string
	Name           string
	Avatar         string
	ManagerStaffId string
	JobNumber      string
	Title          string
	LoginId        string
	DeptIdList     []int
	Senior         bool              // 高管
	Admin          bool              // 管理员
	Boss           bool              // 老板
	LeaderInfoList []*DeptLeaderInfo // 部门中是否领导
}

type Message

type Message struct {
	MsgType string `json:"msgtype"` // text/image/voice/file/link/markdown/action_card
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	Image struct {
		MediaId string `json:"media_id"`
	} `json:"image"`
	Voice struct {
		MediaId  string `json:"media_id"`
		Duration string `json:"duration"`
	} `json:"voice"`
	File struct {
		MediaId string `json:"media_id"`
	} `json:"file"`
	Link struct {
		Title      string `json:"title"`
		Text       string `json:"text"`
		PicUrl     string `json:"picUrl"`
		MessageUrl string `json:"messageUrl"`
	} `json:"link"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	ActionCard struct {
		Title       string `json:"title"`
		Markdown    string `json:"markdown"`
		SingleTitle string `json:"single_title"`
		SingleUrl   string `json:"single_url"`
	} `json:"action_card"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL