Commit ce822374 authored by 陈子龙's avatar 陈子龙

工单定时推送短信优化

parent da1f6fa2
...@@ -26,6 +26,7 @@ require ( ...@@ -26,6 +26,7 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus/alertmanager v0.25.0 github.com/prometheus/alertmanager v0.25.0
github.com/robfig/cron v1.2.0 github.com/robfig/cron v1.2.0
github.com/robfig/cron/v3 v3.0.1
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/spf13/cast v1.5.0 github.com/spf13/cast v1.5.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
......
...@@ -579,6 +579,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O ...@@ -579,6 +579,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
......
package entity package entity
import "time" import (
"time"
)
type WorkOrder struct { type WorkOrder struct {
Id int `json:"id" xorm:"pk autoincr" ` // id Id int `json:"id" xorm:"pk autoincr" ` // id
......
...@@ -53,7 +53,7 @@ func main() { ...@@ -53,7 +53,7 @@ func main() {
//启动定时任务 //启动定时任务
cron.StartCron() cron.StartCron()
service.PushWorkOrderMessage() service.CronPushWorkOrder()
// server start... // server start...
conf.Logger.Info("config info", zap.Any("options", conf.Options)) conf.Logger.Info("config info", zap.Any("options", conf.Options))
conf.Logger.Error("server start err", zap.Error(newServer().ListenAndServe())) conf.Logger.Error("server start err", zap.Error(newServer().ListenAndServe()))
...@@ -151,12 +151,6 @@ func initAnsibleHosts() { ...@@ -151,12 +151,6 @@ func initAnsibleHosts() {
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
} }
//else {
// _, err := f.Write([]byte("[web]\n"))
// if err != nil {
// fmt.Println(err.Error())
// }
//}
} }
func initTempDirPrefix() { func initTempDirPrefix() {
...@@ -181,14 +175,4 @@ func initAnsibleSSH() { ...@@ -181,14 +175,4 @@ func initAnsibleSSH() {
fmt.Println(err.Error()) fmt.Println(err.Error())
} }
} }
//f2, err := os.CreateIndex("/root/.ssh/id_rsa.pub")
//defer f2.Close()
//if err != nil {
// fmt.Println(err.Error())
//} else {
// _, err := f.Write([]byte(conf.Options.PublicKeySSH))
// if err != nil {
// fmt.Println(err.Error())
// }
//}
} }
...@@ -175,3 +175,10 @@ func DisposedStatusText(code int) string { ...@@ -175,3 +175,10 @@ func DisposedStatusText(code int) string {
return "未知状态" return "未知状态"
} }
} }
// 工单定时类型
const (
TimingClick = 1 //手动下发
TimingWeekly = 2 //按周
TimingCustom = 3 //自定义时间
)
...@@ -46,5 +46,4 @@ func InitWorkOrderRouter(e *gin.Engine) { ...@@ -46,5 +46,4 @@ func InitWorkOrderRouter(e *gin.Engine) {
me.PUT("/feedback", controller.FeedbackWorkOrderMe) // 处置反馈 me.PUT("/feedback", controller.FeedbackWorkOrderMe) // 处置反馈
me.GET("/list", controller.ListWorkOrderMe) // 我的业务工单列表 me.GET("/list", controller.ListWorkOrderMe) // 我的业务工单列表
} }
//so.POST("/note_sg", controller.WorkOrderPushNoteMsg)
} }
...@@ -10,6 +10,4 @@ func StartCron() { ...@@ -10,6 +10,4 @@ func StartCron() {
defer c.Start() defer c.Start()
c.AddFunc("0 0 0 * * *", service.CronStatusDetection) // 每天凌晨0点状态检测 c.AddFunc("0 0 0 * * *", service.CronStatusDetection) // 每天凌晨0点状态检测
c.AddFunc("0 0 0 * * *", service.CronWorkOrderIssuance) // 每天凌晨0点扫描当天需下发工单
} }
This diff is collapsed.
...@@ -16,3 +16,14 @@ func ConvertToString(v interface{}) string { ...@@ -16,3 +16,14 @@ func ConvertToString(v interface{}) string {
} }
return string(jsonData) return string(jsonData)
} }
// IntsToStrings 将int切片转换为字符串切片
func IntsToStrings(ints []int) []string {
strs := make([]string, len(ints))
for i, v := range ints {
strs[i] = fmt.Sprint(v)
}
return strs
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment