edb_info_record.go 1.0 KB

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