Commit 94f416d0 authored by 陈子龙's avatar 陈子龙

主机管理详情 fix

parent 56cd6bec
...@@ -28,6 +28,7 @@ require ( ...@@ -28,6 +28,7 @@ require (
github.com/tealeg/xlsx v1.0.5 github.com/tealeg/xlsx v1.0.5
github.com/thoas/go-funk v0.9.3 github.com/thoas/go-funk v0.9.3
github.com/valyala/fasthttp v1.47.0 github.com/valyala/fasthttp v1.47.0
github.com/wanghuiyt/ding v0.0.2
go.uber.org/zap v1.24.0 go.uber.org/zap v1.24.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/natefinch/lumberjack.v2 v2.2.1
k8s.io/apimachinery v0.27.3 k8s.io/apimachinery v0.27.3
...@@ -67,8 +68,6 @@ require ( ...@@ -67,8 +68,6 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect github.com/ugorji/go/codec v1.2.9 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/wanghuiyt/ding v0.0.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/atomic v1.9.0 // indirect go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect go.uber.org/multierr v1.6.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
......
...@@ -243,3 +243,15 @@ func ListWorkOrderMe(c *gin.Context) { ...@@ -243,3 +243,15 @@ func ListWorkOrderMe(c *gin.Context) {
} }
SendJsonPageResponse(c, resp.OK, list, total) SendJsonPageResponse(c, resp.OK, list, total)
} }
// WorkOrderPushNoteMsg 我的业务工单列表
func WorkOrderPushNoteMsg(c *gin.Context) {
phone := c.Query("phone")
err := service.WorkOrderPushNoteMsg(phone)
if err != nil {
SendJsonResponse(c, err, nil)
return
}
SendJsonResponse(c, resp.OK, nil)
}
...@@ -81,10 +81,10 @@ func initConfig() { ...@@ -81,10 +81,10 @@ func initConfig() {
PublicKeySSH: util.SetEnvStr("PUBLIC_KEY_SSH", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCw4WT05QHzCD19348MfJfycS1NI9Jlj62PGrZ1rU9/kWQif5TV1rqHZ6qjAX2WfK+W3u4SV51MhZBkMZZOgZgJmdGiaZJkSmj+8gj6XU/bxslUd+BYUKqbE18gFkVDgqs6n2tcqJ2at3x+WEr81Msk2qvKuGEiIOzcJPICWKxwiw== chenzilong@example.com\n"), PublicKeySSH: util.SetEnvStr("PUBLIC_KEY_SSH", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCw4WT05QHzCD19348MfJfycS1NI9Jlj62PGrZ1rU9/kWQif5TV1rqHZ6qjAX2WfK+W3u4SV51MhZBkMZZOgZgJmdGiaZJkSmj+8gj6XU/bxslUd+BYUKqbE18gFkVDgqs6n2tcqJ2at3x+WEr81Msk2qvKuGEiIOzcJPICWKxwiw== chenzilong@example.com\n"),
OrderDingTalkAccessToken: util.SetEnvStr("ORDER_DING_TALK_ACCESS_TOKEN", "203fe1644b446bba0a34e6e622c523d39ee9916fdad94b9c64224449f659e20b"), OrderDingTalkAccessToken: util.SetEnvStr("ORDER_DING_TALK_ACCESS_TOKEN", "203fe1644b446bba0a34e6e622c523d39ee9916fdad94b9c64224449f659e20b"),
OrderDingTalkSecret: util.SetEnvStr("ORDER_DING_TALK_SECRET", "SECa73d8372e336451c9daf29a99f750ee1bdd170c1dab910eab9cd06d729a831b7"), OrderDingTalkSecret: util.SetEnvStr("ORDER_DING_TALK_SECRET", "SECa73d8372e336451c9daf29a99f750ee1bdd170c1dab910eab9cd06d729a831b7"),
SmsAccessKeyId: util.SetEnvStr("SMS_ACCESS_KEY", "LTAI4GBcVubRjzX7ABPcHnhB"), // 短信key SmsAccessKeyId: util.SetEnvStr("SMS_ACCESS_KEY", "LTAI4GBcVubRjzX7ABPcHnhB"), // 短信key
SmsAccessSecret: util.SetEnvStr("SMS_ACCESS_SECRET", "dYE2dtABFOqYtK1ijcrits0yedHkw7"), // 短信secret SmsAccessSecret: util.SetEnvStr("SMS_ACCESS_SECRET", "dYE2dtABFOqYtK1ijcrits0yedHkw7"), // 短信secret
SmsTemplateLogin: util.SetEnvStr("SMS_TEMPLATE_LOGIN", "SMS_212925130"), // 短信验证码模板 SmsTemplateLogin: util.SetEnvStr("SMS_TEMPLATE_LOGIN", "SMS_212925130"), // 短信验证码模板
SmsSignName: util.SetEnvStr("SMS_SIGN_NAME", "比格数据"), // 签名 SmsSignName: util.SetEnvStr("SMS_SIGN_NAME", "比格数据"), // 签名
} }
} }
......
...@@ -45,4 +45,5 @@ func InitWorkOrderRouter(e *gin.Engine) { ...@@ -45,4 +45,5 @@ 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)
} }
...@@ -326,7 +326,8 @@ func (h *HostManageSvc) DetailsHostManage(id int) (hostManageRes response.HostMa ...@@ -326,7 +326,8 @@ func (h *HostManageSvc) DetailsHostManage(id int) (hostManageRes response.HostMa
return return
} }
//查询任务列表 //查询任务列表
err = db.Table("task_manage").Where("is_delete = 0 AND host_group_id = ?", id).Find(&taskList) err = db.Table("task_manage").Alias("tm").Where("tm.is_delete = 0 AND tm.host_group_id = ?", id).
Select("tm.id,tm.task_name,tm.task_desc,(select count(1) from task_history th where th.task_id = tm.id) as exec_cnt").Find(&taskList)
if err != nil { if err != nil {
err = resp.DbSelectError.WithError(err) err = resp.DbSelectError.WithError(err)
return return
......
...@@ -3,6 +3,7 @@ package service ...@@ -3,6 +3,7 @@ package service
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi"
json "github.com/json-iterator/go" json "github.com/json-iterator/go"
"github.com/wanghuiyt/ding" "github.com/wanghuiyt/ding"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity"
...@@ -11,6 +12,8 @@ import ( ...@@ -11,6 +12,8 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
"go.uber.org/zap"
"time" "time"
) )
...@@ -632,7 +635,29 @@ func WorkOrderPushDingTalkMsg(orderName, phone string, orderLevel int) (err erro ...@@ -632,7 +635,29 @@ func WorkOrderPushDingTalkMsg(orderName, phone string, orderLevel int) (err erro
} }
// WorkOrderPushNoteMsg 推送短信消息 // WorkOrderPushNoteMsg 推送短信消息
func WorkOrderPushNoteMsg() (err error) { func WorkOrderPushNoteMsg(phone string) (err error) {
smsClient, err := dysmsapi.NewClientWithAccessKey("cn-hangzhou", conf.Options.SmsAccessKeyId, conf.Options.SmsAccessSecret)
return if err != nil {
conf.Logger.Error("dysmsapi client error", zap.Error(err))
return resp.FAIL.ErrorDetail(err)
}
code := util.Rand6()
params := map[string]interface{}{"code": code}
templateParam, err := json.Marshal(params)
if err != nil {
conf.Logger.Error("序列化模板失败!", zap.Error(err))
return resp.FAIL.ErrorDetail(err)
}
request := dysmsapi.CreateSendSmsRequest()
request.Scheme = "https"
request.PhoneNumbers = phone
request.TemplateCode = conf.Options.SmsTemplateLogin
request.SignName = conf.Options.SmsSignName
request.TemplateParam = string(templateParam)
req, err := smsClient.SendSms(request)
if err != nil {
return resp.FAIL.ErrorDetail(err)
}
fmt.Printf("response is %#v\n", req)
return nil
} }
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