kpi.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package model
  2. // const kpi const
  3. const (
  4. // account pendPendant
  5. _accountPendPendantS = 140
  6. _accountPendPendantA = 139
  7. _accountPendPendantB = 138
  8. // _accountPendPendantC = 0
  9. // KPI level and pendant info
  10. _kpiLevelS = int8(1)
  11. _kpiLevelA = int8(2)
  12. _kpiLevelB = int8(3)
  13. _kpiLevelC = int8(4)
  14. _kpiNameplateA = 72
  15. _kpiNameplateB = 71
  16. _kpiNameplateC = 70
  17. _kpiRateTimesA = 12
  18. _kpiRateTimesB = 6
  19. _kpiRateTimesC = 3
  20. _kpiCoinsS = float64(20)
  21. _kpiCoinsA = float64(10)
  22. _kpiCoinsB = float64(5)
  23. _kpiCoinsDefealt = float64(0)
  24. // kpi defealt send days
  25. KPIDefealtPendSendDays = 30
  26. KPICoinsReason = "风纪委员任期奖励"
  27. )
  28. // var kpi var.
  29. var (
  30. // credit level mapping pendant info.
  31. _levelPendant = map[int8][]int64{
  32. _kpiLevelS: {_accountPendPendantS, _accountPendPendantA, _accountPendPendantB},
  33. _kpiLevelA: {_accountPendPendantA, _accountPendPendantB},
  34. _kpiLevelB: {_accountPendPendantB},
  35. _kpiLevelC: {},
  36. }
  37. )
  38. // LevelPendantByKPI get levelPendant by kpi level.
  39. func LevelPendantByKPI(kpiLevel int8) (lps []int64, ok bool) {
  40. lps, ok = _levelPendant[kpiLevel]
  41. return
  42. }
  43. // KpiCoinsRate get coins by rate.
  44. func KpiCoinsRate(rate int8) (coins float64) {
  45. switch rate {
  46. case _kpiLevelS:
  47. coins = _kpiCoinsS
  48. case _kpiLevelA:
  49. coins = _kpiCoinsA
  50. case _kpiLevelB:
  51. coins = _kpiCoinsB
  52. default:
  53. coins = _kpiCoinsDefealt
  54. }
  55. return
  56. }
  57. // KpiPlateIDRateTimes get plate_id by rate times.
  58. func KpiPlateIDRateTimes(rateTimes int) (plateID int64) {
  59. switch rateTimes {
  60. case _kpiRateTimesA:
  61. plateID = _kpiNameplateA
  62. case _kpiRateTimesB:
  63. plateID = _kpiNameplateB
  64. case _kpiRateTimesC:
  65. plateID = _kpiNameplateC
  66. }
  67. return
  68. }