81 lines
1.3 KiB
Go
81 lines
1.3 KiB
Go
package constants
|
|
|
|
import "net/url"
|
|
|
|
const DingTalkBseUrl = "https://oapi.dingtalk.com"
|
|
|
|
type RequestUrl string
|
|
|
|
const (
|
|
RequestUrlGetUserGet RequestUrl = "/topapi/v2/user/get"
|
|
RequestUrlGetDeptGet RequestUrl = "/topapi/v2/department/get"
|
|
)
|
|
|
|
func GetDingTalkRequestUrl(path RequestUrl, query map[string]string) string {
|
|
u, _ := url.Parse(DingTalkBseUrl + string(path))
|
|
q := u.Query()
|
|
for key, val := range query {
|
|
q.Add(key, val)
|
|
}
|
|
u.RawQuery = q.Encode()
|
|
return u.String()
|
|
}
|
|
|
|
// IsBoss 是否是老板
|
|
type IsBoss int
|
|
|
|
const (
|
|
IsBossTrue IsBoss = 1
|
|
IsBossFalse IsBoss = 0
|
|
)
|
|
|
|
// IsSenior 是否是老板
|
|
type IsSenior int
|
|
|
|
const (
|
|
IsSeniorTrue IsSenior = 1
|
|
IsSeniorFalse IsSenior = 0
|
|
)
|
|
|
|
type ConversationType string
|
|
|
|
const (
|
|
ConversationTypeSingle = "1" // 单聊
|
|
ConversationTypeGroup = "2" //群聊
|
|
)
|
|
|
|
type BotMsgType string
|
|
|
|
const (
|
|
BotMsgTypeText BotMsgType = "text"
|
|
)
|
|
|
|
type CardTemp string
|
|
|
|
const (
|
|
CardTempDefault CardTemp = `{
|
|
"config": {
|
|
"autoLayout": true,
|
|
"enableForward": true
|
|
},
|
|
"header": {
|
|
"title": {
|
|
"type": "text",
|
|
"text": "${title}",
|
|
},
|
|
"logo": "@lALPDfJ6V_FPDmvNAfTNAfQ"
|
|
},
|
|
"contents": [
|
|
{
|
|
"type": "divider",
|
|
"id": "divider_1765952728523"
|
|
},
|
|
{
|
|
"type": "markdown",
|
|
"text": "%s",
|
|
"id": "markdown_1765970168635"
|
|
}
|
|
]
|
|
}`
|
|
)
|