|
@@ -4,6 +4,7 @@ import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "gorm.io/gorm"
|
|
|
)
|
|
|
|
|
|
type SciClassify struct {
|
|
@@ -49,6 +50,29 @@ type SciIndex struct {
|
|
|
ModifyTime string
|
|
|
}
|
|
|
|
|
|
+func (sciIndex *SciIndex) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if sciIndex.CreateTime != "" {
|
|
|
+ sciIndex.CreateTime = utils.GormDateStrToDateTimeStr(sciIndex.CreateTime)
|
|
|
+ }
|
|
|
+ if sciIndex.ModifyTime != "" {
|
|
|
+ sciIndex.ModifyTime = utils.GormDateStrToDateTimeStr(sciIndex.ModifyTime)
|
|
|
+ }
|
|
|
+ if sciIndex.ApiStartTime != "" {
|
|
|
+ sciIndex.ApiStartTime = utils.GormDateStrToDateStr(sciIndex.ApiStartTime)
|
|
|
+ }
|
|
|
+ if sciIndex.ApiUpdateTime != "" {
|
|
|
+ sciIndex.ApiUpdateTime = utils.GormDateStrToDateTimeStr(sciIndex.ApiUpdateTime)
|
|
|
+ }
|
|
|
+ if sciIndex.StartTime != "" {
|
|
|
+ sciIndex.StartTime = utils.GormDateStrToDateTimeStr(sciIndex.StartTime)
|
|
|
+ }
|
|
|
+ if sciIndex.FinishTime != "" {
|
|
|
+ sciIndex.FinishTime = utils.GormDateStrToDateTimeStr(sciIndex.FinishTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
func GetSciIndex(condition string, pars []interface{}) (items []*SciIndex, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT * FROM base_from_sci_index WHERE 1=1 `
|
|
@@ -121,6 +145,14 @@ type SciIndexData struct {
|
|
|
DataTime string `orm:"column(data_time)" description:"值"`
|
|
|
}
|
|
|
|
|
|
+func (sciIndexData *SciIndexData) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if sciIndexData.DataTime != "" {
|
|
|
+ sciIndexData.DataTime = utils.GormDateStrToDateStr(sciIndexData.DataTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
func GetSciIndexData(indexCode string, startSize, pageSize int) (items []*SciIndexData, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT * FROM base_from_sci_data WHERE index_code=? ORDER BY data_time DESC LIMIT ?,? `
|