From 3ae904b5bc66eddcebd310aaea5ba20294b68874 Mon Sep 17 00:00:00 2001 From: guanguans Date: Tue, 12 Jan 2021 11:18:07 +0800 Subject: [PATCH] Fix `fake` method --- checker.go | 2 +- helpers.go => helper.go | 0 id_validator.go | 9 +++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) rename helpers.go => helper.go (100%) diff --git a/checker.go b/checker.go index ca2cece..99e65bb 100644 --- a/checker.go +++ b/checker.go @@ -9,7 +9,7 @@ import ( ) // 检查ID参数 -func CheckIDArgument(id string) bool { +func CheckIdArgument(id string) bool { _, err := GenerateCode(id) return err == nil diff --git a/helpers.go b/helper.go similarity index 100% rename from helpers.go rename to helper.go diff --git a/id_validator.go b/id_validator.go index aec2c64..b047f69 100644 --- a/id_validator.go +++ b/id_validator.go @@ -97,7 +97,12 @@ func GetInfo(id string) (IdInfo, error) { } // 生成假身份证号码 -func Fake(isEighteen bool, address string, birthday string, sex int) string { +func FakeId() string { + return FakeRequireId(true, "", "", 0) +} + +// 按要求生成假身份证号码 +func FakeRequireId(isEighteen bool, address string, birthday string, sex int) string { // 生成地址码 addressCode := GeneratorAddressCode(address) @@ -108,7 +113,7 @@ func Fake(isEighteen bool, address string, birthday string, sex int) string { orderCode := GeneratorOrderCode(sex) if !isEighteen { - return addressCode + Substr(birthdayCode, 2, 6) + orderCode + return addressCode + Substr(birthdayCode, 2, 8) + orderCode } body := addressCode + birthdayCode + orderCode