Create & Init Project...
This commit is contained in:
51
app/service/main/relation/http/monitor.go
Normal file
51
app/service/main/relation/http/monitor.go
Normal file
@ -0,0 +1,51 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"go-common/library/ecode"
|
||||
bm "go-common/library/net/http/blademaster"
|
||||
)
|
||||
|
||||
// addMonitor
|
||||
func addMonitor(c *bm.Context) {
|
||||
var (
|
||||
err error
|
||||
mid int64
|
||||
params = c.Request.Form
|
||||
midStr = params.Get("mid")
|
||||
)
|
||||
if mid, err = strconv.ParseInt(midStr, 10, 64); err != nil {
|
||||
c.JSON(nil, ecode.RequestErr)
|
||||
return
|
||||
}
|
||||
if mid <= 0 {
|
||||
c.JSON(nil, ecode.RequestErr)
|
||||
return
|
||||
}
|
||||
c.JSON(nil, relationSvc.AddMonitor(c, mid))
|
||||
}
|
||||
|
||||
// delMonitor
|
||||
func delMonitor(c *bm.Context) {
|
||||
var (
|
||||
err error
|
||||
mid int64
|
||||
params = c.Request.Form
|
||||
midStr = params.Get("mid")
|
||||
)
|
||||
if mid, err = strconv.ParseInt(midStr, 10, 64); err != nil {
|
||||
c.JSON(nil, ecode.RequestErr)
|
||||
return
|
||||
}
|
||||
if mid <= 0 {
|
||||
c.JSON(nil, ecode.RequestErr)
|
||||
return
|
||||
}
|
||||
c.JSON(nil, relationSvc.DelMonitor(c, mid))
|
||||
}
|
||||
|
||||
// loadMonitor
|
||||
func loadMonitor(c *bm.Context) {
|
||||
c.JSON(nil, relationSvc.LoadMonitor(c))
|
||||
}
|
Reference in New Issue
Block a user