index_notice.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package models
  2. import (
  3. "eta_gn/eta_task/global"
  4. "time"
  5. )
  6. type EdbInfo struct {
  7. UserId int
  8. SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
  9. NoticeTime string
  10. Frequency string
  11. TradeCode string `orm:"column(TRADE_CODE);" description:"指标编码"`
  12. }
  13. func GetEdbInfoByFrequencyNotDay() (items []*EdbInfo, err error) {
  14. sql := `SELECT * FROM edbinfo WHERE frequency!="日度" AND notice_time<>'' and user_id>0 `
  15. err = global.DmSQL["edb"].Raw(sql).Find(&items).Error
  16. return
  17. }
  18. type Edbdata struct {
  19. TradeCode string `gorm:"column:TRADE_CODE;primaryKey"` // `orm:"column(TRADE_CODE);pk" description:"指标编码"`
  20. Dt string `orm:"column(DT)" description:"日期"`
  21. Close string `orm:"column(CLOSE)" description:"值"`
  22. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  23. }
  24. func GetLastEdbdataInfo(tradeCode string) (item *Edbdata, err error) {
  25. sql := `SELECT * FROM edbdata WHERE TRADE_CODE=? order by DT desc `
  26. err = global.DmSQL["data"].Raw(sql, tradeCode).Find(&item).Error
  27. return
  28. }