Compare commits
3 Commits
83f571b543
...
23b44237d8
Author | SHA1 | Date |
---|---|---|
|
23b44237d8 | |
|
d6cb1f3266 | |
|
404017c33e |
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/rpc"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/globalsign/mgo"
|
||||
|
@ -106,13 +107,30 @@ func (svc *AccountSvc) AccountIsExist(args *model.AccIsExistArg, ret *model.AccR
|
|||
|
||||
case common.LoginTypeTelCode:
|
||||
err := caccounts.Find(bson.M{"tel": args.Tel, "tagkey": args.TagKey}).One(acc)
|
||||
if err != nil {
|
||||
if errors.Is(err, mgo.ErrNotFound) {
|
||||
// 兼容8550开头的手机号,8550和855算同一个区号
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
if args.CodeValid {
|
||||
// 刷新密码和有效期
|
||||
|
|
|
@ -777,6 +777,7 @@ func NewPlayerData(acc string, name string, id int32, channel, platform string,
|
|||
UnMaxPower: 10, //初始化炮倍最小倍数
|
||||
WeekCardTime: make(map[int32]int64),
|
||||
WeekCardAward: make(map[int32]bool),
|
||||
WelfData: NewWelfareData(),
|
||||
}
|
||||
|
||||
if tel != "" {
|
||||
|
|
|
@ -15,9 +15,10 @@ import (
|
|||
"time"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
)
|
||||
|
||||
const DEFAULT_TIMEOUT = time.Duration(time.Second * 30)
|
||||
const DEFAULT_TIMEOUT = time.Second * 30
|
||||
|
||||
var WebApiStats = new(sync.Map)
|
||||
|
||||
|
@ -81,7 +82,7 @@ func getRequest(appId, action string, params map[string]string, body proto.Messa
|
|||
}
|
||||
|
||||
callUrl := MakeURL(appId, action, params, data)
|
||||
//println("callurl=", callUrl)
|
||||
logger.Logger.Tracef("getRequest url: %v params: %v request body: %v", callUrl, params, body)
|
||||
req, err := http.NewRequest("GET", callUrl, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -129,7 +130,7 @@ func getRequest(appId, action string, params map[string]string, body proto.Messa
|
|||
}
|
||||
return body, err
|
||||
}
|
||||
println("callurl=", callUrl, "code=", resp.StatusCode)
|
||||
logger.Logger.Errorf("getRequest url:%v params:%v request body:%v code:%v", callUrl, params, body, resp.StatusCode)
|
||||
return nil, fmt.Errorf("StatusCode:%d", resp.StatusCode)
|
||||
}
|
||||
|
||||
|
@ -152,7 +153,7 @@ func postRequest(appId, action string, params map[string]string, body proto.Mess
|
|||
}
|
||||
|
||||
callUrl := MakeURL(appId, action, params, data)
|
||||
//println("callurl=", callUrl)
|
||||
logger.Logger.Tracef("postRequest url: %v request body: %v", callUrl, body)
|
||||
req, err := http.NewRequest("POST", callUrl, bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -200,7 +201,7 @@ func postRequest(appId, action string, params map[string]string, body proto.Mess
|
|||
}
|
||||
return body, err
|
||||
}
|
||||
println("callurl=", callUrl, "code=", resp.StatusCode)
|
||||
logger.Logger.Errorf("postRequest url:%v request body: %v code: %v", callUrl, body, resp.StatusCode)
|
||||
return nil, fmt.Errorf("StatusCode:%d", resp.StatusCode)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
|
@ -2706,6 +2707,8 @@ func CSPlayerSMSCode(s *netlib.Session, packetId int, data interface{}, sid int6
|
|||
return nil
|
||||
}
|
||||
|
||||
msg.Tel = strings.TrimPrefix(msg.GetTel(), "0")
|
||||
|
||||
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
||||
// tel
|
||||
if !telRule.MatchString(tel) {
|
||||
|
@ -2857,6 +2860,8 @@ func CSBindTel(s *netlib.Session, packetId int, data interface{}, sid int64) err
|
|||
// return nil
|
||||
//}
|
||||
|
||||
msg.Tel = strings.TrimPrefix(msg.GetTel(), "0")
|
||||
|
||||
tel := fmt.Sprint(msg.GetAreaCode(), msg.GetTel())
|
||||
telKey := common.GetBindTelCodeKey(p.Platform, tel)
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ func CSBindInvite(s *netlib.Session, packetid int, data interface{}, sid int64)
|
|||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||
if err != nil || inviteSnId == 0 {
|
||||
logger.Logger.Errorf("GetSnIdByCode err %v %v", err, inviteSnId)
|
||||
logger.Logger.Tracef("GetSnIdByCode not found %v %v", err, msg.GetCode())
|
||||
ret.OpRetCode = welfare.OpResultCode_OPRC_NotExist
|
||||
send()
|
||||
return
|
||||
|
|
|
@ -2,9 +2,8 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/webapi"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core"
|
||||
"mongo.games.com/goserver/core/basic"
|
||||
"mongo.games.com/goserver/core/module"
|
||||
|
@ -14,7 +13,10 @@ import (
|
|||
"mongo.games.com/goserver/core/task"
|
||||
"mongo.games.com/goserver/core/transact"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/webapi"
|
||||
)
|
||||
|
||||
var MonitorMgrSington = &MonitorMgr{}
|
||||
|
@ -164,5 +166,4 @@ func init() {
|
|||
//gob registe
|
||||
|
||||
module.RegisteModule(MonitorMgrSington, time.Minute*5, 0)
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/module"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core/module"
|
||||
|
||||
"mongo.games.com/game/model"
|
||||
)
|
||||
|
||||
var PlayerOnlineSington = &PlayerOnlineEvent{
|
||||
|
@ -55,7 +58,7 @@ func (p *PlayerOnlineEvent) Update() {
|
|||
|
||||
here:
|
||||
p.OnlineCh = onlineCh
|
||||
//LogChannelSingleton.WriteMQData(model.GenerateOnline(p.OnlineCh))
|
||||
LogChannelSingleton.WriteMQData(model.GenerateOnline(p.OnlineCh))
|
||||
}
|
||||
|
||||
func (p *PlayerOnlineEvent) Shutdown() {
|
||||
|
|
Loading…
Reference in New Issue