package services import ( "eta/eta_index_lib/models" "time" ) func AddEditEdbInfoRcord(oldEdbInfo *models.EdbInfo, newEdbInfo *models.EdbInfoEditRecord) (err error) { if oldEdbInfo.EdbName != newEdbInfo.EdbName || oldEdbInfo.Frequency != newEdbInfo.Frequency || oldEdbInfo.Unit != newEdbInfo.Unit { edbRecord := new(models.EdbInfoRecord) edbRecord.EdbInfoId = oldEdbInfo.EdbInfoId edbRecord.OldEdbName = oldEdbInfo.EdbName edbRecord.OldFrequency = oldEdbInfo.Frequency edbRecord.OldUnit = oldEdbInfo.Unit edbRecord.NewEdbName = newEdbInfo.EdbName edbRecord.NewFrequency = newEdbInfo.Frequency edbRecord.NewUnit = newEdbInfo.Unit edbRecord.OperateUserId = newEdbInfo.OperateUserId edbRecord.OperateUserRealName = newEdbInfo.OperateUserRealName ctime := time.Now() edbRecord.CreateTime = ctime edbRecord.Timestamp = ctime.Unix() err = models.AddEditEdbInfoRcord(edbRecord) if err != nil { return } err = models.ModifyEdbInfoBaseTimeById(oldEdbInfo.EdbInfoId, ctime) } return }