123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- package dashboard
- import (
- "kpt-pasture/http/middleware"
- "net/http"
- operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- "gitee.com/xuyiping_admin/pkg/valid"
- "gitee.com/xuyiping_admin/pkg/apierr"
- "gitee.com/xuyiping_admin/pkg/ginutil"
- "github.com/gin-gonic/gin"
- )
- func NeckRingWarning(c *gin.Context) {
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.NeckRingWarning(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func FocusIndicators(c *gin.Context) {
- dimension := c.Param("dimension")
- if err := valid.Validate(dimension, valid.Required); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.FocusIndicatorsList(c, dimension)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func FocusIndicatorsSet(c *gin.Context) {
- var req pasturePb.IndexFocusIndicatorsSetRequest
- if err := ginutil.BindProto(c, &req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- if err := middleware.Dependency(c).StoreEventHub.OpsService.FocusIndicatorsSet(c, &req); err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, &operationPb.CommonOK{
- Code: http.StatusOK,
- Msg: "ok",
- Data: &operationPb.Success{Success: true},
- })
- }
- func TodoCount(c *gin.Context) {
- var req pasturePb.IndexDataWarningSetRequest
- if err := ginutil.BindProto(c, &req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.CalendarToDoCount(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func DataWarningSet(c *gin.Context) {
- var req pasturePb.IndexDataWarningSetRequest
- if err := ginutil.BindProto(c, &req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- if err := middleware.Dependency(c).StoreEventHub.OpsService.DataWarningSet(c, &req); err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, &operationPb.CommonOK{
- Code: http.StatusOK,
- Msg: "ok",
- Data: &operationPb.Success{Success: true},
- })
- }
- func DataWarningList(c *gin.Context) {
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.DataWarningList(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
|