mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-22 00:04:06 +00:00
* 添加站内信 * s * s * 添加接口 * fix * fix * 重构了一些 * 完成 * 完善 * s * s * s * s * s * s * 测试ok * 替换业务中发送消息的方式 * 修改 * s * 去掉 update 兼容 create * 添加 unread total 接口 * 调整json字段 Co-authored-by: xinwen <coderWen@126.com>
21 lines
594 B
Python
21 lines
594 B
Python
from django.conf import settings
|
|
|
|
from common.message.backends.dingtalk import DingTalk as Client
|
|
from .base import BackendBase
|
|
|
|
|
|
class DingTalk(BackendBase):
|
|
account_field = 'dingtalk_id'
|
|
is_enable_field_in_settings = 'AUTH_DINGTALK'
|
|
|
|
def __init__(self):
|
|
self.dingtalk = Client(
|
|
appid=settings.DINGTALK_APPKEY,
|
|
appsecret=settings.DINGTALK_APPSECRET,
|
|
agentid=settings.DINGTALK_AGENTID
|
|
)
|
|
|
|
def send_msg(self, users, msg):
|
|
accounts, __, __ = self.get_accounts(users)
|
|
return self.dingtalk.send_text(accounts, msg)
|