|
|
@@ -7,7 +7,7 @@ import (
|
|
|
"gbase/glog"
|
|
|
)
|
|
|
|
|
|
-func GetAgeFromIdCard(idCard string) (age int) {
|
|
|
+func GetAgeFromIdCard(idCard string, increment int) (age int) {
|
|
|
age = 0
|
|
|
if len(idCard) != 18 {
|
|
|
return age
|
|
|
@@ -28,9 +28,9 @@ func GetAgeFromIdCard(idCard string) (age int) {
|
|
|
firstDayOfNextYear := time.Date(today.Year()+1, 1, 1, 0, 0, 0, 0, time.UTC)
|
|
|
lastDayOfYear := firstDayOfNextYear.AddDate(0, 0, -1)
|
|
|
if lastDayOfYear.Month() > birthday.Month() {
|
|
|
- age += 1
|
|
|
+ age += increment
|
|
|
} else if lastDayOfYear.Month() == birthday.Month() && lastDayOfYear.Day() > birthday.Day() {
|
|
|
- age += 1
|
|
|
+ age += increment
|
|
|
} else {
|
|
|
age += 0
|
|
|
}
|