12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package services
- /*
- import (
- "errors"
- "eta/eta_index_lib/models"
- "eta/eta_index_lib/utils"
- )
- func AddEdbDataFromManual(edbCode string) (err error) {
- // 判断是否调用桥接服务
- var manualDataList []*models.ManualEdbdata
- url, _ := GetWindBridgeUrl()
- if url != "" {
- manualDataList, err = GetManualEdbDataFromBridgeJy(url, edbCode, "", "")
- if err != nil {
- return
- }
- // 设置指标与终端关系的缓存
- windUrlCacheKey := utils.CACHE_WIND_URL + ":" + edbCode
- _ = utils.Rc.SetNX(windUrlCacheKey, url, utils.GetTodayLastSecond())
- } else {
- var condition string
- var pars []interface{}
- if edbCode != "" {
- condition += " AND TRADE_CODE=? "
- pars = append(pars, edbCode)
- }
- manualDataList, err = models.GetEdbdataManualByCondition(condition, pars)
- if err != nil {
- return
- }
- }
- err = models.AddEdbDataFromManual(edbCode, manualDataList)
- return
- }
- func RefreshEdbDataFromManual(req models.RefreshEdbInfoReq, edbinfo *models.EdbInfo) (err error) {
- var manualDataList []*models.ManualEdbdata
- url, _ := GetManualBridgeJYUrl()
- if url != "" && edbinfo.ServerUrl == url {
- manualDataList, err = GetManualEdbDataFromBridgeJy(url, req.EdbCode, "", "")
- if err != nil {
- err = errors.New("查询桥接服务手工数据失败,Err:" + err.Error())
- return
- }
- } else {
- var condition string
- var pars []interface{}
- if req.EdbCode != "" {
- condition += " AND TRADE_CODE=? "
- pars = append(pars, req.EdbCode)
- }
- if req.StartDate != "" {
- condition += " AND DT>=? "
- pars = append(pars, req.StartDate)
- } else {
- condition += " AND DT != ? "
- pars = append(pars, `0000-00-00`)
- }
- manualDataList, err = models.GetEdbdataManualByCondition(condition, pars)
- if err != nil {
- err = errors.New("查询手工数据失败,Err:" + err.Error())
- return
- }
- }
- err = models.RefreshEdbDataFromManual(req.EdbInfoId, req.EdbCode, req.StartDate, manualDataList)
- if err != nil && err.Error() != utils.ErrNoRow() {
- err = errors.New("刷新指标信息失败 service RefreshEdbDataFromManual,Err:" + err.Error())
- return
- }
- return
- }
- */
|