31 lines
659 B
Go
31 lines
659 B
Go
|
package dingding
|
||
|
|
||
|
import (
|
||
|
"com.snow.auto_monitor/app/constants/errorcode"
|
||
|
common "com.snow.auto_monitor/app/http/controllers"
|
||
|
dingEnt "com.snow.auto_monitor/app/http/entities/dingding"
|
||
|
dingServ "com.snow.auto_monitor/app/services/dingding"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func DingSend(c *gin.Context) {
|
||
|
request := new(dingEnt.DingSendReq)
|
||
|
err := common.GenRequest(c, request)
|
||
|
if err != nil {
|
||
|
common.Error(c, errorcode.ParamError)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
err = dingServ.DingSend(request.Title, request.Content, true)
|
||
|
if err != nil {
|
||
|
common.Error500(c)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
response := &dingEnt.DingSendResp{
|
||
|
Status: "success",
|
||
|
}
|
||
|
|
||
|
common.Success(c, response)
|
||
|
}
|