1.新增微信通知方式
2.通知模板变量更改 3.删除沉余sql 4.readme.md更新
This commit is contained in:
14
README.md
14
README.md
@@ -94,10 +94,9 @@ jobs.pool = 1000
|
||||
# 站点名称
|
||||
site.name = 定时任务管理器
|
||||
|
||||
#通知方式 0=邮件,1=信息
|
||||
#通知方式 0=邮件,1=信息,2=钉钉,3=微信
|
||||
notify.type = 0
|
||||
|
||||
|
||||
# 数据库配置
|
||||
db.host = 127.0.0.1
|
||||
db.user = root
|
||||
@@ -115,10 +114,17 @@ email.user = ci@xxx.cn
|
||||
email.password = "xxxxxx"
|
||||
email.pool = 10
|
||||
|
||||
|
||||
# 短信通知方式配置
|
||||
msg.url = http://chanxiyou.com/api/tools/send_sms
|
||||
msg.pool = 10
|
||||
|
||||
# 钉钉通知配置
|
||||
dingtalk.url = "https://oapi.dingtalk.com/robot/send?access_token=%s"
|
||||
dingtalk.pool = 10
|
||||
|
||||
# 微信通知方式配置
|
||||
wechat.url = http://xx.com/api/tools/send_wechat
|
||||
wechat.pool = 10
|
||||
```
|
||||
|
||||
编译安装-可能会遇到的问题
|
||||
@@ -128,6 +134,8 @@ jobs/job.go:19:2: cannot find package "golang.org/x/crypto/ssh" in any of:
|
||||
|
||||
需要 git clone https://github.com/golang/crypto.git
|
||||
并拷贝到 $GOPATH/src/golang.org/x/ 下就OK
|
||||
或
|
||||
git clone https://github.com/golang/crypto.git $GOPATH/src/golang.org/x/crypto
|
||||
|
||||
# Docker
|
||||
本地编译好的2进制文件放在根目录下执行下面的命令即可拥有
|
||||
|
||||
@@ -11,10 +11,9 @@ jobs.pool = 1000
|
||||
# 站点名称
|
||||
site.name = 定时任务管理器
|
||||
|
||||
#通知方式 0=邮件,1=信息,2=钉钉
|
||||
#通知方式 0=邮件,1=信息,2=钉钉,3=微信
|
||||
notify.type = 0
|
||||
|
||||
|
||||
# 数据库配置
|
||||
db.host = 127.0.0.1
|
||||
db.user = root
|
||||
@@ -32,12 +31,14 @@ email.user = ci@xxx.cn
|
||||
email.password = "xxxxxx"
|
||||
email.pool = 10
|
||||
|
||||
|
||||
# 短信通知方式配置
|
||||
msg.url = http://xx.com/api/tools/send_sms
|
||||
msg.pool = 10
|
||||
|
||||
|
||||
# 钉钉通知配置
|
||||
dingtalk.url = "https://oapi.dingtalk.com/robot/send?access_token=%s"
|
||||
dingtalk.pool = 10
|
||||
|
||||
# 微信通知方式配置
|
||||
wechat.url = http://xx.com/api/tools/send_wechat
|
||||
wechat.pool = 10
|
||||
@@ -59,6 +59,7 @@ func (self *AdminController) Edit() {
|
||||
row["phone"] = Admin.Phone
|
||||
row["email"] = Admin.Email
|
||||
row["dingtalk"] = Admin.Dingtalk
|
||||
row["wechat"] = Admin.Wechat
|
||||
row["role_ids"] = Admin.RoleIds
|
||||
self.Data["admin"] = row
|
||||
|
||||
@@ -95,6 +96,7 @@ func (self *AdminController) AjaxSave() {
|
||||
Admin.Phone = strings.TrimSpace(self.GetString("phone"))
|
||||
Admin.Email = strings.TrimSpace(self.GetString("email"))
|
||||
Admin.Dingtalk = strings.TrimSpace(self.GetString("dingtalk"))
|
||||
Admin.Wechat = strings.TrimSpace(self.GetString("wechat"))
|
||||
Admin.RoleIds = strings.TrimSpace(self.GetString("roleids"))
|
||||
Admin.UpdateTime = time.Now().Unix()
|
||||
Admin.UpdateId = self.userId
|
||||
@@ -128,6 +130,7 @@ func (self *AdminController) AjaxSave() {
|
||||
Admin.Phone = strings.TrimSpace(self.GetString("phone"))
|
||||
Admin.Email = strings.TrimSpace(self.GetString("email"))
|
||||
Admin.Dingtalk = strings.TrimSpace(self.GetString("dingtalk"))
|
||||
Admin.Wechat = strings.TrimSpace(self.GetString("wechat"))
|
||||
Admin.RoleIds = strings.TrimSpace(self.GetString("roleids"))
|
||||
Admin.UpdateTime = time.Now().Unix()
|
||||
Admin.UpdateId = self.userId
|
||||
@@ -207,6 +210,7 @@ func (self *AdminController) Table() {
|
||||
row["phone"] = v.Phone
|
||||
row["email"] = v.Email
|
||||
row["dingtalk"] = v.Dingtalk
|
||||
row["wechat"] = v.Wechat
|
||||
row["role_ids"] = v.RoleIds
|
||||
row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s")
|
||||
row["update_time"] = beego.Date(time.Unix(v.UpdateTime, 0), "Y-m-d H:i:s")
|
||||
|
||||
@@ -59,7 +59,7 @@ func (self *NotifyTplController) AjaxSave() {
|
||||
notifyTpl.Type = models.NotifyTplTypeDefault
|
||||
notifyTpl.Status, _ = self.GetInt("status")
|
||||
|
||||
if notifyTpl.TplType == 1 {
|
||||
if notifyTpl.TplType == 1 || notifyTpl.TplType == 3 {
|
||||
m := make(map[string]string)
|
||||
err := json.Unmarshal([]byte(notifyTpl.Content), &m)
|
||||
if err != nil {
|
||||
@@ -85,7 +85,7 @@ func (self *NotifyTplController) AjaxSave() {
|
||||
notifyTpl.Content = strings.TrimSpace(self.GetString("content"))
|
||||
notifyTpl.Status, _ = self.GetInt("status")
|
||||
|
||||
if notifyTpl.TplType == 1 {
|
||||
if notifyTpl.TplType == 1 || notifyTpl.TplType == 3 {
|
||||
m := make(map[string]string)
|
||||
err := json.Unmarshal([]byte(notifyTpl.Content), &m)
|
||||
if err != nil {
|
||||
@@ -137,6 +137,7 @@ func (self *NotifyTplController) Table() {
|
||||
"邮件",
|
||||
"信息",
|
||||
"钉钉",
|
||||
"微信",
|
||||
}
|
||||
|
||||
self.pageSize = limit
|
||||
|
||||
@@ -30,6 +30,7 @@ func (self *UserController) Edit() {
|
||||
row["phone"] = Admin.Phone
|
||||
row["email"] = Admin.Email
|
||||
row["dingtalk"] = Admin.Dingtalk
|
||||
row["wechat"] = Admin.Wechat
|
||||
self.Data["admin"] = row
|
||||
self.display()
|
||||
}
|
||||
@@ -46,6 +47,7 @@ func (self *UserController) AjaxSave() {
|
||||
Admin.Phone = strings.TrimSpace(self.GetString("phone"))
|
||||
Admin.Email = strings.TrimSpace(self.GetString("email"))
|
||||
Admin.Dingtalk = strings.TrimSpace(self.GetString("dingtalk"))
|
||||
Admin.Wechat = strings.TrimSpace(self.GetString("wechat"))
|
||||
|
||||
resetPwd := self.GetString("reset_pwd")
|
||||
if resetPwd == "1" {
|
||||
|
||||
48
jobs/job.go
48
jobs/job.go
@@ -280,6 +280,7 @@ func (j *Job) Run() {
|
||||
adminInfo := AllAdminInfo(j.task.NotifyUserIds)
|
||||
phone := make(map[string]string, 0)
|
||||
dingtalk := make(map[string]string, 0)
|
||||
wechat := make(map[string]string, 0)
|
||||
toEmail := ""
|
||||
for _, v := range adminInfo {
|
||||
if v.Phone != "0" && v.Phone != "" {
|
||||
@@ -291,6 +292,9 @@ func (j *Job) Run() {
|
||||
if v.Dingtalk != "0" && v.Dingtalk != "" {
|
||||
dingtalk[v.Dingtalk] = v.Dingtalk
|
||||
}
|
||||
if v.Wechat != "0" && v.Wechat != "" {
|
||||
wechat[v.Wechat] = v.Wechat
|
||||
}
|
||||
}
|
||||
toEmail = strings.TrimRight(toEmail, ";")
|
||||
|
||||
@@ -302,8 +306,8 @@ func (j *Job) Run() {
|
||||
|
||||
status := log.Status + 2
|
||||
|
||||
var title = ""
|
||||
var content = ""
|
||||
title, content := "", ""
|
||||
|
||||
notifyTpl, err := models.NotifyTplGetById(j.task.NotifyTplId)
|
||||
if err != nil {
|
||||
notifyTpl, err := models.NotifyTplGetByTplType(j.task.NotifyType, models.NotifyTplTypeSystem)
|
||||
@@ -319,30 +323,28 @@ func (j *Job) Run() {
|
||||
if title != "" {
|
||||
title = strings.Replace(title, "{{TaskId}}", strconv.Itoa(j.task.Id), -1)
|
||||
title = strings.Replace(title, "{{TaskName}}", j.task.TaskName, -1)
|
||||
title = strings.Replace(title, "{{CreateTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1)
|
||||
title = strings.Replace(title, "{{ExecuteTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1)
|
||||
title = strings.Replace(title, "{{ProcessTime}}", strconv.FormatFloat(float64(log.ProcessTime)/1000, 'f', 6, 64), -1)
|
||||
title = strings.Replace(title, "{{Status}}", TextStatus[status], -1)
|
||||
title = strings.Replace(title, "{{TaskOut}}", log.Error, -1)
|
||||
title = strings.Replace(title, "{{ExecuteStatus}}", TextStatus[status], -1)
|
||||
title = strings.Replace(title, "{{TaskOutput}}", log.Error, -1)
|
||||
}
|
||||
|
||||
if content != "" {
|
||||
content = strings.Replace(content, "{{TaskId}}", strconv.Itoa(j.task.Id), -1)
|
||||
content = strings.Replace(content, "{{TaskName}}", j.task.TaskName, -1)
|
||||
content = strings.Replace(content, "{{CreateTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1)
|
||||
content = strings.Replace(content, "{{ExecuteTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1)
|
||||
content = strings.Replace(content, "{{ProcessTime}}", strconv.FormatFloat(float64(log.ProcessTime)/1000, 'f', 6, 64), -1)
|
||||
content = strings.Replace(content, "{{Status}}", TextStatus[status], -1)
|
||||
content = strings.Replace(content, "{{TaskOut}}", log.Error, -1)
|
||||
content = strings.Replace(content, "{{ExecuteStatus}}", TextStatus[status], -1)
|
||||
content = strings.Replace(content, "{{TaskOutput}}", log.Error, -1)
|
||||
}
|
||||
|
||||
if j.task.NotifyType == 0 && toEmail != "" {
|
||||
//邮件
|
||||
mailtype := "html"
|
||||
|
||||
ok := notify.SendToChan(toEmail, title, content, mailtype)
|
||||
if !ok {
|
||||
fmt.Println("发送邮件错误", toEmail)
|
||||
}
|
||||
|
||||
} else if j.task.NotifyType == 1 && len(phone) > 0 {
|
||||
//信息
|
||||
param := make(map[string]string)
|
||||
@@ -352,12 +354,30 @@ func (j *Job) Run() {
|
||||
return
|
||||
}
|
||||
|
||||
notify.SendSmsToChan(phone, param)
|
||||
ok := notify.SendSmsToChan(phone, param)
|
||||
if !ok {
|
||||
fmt.Println("发送信息错误", phone)
|
||||
}
|
||||
} else if j.task.NotifyType == 2 && len(dingtalk) > 0 {
|
||||
//钉钉
|
||||
notify.SendDingtalkToChan(dingtalk, content)
|
||||
}
|
||||
ok := notify.SendDingtalkToChan(dingtalk, content)
|
||||
if !ok {
|
||||
fmt.Println("发送钉钉错误", dingtalk)
|
||||
}
|
||||
} else if j.task.NotifyType == 3 && len(wechat) > 0 {
|
||||
//信息
|
||||
param := make(map[string]string)
|
||||
err := json.Unmarshal([]byte(content), ¶m)
|
||||
if err != nil {
|
||||
fmt.Println("发送微信错误", err)
|
||||
return
|
||||
}
|
||||
|
||||
ok := notify.SendWechatToChan(phone, param)
|
||||
if !ok {
|
||||
fmt.Println("发送微信错误", phone)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +395,7 @@ type adminInfo struct {
|
||||
Email string
|
||||
Phone string
|
||||
Dingtalk string
|
||||
Wechat string
|
||||
RealName string
|
||||
}
|
||||
|
||||
@@ -400,6 +421,7 @@ func AllAdminInfo(adminIds string) []*adminInfo {
|
||||
Email: v.Email,
|
||||
Phone: v.Phone,
|
||||
Dingtalk: v.Dingtalk,
|
||||
Wechat: v.Wechat,
|
||||
RealName: v.RealName,
|
||||
}
|
||||
adminInfos = append(adminInfos, &ai)
|
||||
|
||||
@@ -20,6 +20,7 @@ type Admin struct {
|
||||
Phone string
|
||||
Email string
|
||||
Dingtalk string
|
||||
Wechat string
|
||||
Salt string
|
||||
LastLogin int64
|
||||
LastIp string
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type AjaxReturn struct {
|
||||
type SmsAjaxReturn struct {
|
||||
Status int `json:"status"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
@@ -78,7 +78,7 @@ func (s *Sms) SendSms() error {
|
||||
return err
|
||||
}
|
||||
|
||||
ajaxData := AjaxReturn{}
|
||||
ajaxData := SmsAjaxReturn{}
|
||||
jsonErr := json.Unmarshal([]byte(res), &ajaxData)
|
||||
|
||||
if jsonErr != nil {
|
||||
|
||||
89
notify/wechat.go
Normal file
89
notify/wechat.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/george518/PPGo_Job/libs"
|
||||
"log"
|
||||
"time"
|
||||
"encoding/json"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type WechatAjaxReturn struct {
|
||||
Status int `json:"status"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type Wechat struct {
|
||||
Accounts map[string]string
|
||||
Param map[string]string
|
||||
}
|
||||
|
||||
var WechatChan chan *Wechat
|
||||
var WechatUrl string
|
||||
|
||||
func init() {
|
||||
WechatUrl = beego.AppConfig.String("wechat.url")
|
||||
poolSize, _ := beego.AppConfig.Int("wechat.pool")
|
||||
|
||||
//创建通道
|
||||
WechatChan = make(chan *Wechat, poolSize)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case m, ok := <-WechatChan:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if err := m.SendWechat(); err != nil {
|
||||
beego.Error("SendWechat:", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
func SendWechatToChan(accounts map[string]string, param map[string]string) bool {
|
||||
wechat := &Wechat{
|
||||
Accounts: accounts,
|
||||
Param: param,
|
||||
}
|
||||
|
||||
select {
|
||||
case WechatChan <- wechat:
|
||||
return true
|
||||
case <-time.After(time.Second * 3):
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Wechat) SendWechat() error {
|
||||
|
||||
for _, v := range s.Accounts {
|
||||
s.Param["account"] = v
|
||||
res, err := libs.HttpGet(WechatUrl, s.Param)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
ajaxData := WechatAjaxReturn{}
|
||||
jsonErr := json.Unmarshal([]byte(res), &ajaxData)
|
||||
|
||||
if jsonErr != nil {
|
||||
return jsonErr
|
||||
}
|
||||
|
||||
if ajaxData.Status != 200 {
|
||||
return errors.Errorf("msg %s", ajaxData.Message)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -15,30 +15,6 @@
|
||||
SET NAMES utf8;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `default`
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `default`;
|
||||
CREATE TABLE `default` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
|
||||
`email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱',
|
||||
`password` char(32) NOT NULL DEFAULT '' COMMENT '密码',
|
||||
`salt` char(10) NOT NULL DEFAULT '' COMMENT '密码盐',
|
||||
`last_login` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间',
|
||||
`last_ip` char(15) NOT NULL DEFAULT '' COMMENT '最后登录IP',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0正常 -1禁用',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_user_name` (`user_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of `default`
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `default` VALUES ('1', 'admin', 'admin@example.com', '7fef6171469e80d32c0559f88b377245', '', '0', '', '0');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `pp_task`
|
||||
-- ----------------------------
|
||||
@@ -297,34 +273,6 @@ BEGIN;
|
||||
INSERT INTO `pp_uc_role_auth` VALUES ('1', '1'), ('1', '15'), ('1', '16'), ('1', '30'), ('1', '31'), ('1', '36'), ('1', '37'), ('1', '39'), ('1', '41'), ('1', '46'), ('1', '47'), ('1', '48'), ('1', '49'), ('1', '54'), ('1', '55'), ('1', '56'), ('2', '0'), ('2', '17'), ('2', '18'), ('2', '19'), ('2', '20'), ('2', '21'), ('2', '22'), ('2', '23'), ('2', '24'), ('2', '25'), ('2', '26'), ('2', '27'), ('2', '28'), ('2', '29'), ('2', '32'), ('2', '33'), ('2', '34'), ('2', '35'), ('2', '38'), ('2', '40'), ('2', '42'), ('2', '43'), ('2', '44'), ('2', '45'), ('2', '50'), ('2', '51'), ('2', '52'), ('2', '53');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `pp_user`
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `pp_user`;
|
||||
CREATE TABLE `pp_user` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
|
||||
`email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱',
|
||||
`password` char(32) NOT NULL DEFAULT '' COMMENT '密码',
|
||||
`salt` char(10) NOT NULL DEFAULT '' COMMENT '密码盐',
|
||||
`last_login` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间',
|
||||
`last_ip` char(15) NOT NULL DEFAULT '' COMMENT '最后登录IP',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0正常 -1禁用',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_user_name` (`user_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of `pp_user`
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `pp_user` VALUES ('1', 'admin', 'haodaquan@shoplinq.cn', 'abfcf6dcedfb4b5b1505d41a8b4c77e8', 'aYk4Q1P83v', '1528124357', '[', '0');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `pp_task` CHANGE `notify_type` `notify_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0-邮件通知,1-信息通知,2-钉钉通知,';
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `pp_uc_admin` ADD `dingtalk` VARCHAR(64) NULL COMMENT '钉钉' AFTER `email`;
|
||||
COMMIT;
|
||||
@@ -349,7 +297,7 @@ CREATE TABLE `pp_notify_tpl` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '模板id',
|
||||
`type` enum('system','default') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'default',
|
||||
`tpl_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板名称',
|
||||
`tpl_type` tinyint(1) NOT NULL COMMENT '模板类型 0:邮件;1:信息;2:钉钉;',
|
||||
`tpl_type` tinyint(1) NOT NULL COMMENT '模板类型 0:邮件;1:信息;2:钉钉;3:微信;',
|
||||
`title` varchar(64) DEFAULT NULL COMMENT '标题',
|
||||
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板内容',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 0:禁用;1:启用;',
|
||||
@@ -358,15 +306,24 @@ CREATE TABLE `pp_notify_tpl` (
|
||||
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次编辑时间',
|
||||
`update_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次编辑者ID',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='通知模板';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='通知模板';
|
||||
|
||||
--
|
||||
-- 转存表中的数据 `pp_notify_tpl`
|
||||
--
|
||||
BEGIN;
|
||||
INSERT INTO `pp_notify_tpl` VALUES(1, 'system', '默认邮箱通知模板', 0, '定时任务异常:{{TaskName}}', 'Hello,定时任务出问题了:\r\n<p style=\"font-size:16px;\">任务执行详情:</p>\r\n<p style=\"display:block; padding:10px; background:#efefef;border:1px solid #e4e4e4\">\r\n任务 ID:{{TaskId}}<br/>\r\n任务名称:{{TaskName}}<br/>\r\n执行时间:{{CreateTime}}<br/>\r\n执行耗时:{{ProcessTime}}秒<br/>\r\n执行状态:{{Status}}\r\n</p>\r\n<p style=\"font-size:16px;\">任务执行输出</p>\r\n<p style=\"display:block; padding:10px; background:#efefef;border:1px solid #e4e4e4\">\r\n{{TaskOut}}\r\n</p>', 1, 1550255030, 1, 1550338305, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(2, 'system', '默认短信通知模板', 1, '', '{\r\n \"task_id\": \"{{TaskId}}\",\r\n \"task_name\": \"{{TaskName}}\",\r\n \"status\": \"{{Status}}\"\r\n}', 1, 1550255030, 1, 1550338215, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(3, 'system', '默认钉钉通知模板', 2, '', '任务执行异常详情:\r\n任务 ID:{{TaskId}}\r\n任务名称:{{TaskName}}\r\n执行时间:{{CreateTime}}\r\n执行耗时:{{ProcessTime}}秒\r\n执行状态:{{Status}}\r\n任务执行输出:\r\n{{TaskOut}}', 1, 1550255030, 1, 1550338191, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(1, 'system', '默认邮箱通知模板', 0, '定时任务异常:{{TaskName}}', 'Hello,定时任务出问题了:\r\n<p style=\"font-size:16px;\">任务执行详情:</p>\r\n<p style=\"display:block; padding:10px; background:#efefef;border:1px solid #e4e4e4\">\r\n任务 ID:{{TaskId}}<br/>\r\n任务名称:{{TaskName}}<br/>\r\n执行时间:{{ExecuteTime}}<br/>\r\n执行耗时:{{ProcessTime}}秒<br/>\r\n执行状态:{{ExecuteStatus}}\r\n</p>\r\n<p style=\"font-size:16px;\">任务执行输出</p>\r\n<p style=\"display:block; padding:10px; background:#efefef;border:1px solid #e4e4e4\">\r\n{{TaskOutput}}\r\n</p>', 1, 1550255030, 1, 1550338305, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(2, 'system', '默认短信通知模板', 1, '', '{\r\n \"task_id\": \"{{TaskId}}\",\r\n \"task_name\": \"{{TaskName}}\",\r\n \"execute_status\": \"{{ExecuteStatus}}\"\r\n}', 1, 1550255030, 1, 1550338215, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(3, 'system', '默认钉钉通知模板', 2, '', '任务执行异常详情:\r\n任务 ID:{{TaskId}}\r\n任务名称:{{TaskName}}\r\n执行时间:{{ExecuteTime}}\r\n执行耗时:{{ProcessTime}}秒\r\n执行状态:{{ExecuteStatus}}\r\n任务执行输出:\r\n{{TaskOutput}}', 1, 1550255030, 1, 1550338880, 1);
|
||||
INSERT INTO `pp_notify_tpl` VALUES(4, 'system', '默认微信通知模板', 3, '', '{\r\n \"task_id\": \"{{TaskId}}\",\r\n \"task_name\": \"{{TaskName}}\",\r\n \"execute_status\": \"{{ExecuteStatus}}\"\r\n}', 1, 1550347183, 1, 1550347201, 1);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `pp_task` CHANGE `notify_type` `notify_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0-邮件通知,1-信息通知,2-钉钉通知,3-微信通知,';
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `pp_uc_admin` ADD `wechat` VARCHAR(64) NULL COMMENT '微信' AFTER `dingtalk`;
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -42,7 +42,13 @@
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="dingtalk" id="dingtalk" autocomplete="off" placeholder="钉钉通知" class="layui-input" value="">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">*</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">微信帐号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="wechat" id="wechat" autocomplete="off" placeholder="微信帐号" class="layui-input" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">微信帐号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="wechat" id="wechat" autocomplete="off" placeholder="微信帐号" class="layui-input" value="{{.admin.wechat}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">重置密码</label>
|
||||
<div class="layui-input-inline">
|
||||
@@ -58,8 +65,6 @@
|
||||
<div class="layui-form-mid layui-word-aux">*</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
|
||||
|
||||
<input type="hidden" id="roleids" name="roleids" value="{{.admin.role_ids}}">
|
||||
<input type="hidden" id="id" name="id" value="{{.admin.id}}">
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
,{field:'phone', title: '联系电话'}
|
||||
,{field:'email', title: '电子邮箱'}
|
||||
,{field:'dingtalk', title: '钉钉通知'}
|
||||
,{field:'wechat', title: '微信账号'}
|
||||
,{field:'status_text', title: '状态'}
|
||||
,{fixed: 'right', width:160, align:'center', toolbar: '#bar'}
|
||||
]]
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="0" title="邮箱" checked>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="1" title="短信" >
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="2" title="钉钉" >
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="3" title="微信" >
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
@@ -40,10 +41,10 @@
|
||||
|
||||
{{"任务 ID {{TaskId}}"}}
|
||||
{{"任务名称 {{TaskName}}"}}
|
||||
{{"执行时间 {{CreateTime}}"}}
|
||||
{{"执行时间 {{ExecuteTime}}"}}
|
||||
{{"执行耗时 {{ProcessTime}}"}}
|
||||
{{"执行状态 {{Status}}"}}
|
||||
{{"任务输出 {{TaskOut}}"}}
|
||||
{{"执行状态 {{ExecuteStatus}}"}}
|
||||
{{"任务输出 {{TaskOutput}}"}}
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="0" title="邮箱" {{if eq .notifyTpl.tpl_type 0}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="1" title="短信" {{if eq .notifyTpl.tpl_type 1}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="2" title="钉钉" {{if eq .notifyTpl.tpl_type 2}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="3" title="微信" {{if eq .notifyTpl.tpl_type 3}}checked{{end}}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
@@ -41,10 +42,10 @@
|
||||
|
||||
{{"任务 ID {{TaskId}}"}}
|
||||
{{"任务名称 {{TaskName}}"}}
|
||||
{{"执行时间 {{CreateTime}}"}}
|
||||
{{"执行时间 {{ExecuteTime}}"}}
|
||||
{{"执行耗时 {{ProcessTime}}"}}
|
||||
{{"执行状态 {{Status}}"}}
|
||||
{{"任务输出 {{TaskOut}}"}}
|
||||
{{"执行状态 {{ExecuteStatus}}"}}
|
||||
{{"任务输出 {{TaskOutput}}"}}
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<input type="radio" name="notify_type" value="0" lay-filter="notify_type" title="邮件">
|
||||
<input type="radio" name="notify_type" value="1" lay-filter="notify_type" title="短信">
|
||||
<input type="radio" name="notify_type" value="2" lay-filter="notify_type" title="钉钉">
|
||||
<input type="radio" name="notify_type" value="3" lay-filter="notify_type" title="微信">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
<input type="radio" name="notify_type" lay-verify="required" value="0" title="邮件" {{if eq .task.NotifyType 0}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" lay-verify="required" value="1" title="短信" {{if eq .task.NotifyType 1}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" lay-verify="required" value="2" title="钉钉" {{if eq .task.NotifyType 2}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" lay-verify="required" value="3" title="微信" {{if eq .task.NotifyType 3}}checked{{end}}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
{{if eq .task.IsNotify 1}}
|
||||
<tr>
|
||||
<td>通知类型</td>
|
||||
<td>{{if eq .task.NotifyType 1}}短信{{end}} {{if eq .task.NotifyType 0}}邮件{{end}} {{if eq .task.NotifyType 2}}钉钉{{end}}</td>
|
||||
<td>{{if eq .task.NotifyType 1}}短信{{end}} {{if eq .task.NotifyType 0}}邮件{{end}} {{if eq .task.NotifyType 2}}钉钉{{end}} {{if eq .task.NotifyType 3}}微信{{end}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
@@ -217,8 +217,6 @@
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
//但是,如果你的HTML是动态生成的,自动渲染就会失效
|
||||
//因此你需要在相应的地方,执行下述方法来手动渲染,跟这类似的还有 element.init();
|
||||
form.render();
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
<input type="radio" name="notify_type" value="0" lay-filter="notify_type" title="邮件" {{if eq .task.NotifyType 0}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" value="1" lay-filter="notify_type" title="短信" {{if eq .task.NotifyType 1}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" value="2" lay-filter="notify_type" title="钉钉" {{if eq .task.NotifyType 2}}checked{{end}}>
|
||||
<input type="radio" name="notify_type" value="3" lay-filter="notify_type" title="微信" {{if eq .task.NotifyType 3}}checked{{end}}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
{{if eq .task.IsNotify 1}}
|
||||
<tr>
|
||||
<td>通知类型</td>
|
||||
<td>{{if eq .task.NotifyType 1}}短信{{end}} {{if eq .task.NotifyType 0}}邮件{{end}} {{if eq .task.NotifyType 2}}钉钉{{end}}</td>
|
||||
<td>{{if eq .task.NotifyType 1}}短信{{end}} {{if eq .task.NotifyType 0}}邮件{{end}} {{if eq .task.NotifyType 2}}钉钉{{end}} {{if eq .task.NotifyType 3}}微信{{end}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">微信帐号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="wechat" id="wechat" autocomplete="off" placeholder="微信帐号" class="layui-input" value="{{.admin.wechat}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否修改</label>
|
||||
<div class="layui-input-inline">
|
||||
|
||||
Reference in New Issue
Block a user