41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
|
package handler
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"hpds-iot-web/internal/proto"
|
||
|
"hpds-iot-web/internal/service"
|
||
|
"hpds-iot-web/model"
|
||
|
e "hpds-iot-web/pkg/err"
|
||
|
)
|
||
|
|
||
|
func (s HandlerService) GetEdgeList(c *gin.Context) (data interface{}, err error) {
|
||
|
repo := service.NewEdgeService(s.AppConfig, s.Engine, s.Logger)
|
||
|
us, _ := c.Get("operatorUser")
|
||
|
userInfo := us.(*model.SystemUser)
|
||
|
var req proto.EdgeDatasetRequest
|
||
|
err = c.ShouldBindJSON(&req)
|
||
|
if err != nil {
|
||
|
go s.SaveLog("GetEdgeList", "Dataset", "", "", ToString(req), fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||
|
return nil, e.NewValidErr(err)
|
||
|
}
|
||
|
data, err = repo.GetEdgeList(c, req)
|
||
|
go s.SaveLog("获取边缘端数据列表", "Dataset", "", "", "", fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (s HandlerService) GetEdgeInfo(c *gin.Context) (data interface{}, err error) {
|
||
|
repo := service.NewEdgeService(s.AppConfig, s.Engine, s.Logger)
|
||
|
us, _ := c.Get("operatorUser")
|
||
|
userInfo := us.(*model.SystemUser)
|
||
|
var req proto.EdgeDatasetRequest
|
||
|
err = c.ShouldBindJSON(&req)
|
||
|
if err != nil {
|
||
|
go s.SaveLog("GetEdgeInfo", "Dataset", "", "", ToString(req), fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||
|
return nil, e.NewValidErr(err)
|
||
|
}
|
||
|
data, err = repo.GetEdgeInfo(c, req)
|
||
|
go s.SaveLog("获取边缘端数据详情", "Dataset", "", "", "", fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||
|
return
|
||
|
}
|