scoresection.go 1002 B

123456789101112131415161718192021222324252627282930
  1. package upcrmdao
  2. import (
  3. "go-common/app/service/main/upcredit/model/calculator"
  4. "go-common/app/service/main/upcredit/model/upcrmmodel"
  5. xtime "go-common/library/time"
  6. "time"
  7. )
  8. //InsertScoreSection insert score section
  9. func (d *Dao) InsertScoreSection(statis calculator.OverAllStatistic, scoreType int, date time.Time) error {
  10. var history upcrmmodel.ScoreSectionHistory
  11. history.Section0 = statis.GetScore(0)
  12. history.Section1 = statis.GetScore(1)
  13. history.Section2 = statis.GetScore(2)
  14. history.Section3 = statis.GetScore(3)
  15. history.Section4 = statis.GetScore(4)
  16. history.Section5 = statis.GetScore(5)
  17. history.Section6 = statis.GetScore(6)
  18. history.Section7 = statis.GetScore(7)
  19. history.Section8 = statis.GetScore(8)
  20. history.Section9 = statis.GetScore(9)
  21. history.ScoreType = scoreType
  22. history.GenerateDate = xtime.Time(date.Unix())
  23. var now = time.Now().Unix()
  24. history.CTime = xtime.Time(now)
  25. history.MTime = xtime.Time(now)
  26. // insert or update
  27. return d.crmdb.Create(&history).Error
  28. }