123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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
- }
|