1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package data_manage
- //type EdbDataLt struct {
- // EdbDataId int `orm:"column(edb_data_id);pk" gorm:"primaryKey"`
- // EdbInfoId int
- // EdbCode string
- // DataTime string
- // Value float64
- // Status int
- // CreateTime time.Time
- // ModifyTime time.Time
- // DataTimestamp int64
- //}
- // AddEdbDataLtBySql 执行添加数据的sql
- //func AddEdbDataLtBySql(sqlStr string) (err error) {
- // o := global.DbMap[utils.DbNameIndex]
- // err = o.Exec(sqlStr).Error
- // return
- //}
- // ModifyEdbDataLt 修改路透社数据
- //func ModifyEdbDataLt(edbInfoId int64, dataTime string, value float64) (err error) {
- // o := global.DbMap[utils.DbNameIndex]
- // sql := ` UPDATE edb_data_lt SET value=?,modify_time=NOW() WHERE edb_info_id=? AND data_time=? `
- // err = o.Exec(sql, value, edbInfoId, dataTime).Error
- // return
- //}
- //func GetEdbDataLtMaxOrMinDate(edbCode string) (min_date, max_date string, err error) {
- // o := global.DbMap[utils.DbNameIndex]
- // sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_lt WHERE edb_code=? `
- // err = o.Raw(sql, edbCode).Row().Scan(&min_date, &max_date)
- // return
- //}
- //func GetEdbDataLtByCodeAndDate(edbCode string, startDate string) (count int, err error) {
- // o := global.DbMap[utils.DbNameIndex]
- // sql := ` SELECT COUNT(1) AS count FROM edb_data_lt WHERE edb_code=? AND data_time=? `
- // err = o.Raw(sql, edbCode, startDate).Scan(&count).Error
- // return
- //}
- //func GetEdbDataLtByCode(edbCode string, size int) (items []*EdbInfoSearchData, err error) {
- // o := global.DbMap[utils.DbNameIndex]
- // sql := ` SELECT * FROM edb_data_lt WHERE edb_code=? ORDER BY data_time DESC LIMIT ? `
- // err = o.Raw(sql, edbCode, size).Find(&items).Error
- // return
- //}
- //type EdbDataFromLt struct {
- // Close map[int64]interface{} `json:"CLOSE"`
- //}
- // QueryEdbDataByLt 获取路透社数据
- //func QueryEdbDataByLt(edbCode, startDate, endDate string) (dataList map[int64]interface{}, err error) {
- // dataList = make(map[int64]interface{})
- //
- // ltUrl := utils.LtServerUrl + `edbInfo/ek?EdbCode=%s&StartDate=%s&EndDate=%s`
- // ltUrl = fmt.Sprintf(ltUrl, edbCode, startDate, endDate)
- // utils.FileLog.Info("ltUrl:%s", ltUrl)
- // body, err := http.Get(ltUrl)
- // utils.FileLog.Info("lt result:%s", string(body))
- //
- // if err != nil {
- // return
- // }
- // //fmt.Println(string(body))
- // item := new(EdbDataFromLt)
- // err = json.Unmarshal(body, &item)
- //
- // if err != nil {
- // return
- // }
- // dataList = item.Close
- // return
- //}
|