package xiangyu import ( "eta/eta_bridge/controller/resp" "eta/eta_bridge/global" "eta/eta_bridge/logic/xiangyu" xiangyuSrc "eta/eta_bridge/services/xiangyu" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" ) // PushIndexDataResp // @Description: 指标信息推送 // @author: Roc // @receiver xc // @datetime 2024-02-27 17:53:24 // @param c *gin.Context func (xc *XiangyuController) PushIndexDataResp(c *gin.Context) { var req xiangyuSrc.PushBaseParamReq if e := c.Bind(&req); e != nil { err, ok := e.(validator.ValidationErrors) if !ok { resp.FailData("参数解析失败", "Err:"+e.Error(), c) return } resp.FailData("参数解析失败", err.Translate(global.Trans), c) return } err, errMsg := xiangyu.PushIndexDataResp(req) if err != nil { resp.FailData(errMsg, err.Error(), c) return } resp.OkData("同步成功", "", c) return } // PushIndexValueDataResp // @Description: 指标日期值信息推送 // @author: Roc // @receiver xc // @datetime 2024-02-27 17:53:24 // @param c *gin.Context func (xc *XiangyuController) PushIndexValueDataResp(c *gin.Context) { var req xiangyuSrc.PushBaseParamReq if e := c.Bind(&req); e != nil { err, ok := e.(validator.ValidationErrors) if !ok { resp.FailData("参数解析失败", "Err:"+e.Error(), c) return } resp.FailData("参数解析失败", err.Translate(global.Trans), c) return } err, errMsg := xiangyu.PushEdbValueDataResp(req) if err != nil { resp.FailData(errMsg, err.Error(), c) return } resp.OkData("同步成功", "", c) return } // PushClassifyDataResp // @Description: 指标分类信息推送 // @author: Roc // @receiver xc // @datetime 2024-02-27 17:53:24 // @param c *gin.Context func (xc *XiangyuController) PushClassifyDataResp(c *gin.Context) { var req xiangyuSrc.PushBaseParamReq if e := c.Bind(&req); e != nil { err, ok := e.(validator.ValidationErrors) if !ok { resp.FailData("参数解析失败", "Err:"+e.Error(), c) return } resp.FailData("参数解析失败", err.Translate(global.Trans), c) return } err, errMsg := xiangyu.PushClassifyDataResp(req) if err != nil { resp.FailData(errMsg, err.Error(), c) return } resp.OkData("同步成功", "", c) return } // PushEdbClassifyDataResp // @Description: 指标与分类的关系信息推送 // @author: Roc // @receiver xc // @datetime 2024-02-27 17:53:24 // @param c *gin.Context func (xc *XiangyuController) PushEdbClassifyDataResp(c *gin.Context) { var req xiangyuSrc.PushBaseParamReq if e := c.Bind(&req); e != nil { err, ok := e.(validator.ValidationErrors) if !ok { resp.FailData("参数解析失败", "Err:"+e.Error(), c) return } resp.FailData("参数解析失败", err.Translate(global.Trans), c) return } err, errMsg := xiangyu.PushEdbClassifyDataResp(req) if err != nil { resp.FailData(errMsg, err.Error(), c) return } resp.OkData("同步成功", "", c) return }