edb_info_record.go 1019 B

123456789101112131415161718192021222324252627282930
  1. package services
  2. import (
  3. "eta/eta_index_lib/models"
  4. "time"
  5. )
  6. func AddEditEdbInfoRcord(oldEdbInfo *models.EdbInfo, newEdbInfo *models.EdbInfoEditRecord) (err error) {
  7. if oldEdbInfo.EdbName != newEdbInfo.EdbName || oldEdbInfo.Frequency != newEdbInfo.Frequency || oldEdbInfo.Unit != newEdbInfo.Unit {
  8. edbRecord := new(models.EdbInfoRecord)
  9. edbRecord.EdbInfoId = oldEdbInfo.EdbInfoId
  10. edbRecord.OldEdbName = oldEdbInfo.EdbName
  11. edbRecord.OldFrequency = oldEdbInfo.Frequency
  12. edbRecord.OldUnit = oldEdbInfo.Unit
  13. edbRecord.NewEdbName = newEdbInfo.EdbName
  14. edbRecord.NewFrequency = newEdbInfo.Frequency
  15. edbRecord.NewUnit = newEdbInfo.Unit
  16. edbRecord.OperateUserId = newEdbInfo.OperateUserId
  17. edbRecord.OperateUserRealName = newEdbInfo.OperateUserRealName
  18. ctime := time.Now()
  19. edbRecord.CreateTime = ctime
  20. edbRecord.Timestamp = ctime.Unix()
  21. err = models.AddEditEdbInfoRcord(edbRecord)
  22. if err != nil {
  23. return
  24. }
  25. err = models.ModifyEdbInfoBaseTimeById(oldEdbInfo.EdbInfoId, ctime)
  26. }
  27. return
  28. }