- 将IsMobileFake用IsStringLikeMobile替换
- 添加HandleOrder4Consignee, GetRealMobile4Order和GetAuthType4Vendor - 添加GoodsOrder.VendorUserID
This commit is contained in:
@@ -664,13 +664,21 @@ func WriteFile(fileName string, binData []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// func GetRealMobile4Order(order *model.GoodsOrder) (mobileNumber string) {
|
||||
// mobileNumber = order.ConsigneeMobile2
|
||||
// if mobileNumber == "" {
|
||||
// mobileNumber = order.ConsigneeMobile
|
||||
// }
|
||||
// if IsMobileFake(mobileNumber) {
|
||||
// mobileNumber = ""
|
||||
// }
|
||||
// return mobileNumber
|
||||
// }
|
||||
func GetRealMobile4Order(order *model.GoodsOrder) (mobileNumber string) {
|
||||
mobileNumber = order.ConsigneeMobile2
|
||||
if mobileNumber == "" {
|
||||
mobileNumber = order.ConsigneeMobile
|
||||
}
|
||||
if !IsStringLikeMobile(mobileNumber) {
|
||||
mobileNumber = ""
|
||||
}
|
||||
return mobileNumber
|
||||
}
|
||||
|
||||
func GetAuthType4Vendor(vendorID int) (authType string) {
|
||||
authType = model.VendorNames[vendorID]
|
||||
if authType != "" {
|
||||
authType = "vendor." + authType
|
||||
}
|
||||
return authType
|
||||
}
|
||||
|
||||
@@ -370,11 +370,6 @@ func Int2OneZero(value int) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 判断电话号码是否是假的,比如有****号
|
||||
func IsMobileFake(mobile string) bool {
|
||||
return len(mobile) >= 13 || mobile == ""
|
||||
}
|
||||
|
||||
func FormalizeMobile(mobile string) string {
|
||||
mobile = TrimDecorationChar(mobile)
|
||||
return strings.Replace(strings.Replace(mobile, "-", ",", -1), "_", ",", -1)
|
||||
|
||||
@@ -47,17 +47,17 @@ func TestFakeID(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsMobileFake(t *testing.T) {
|
||||
if IsMobileFake("13888888888") {
|
||||
func TestIsStringLikeMobile(t *testing.T) {
|
||||
if !IsStringLikeMobile("13888888888") {
|
||||
t.Fatal("wrong 1")
|
||||
}
|
||||
if IsMobileFake("13888888888-123") {
|
||||
if IsStringLikeMobile("13888888888-123") {
|
||||
t.Fatal("wrong 2")
|
||||
}
|
||||
if IsMobileFake("13888888888,123") {
|
||||
if IsStringLikeMobile("13888888888,123") {
|
||||
t.Fatal("wrong 3")
|
||||
}
|
||||
if !IsMobileFake("138****8888") {
|
||||
if IsStringLikeMobile("138****8888") {
|
||||
t.Fatal("wrong 4")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user