- handle ebai fake mobile(IsMobileFake)
This commit is contained in:
@@ -187,3 +187,8 @@ func Int2OneZero(value int) int {
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 判断电话号码是否是假的,比如有****号
|
||||
func IsMobileFake(mobile string) bool {
|
||||
return utils.Str2Int64WithDefault(strings.Replace(strings.Replace(mobile, "-", "", -1), ",", "", -1), 0) == 0
|
||||
}
|
||||
|
||||
@@ -46,3 +46,18 @@ func TestFakeID(t *testing.T) {
|
||||
t.Fatalf("wrong result for id:%d", id)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsMobileFake(t *testing.T) {
|
||||
if IsMobileFake("13888888888") {
|
||||
t.Fatal("wrong 1")
|
||||
}
|
||||
if IsMobileFake("13888888888-123") {
|
||||
t.Fatal("wrong 2")
|
||||
}
|
||||
if IsMobileFake("13888888888,123") {
|
||||
t.Fatal("wrong 3")
|
||||
}
|
||||
if !IsMobileFake("138****8888") {
|
||||
t.Fatal("wrong 4")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,11 @@ func (p *PurchaseHandler) GetOrder(vendorOrderID string) (order *model.GoodsOrde
|
||||
ActualPayPrice: utils.MustInterface2Int64(orderMap["user_fee"]),
|
||||
Skus: []*model.OrderSku{},
|
||||
}
|
||||
if jxutils.IsMobileFake(order.ConsigneeMobile) {
|
||||
if mobileInfo, err := api.EbaiAPI.OrderPrivateInfo(vendorOrderID); err == nil {
|
||||
order.ConsigneeMobile = mobileInfo.ShortNumber
|
||||
}
|
||||
}
|
||||
if order.StoreID > math.MaxInt32 {
|
||||
order.StoreID = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user