兼容以0开头的手机号登录
This commit is contained in:
parent
404017c33e
commit
d6cb1f3266
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/rpc"
|
"net/rpc"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/globalsign/mgo"
|
"github.com/globalsign/mgo"
|
||||||
|
|
@ -108,10 +109,27 @@ func (svc *AccountSvc) AccountIsExist(args *model.AccIsExistArg, ret *model.AccR
|
||||||
err := caccounts.Find(bson.M{"tel": args.Tel, "tagkey": args.TagKey}).One(acc)
|
err := caccounts.Find(bson.M{"tel": args.Tel, "tagkey": args.TagKey}).One(acc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, mgo.ErrNotFound) {
|
if errors.Is(err, mgo.ErrNotFound) {
|
||||||
ret.Tag = common.LoginNew
|
// 兼容8550开头的手机号,8550和855算同一个区号
|
||||||
return nil
|
if strings.HasPrefix(args.Tel, "855") {
|
||||||
|
tel := make([]byte, len(args.Tel)+1)
|
||||||
|
copy(tel, "8550")
|
||||||
|
copy(tel[4:], args.Tel[3:])
|
||||||
|
err = caccounts.Find(bson.M{"tel": string(tel), "tagkey": args.TagKey}).One(acc)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, mgo.ErrNotFound) {
|
||||||
|
ret.Tag = common.LoginNew
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
acc.Tel = args.Tel
|
||||||
|
caccounts.Update(bson.M{"_id": acc.AccountId}, bson.D{{"$set", bson.D{{"tel", args.Tel}}}})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.CodeValid {
|
if args.CodeValid {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
|
@ -2706,6 +2707,8 @@ func CSPlayerSMSCode(s *netlib.Session, packetId int, data interface{}, sid int6
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.Tel = strings.TrimPrefix(msg.GetTel(), "0")
|
||||||
|
|
||||||
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
||||||
// tel
|
// tel
|
||||||
if !telRule.MatchString(tel) {
|
if !telRule.MatchString(tel) {
|
||||||
|
|
@ -2857,6 +2860,8 @@ func CSBindTel(s *netlib.Session, packetId int, data interface{}, sid int64) err
|
||||||
// return nil
|
// return nil
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
msg.Tel = strings.TrimPrefix(msg.GetTel(), "0")
|
||||||
|
|
||||||
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
||||||
telKey := common.GetBindTelCodeKey(p.Platform, tel)
|
telKey := common.GetBindTelCodeKey(p.Platform, tel)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue