优化账号表
This commit is contained in:
parent
7ecebe62e6
commit
3a5039727b
|
@ -480,22 +480,22 @@ func (svc *AccountSvc) EditAccountPwd(acc *model.Account, ret *model.AccRet) err
|
|||
return caccounts.Update(bson.M{"_id": acc.AccountId}, bson.D{{"$set", bson.D{{"backpassword", acc.TelPassWord}, {"telpassword", hashsum}}}})
|
||||
}
|
||||
|
||||
func (svc *AccountSvc) ResetBackAccountPwd(args *model.AccIdArg, ret *model.AccRet) error {
|
||||
caccounts := AccountCollection(args.Platform)
|
||||
if caccounts == nil {
|
||||
return ErrAccDBNotOpen
|
||||
}
|
||||
|
||||
var acc model.Account
|
||||
err := caccounts.Find(bson.M{"_id": bson.ObjectIdHex(args.AccId)}).One(&acc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(acc.BackPassWord) > 0 {
|
||||
return caccounts.Update(bson.M{"_id": acc.AccountId}, bson.D{{"$set", bson.D{{"telpassword", acc.BackPassWord}}}})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
//func (svc *AccountSvc) ResetBackAccountPwd(args *model.AccIdArg, ret *model.AccRet) error {
|
||||
// caccounts := AccountCollection(args.Platform)
|
||||
// if caccounts == nil {
|
||||
// return ErrAccDBNotOpen
|
||||
// }
|
||||
//
|
||||
// var acc model.Account
|
||||
// err := caccounts.Find(bson.M{"_id": bson.ObjectIdHex(args.AccId)}).One(&acc)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// if len(acc.BackPassWord) > 0 {
|
||||
// return caccounts.Update(bson.M{"_id": acc.AccountId}, bson.D{{"$set", bson.D{{"telpassword", acc.BackPassWord}}}})
|
||||
// }
|
||||
// return nil
|
||||
//}
|
||||
|
||||
/*
|
||||
* 修改帐号密码
|
||||
|
@ -540,7 +540,7 @@ func (svc *AccountSvc) UpdateAccountPlatformInfo(acc *model.Account, ret *model.
|
|||
|
||||
return caccounts.Update(bson.M{"_id": acc.AccountId},
|
||||
bson.D{{"$set", bson.M{"platform": acc.Platform,
|
||||
"channel": acc.Channel, "promoter": acc.Promoter, "inviterid": acc.InviterId, "packegetag": acc.PackegeTag, "promotertree": acc.PromoterTree}}})
|
||||
"channel": acc.Channel, "packegetag": acc.PackegeTag}}})
|
||||
}
|
||||
|
||||
func (svc *AccountSvc) GetRobotAccounts(limit int, accs *[]model.Account) error {
|
||||
|
|
|
@ -147,8 +147,8 @@ func (svc *PlayerDataSvc) GetPlayerData(args *model.GetPlayerDataArgs, ret *mode
|
|||
name = "Guest"
|
||||
}
|
||||
|
||||
pd = model.NewPlayerData(args.Acc, name, id, a.Channel, a.Platform, a.Promoter, a.InviterId, a.PromoterTree, a.Params,
|
||||
a.Tel, a.PackegeTag, dataParams.Ip, 0, dataParams.UnionId, a.DeviceInfo, a.SubPromoter, a.TagKey, a.AccountType)
|
||||
pd = model.NewPlayerData(args.Acc, name, id, a.Channel, a.Platform, a.Params,
|
||||
a.Tel, a.PackegeTag, dataParams.Ip, 0, dataParams.UnionId, a.DeviceInfo, a.TagKey, a.AccountType)
|
||||
if pd != nil {
|
||||
err = cplayerdata.Insert(pd)
|
||||
if err != nil {
|
||||
|
@ -222,8 +222,8 @@ func (svc *PlayerDataSvc) CreatePlayerDataByThird(args *model.CreatePlayer, ret
|
|||
}
|
||||
var dataParams model.PlayerParams
|
||||
json.Unmarshal([]byte(a.Params), &dataParams)
|
||||
pd = model.NewPlayerDataThird(acc, name, args.HeadUrl, id, a.Channel, a.Platform, a.Promoter, a.InviterId,
|
||||
a.PromoterTree, a.Params, a.Tel, a.PackegeTag, dataParams.Ip, a.SubPromoter, a.TagKey, a.AccountType, a.DeviceOs)
|
||||
pd = model.NewPlayerDataThird(acc, name, args.HeadUrl, id, a.Channel, a.Platform, a.Params,
|
||||
a.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs)
|
||||
if pd != nil {
|
||||
err = cplayerdata.Insert(pd)
|
||||
if err != nil {
|
||||
|
@ -292,9 +292,8 @@ func (svc *PlayerDataSvc) CreatePlayerDataOnRegister(args *model.PlayerDataArg,
|
|||
}
|
||||
var dataParams model.PlayerParams
|
||||
json.Unmarshal([]byte(a.Params), &dataParams)
|
||||
pd = model.NewPlayerData(acc, name, id, a.Channel, a.Platform, a.Promoter, a.InviterId,
|
||||
a.PromoterTree, a.Params, a.Tel, a.PackegeTag, dataParams.Ip, int64(args.AddCoin),
|
||||
"", a.DeviceInfo, a.SubPromoter, a.TagKey, a.AccountType)
|
||||
pd = model.NewPlayerData(acc, name, id, a.Channel, a.Platform, a.Params, a.Tel, a.PackegeTag,
|
||||
dataParams.Ip, int64(args.AddCoin), "", a.DeviceInfo, a.TagKey, a.AccountType)
|
||||
pd.HeadUrl = args.HeadUrl
|
||||
if pd != nil {
|
||||
err = cplayerdata.Insert(pd)
|
||||
|
@ -342,8 +341,8 @@ func (svc *PlayerDataSvc) GetPlayerDataBySnId(args *model.GetPlayerDataBySnIdArg
|
|||
name = "Guest"
|
||||
}
|
||||
|
||||
pd := model.NewPlayerData(a.AccountId.Hex(), name, a.SnId, a.Channel, a.Platform, a.Promoter, a.InviterId, a.PromoterTree, a.Params,
|
||||
a.Tel, a.PackegeTag, dataParams.Ip, 0, dataParams.UnionId, a.DeviceInfo, a.SubPromoter, a.TagKey, a.AccountType)
|
||||
pd := model.NewPlayerData(a.AccountId.Hex(), name, a.SnId, a.Channel, a.Platform, a.Params,
|
||||
a.Tel, a.PackegeTag, dataParams.Ip, 0, dataParams.UnionId, a.DeviceInfo, a.TagKey, a.AccountType)
|
||||
if pd != nil {
|
||||
err = cplayerdata.Insert(pd)
|
||||
if err != nil {
|
||||
|
|
|
@ -17,36 +17,31 @@ import (
|
|||
// 登录次数,最后登录最后登出时间并不准确
|
||||
|
||||
type Account struct {
|
||||
AccountId bson.ObjectId `bson:"_id"`
|
||||
SnId int32 //玩家账号直接在这里生成
|
||||
UserName string //Service Provider AccountId
|
||||
PassWord string //昵称密码
|
||||
TelPassWord string //帐号密码
|
||||
BackPassWord string //备份账号密码
|
||||
//VIP int32 //VIP帐号 等级
|
||||
Platform string //平台
|
||||
Channel string //渠道
|
||||
Promoter string //推广员
|
||||
SubPromoter string //子推广员
|
||||
InviterId int32 //邀请人ID
|
||||
PromoterTree int32 //推广树ID
|
||||
Tel string //电话号码
|
||||
Params string //其他参数
|
||||
DeviceOs string //系统
|
||||
PackegeTag string //包标识
|
||||
Package string //包名 android:包名 ios:bundleid
|
||||
DeviceInfo string //设备信息
|
||||
LoginTimes int //登录次数
|
||||
State int64 //冻结到期时间戳
|
||||
RegisteTime time.Time //注册时间
|
||||
LastLoginTime time.Time //最后一次登录时间
|
||||
LastLogoutTime time.Time //最后一次登出时间
|
||||
Flag int32 //二次推广用户标记
|
||||
Remark string //备注信息
|
||||
TagKey int32 //包标识关键字
|
||||
AccountType int32 //1.google 2.facebook
|
||||
RegisterTs int64 // 注册时间戳
|
||||
TelPassWordExpire int64 // 手机验证码登录过期时间戳
|
||||
AccountId bson.ObjectId `bson:"_id"`
|
||||
SnId int32 //玩家账号直接在这里生成
|
||||
UserName string //Service Provider AccountId
|
||||
PassWord string //昵称密码
|
||||
TelPassWord string //帐号密码
|
||||
BackPassWord string //备份账号密码
|
||||
Platform string //平台
|
||||
Channel string //渠道
|
||||
Tel string //电话号码
|
||||
Params string //其他参数
|
||||
DeviceOs string //系统
|
||||
PackegeTag string //包标识
|
||||
Package string //包名 android:包名 ios:bundleid
|
||||
DeviceInfo string //设备信息
|
||||
LoginTimes int //登录次数
|
||||
State int64 //冻结到期时间戳
|
||||
RegisteTime time.Time //注册时间
|
||||
LastLoginTime time.Time //最后一次登录时间
|
||||
LastLogoutTime time.Time //最后一次登出时间
|
||||
Flag int32 //二次推广用户标记
|
||||
Remark string //备注信息
|
||||
TagKey int32 //包标识关键字
|
||||
AccountType int32 //1.google 2.facebook
|
||||
RegisterTs int64 // 注册时间戳
|
||||
TelPassWordExpire int64 // 手机验证码登录过期时间戳
|
||||
}
|
||||
|
||||
func NewAccount() *Account {
|
||||
|
@ -128,11 +123,7 @@ func InsertAccount(userName, passWord, platform, channel, promoter, params, devi
|
|||
acc.Platform = platform
|
||||
acc.Channel = channel
|
||||
acc.Params = params
|
||||
acc.SubPromoter = subPromoter
|
||||
acc.DeviceOs = deviceOs
|
||||
acc.Promoter = promoter
|
||||
acc.InviterId = inviterId
|
||||
acc.PromoterTree = promoterTree
|
||||
acc.LastLoginTime = tCur
|
||||
acc.RegisteTime = tCur
|
||||
acc.LoginTimes = 1
|
||||
|
@ -166,10 +157,7 @@ func InsertTelAccount(userName, passWord, platform, channel, promoter, params st
|
|||
acc.TelPassWord = telpassword
|
||||
acc.Platform = platform
|
||||
acc.Channel = channel
|
||||
acc.Promoter = promoter
|
||||
acc.Params = params
|
||||
acc.InviterId = inviterId
|
||||
acc.PromoterTree = promoterTree
|
||||
acc.LastLoginTime = tCur
|
||||
acc.RegisteTime = tCur
|
||||
acc.LoginTimes = 1
|
||||
|
@ -493,13 +481,10 @@ func UpdateAccountPlatformInfo(account string, platform, channel, promoter, invi
|
|||
return ErrRPClientNoConn
|
||||
}
|
||||
args := &Account{
|
||||
AccountId: bson.ObjectIdHex(account),
|
||||
Platform: strconv.Itoa(int(platform)),
|
||||
Channel: strconv.Itoa(int(channel)),
|
||||
Promoter: strconv.Itoa(int(promoter)),
|
||||
PromoterTree: promoterTree,
|
||||
InviterId: inviterid,
|
||||
PackegeTag: packTag,
|
||||
AccountId: bson.ObjectIdHex(account),
|
||||
Platform: strconv.Itoa(int(platform)),
|
||||
Channel: strconv.Itoa(int(channel)),
|
||||
PackegeTag: packTag,
|
||||
}
|
||||
ret := &AccRet{}
|
||||
err := rpcCli.CallWithTimeout("AccountSvc.UpdateAccountPlatformInfo", args, ret, time.Second*30)
|
||||
|
|
147
model/player.go
147
model/player.go
|
@ -709,9 +709,9 @@ func (this *PlayerData) GetPlayerDataEncoder() (bytes.Buffer, error) {
|
|||
return buf, err
|
||||
}
|
||||
|
||||
func NewPlayerData(acc string, name string, id int32, channel, platform, promoter string, inviterId,
|
||||
promoterTree int32, params, tel string, packTag, ip string, addCoin int64, unionid, deviceInfo string,
|
||||
subPromoter string, tagkey, accountType int32) *PlayerData {
|
||||
func NewPlayerData(acc string, name string, id int32, channel, platform string, params, tel string,
|
||||
packTag, ip string, addCoin int64, unionid, deviceInfo string,
|
||||
tagkey, accountType int32) *PlayerData {
|
||||
if len(name) == 0 {
|
||||
logger.Logger.Trace("New player name is empty.")
|
||||
return nil
|
||||
|
@ -726,47 +726,42 @@ func NewPlayerData(acc string, name string, id int32, channel, platform, promote
|
|||
isRobot := channel == common.Channel_Rob
|
||||
|
||||
pd := &PlayerData{
|
||||
Id: bson.NewObjectId(),
|
||||
AccountId: acc,
|
||||
AccountType: accountType,
|
||||
Name: name,
|
||||
Channel: channel,
|
||||
Platform: platform,
|
||||
SnId: id,
|
||||
InviterId: inviterId,
|
||||
PromoterTree: promoterTree,
|
||||
Head: rand.Int31n(common.HeadRange),
|
||||
//Coin: int64(GameParamData.NewPlayerCoin) + addCoin,
|
||||
SafeBoxPassword: pwd,
|
||||
Ip: ip,
|
||||
RegIp: ip,
|
||||
Params: params,
|
||||
Tel: tel,
|
||||
SubBeUnderAgentCode: subPromoter,
|
||||
AgentType: 0,
|
||||
LastLoginTime: tNow.Local(),
|
||||
LastLogoutTime: tNow.AddDate(0, 0, -1).Local(),
|
||||
CreateTime: tNow.Local(),
|
||||
Ver: VER_PLAYER_MAX - 1,
|
||||
HeadOutLine: 1,
|
||||
VIP: 0,
|
||||
CoinPayTotal: 0,
|
||||
MoneyPayTotal: 0,
|
||||
IsRob: isRobot,
|
||||
BeUnderAgentCode: promoter,
|
||||
PackageID: packTag,
|
||||
WBLevel: 0,
|
||||
WBCoinTotalOut: 0,
|
||||
WBCoinTotalIn: 0,
|
||||
WBCoinLimit: 0,
|
||||
YesterdayGameData: NewPlayerGameCtrlData(),
|
||||
TodayGameData: NewPlayerGameCtrlData(),
|
||||
TotalGameData: make(map[int][]*PlayerGameTotal),
|
||||
GDatas: make(map[string]*PlayerGameInfo),
|
||||
TagKey: tagkey,
|
||||
ShopTotal: make(map[int32]*ShopTotal),
|
||||
ShopLastLookTime: make(map[int32]int64),
|
||||
IsFoolPlayer: make(map[string]bool),
|
||||
Id: bson.NewObjectId(),
|
||||
AccountId: acc,
|
||||
AccountType: accountType,
|
||||
Name: name,
|
||||
Channel: channel,
|
||||
Platform: platform,
|
||||
SnId: id,
|
||||
Head: rand.Int31n(common.HeadRange),
|
||||
SafeBoxPassword: pwd,
|
||||
Ip: ip,
|
||||
RegIp: ip,
|
||||
Params: params,
|
||||
Tel: tel,
|
||||
AgentType: 0,
|
||||
LastLoginTime: tNow.Local(),
|
||||
LastLogoutTime: tNow.AddDate(0, 0, -1).Local(),
|
||||
CreateTime: tNow.Local(),
|
||||
Ver: VER_PLAYER_MAX - 1,
|
||||
HeadOutLine: 1,
|
||||
VIP: 0,
|
||||
CoinPayTotal: 0,
|
||||
MoneyPayTotal: 0,
|
||||
IsRob: isRobot,
|
||||
PackageID: packTag,
|
||||
WBLevel: 0,
|
||||
WBCoinTotalOut: 0,
|
||||
WBCoinTotalIn: 0,
|
||||
WBCoinLimit: 0,
|
||||
YesterdayGameData: NewPlayerGameCtrlData(),
|
||||
TodayGameData: NewPlayerGameCtrlData(),
|
||||
TotalGameData: make(map[int][]*PlayerGameTotal),
|
||||
GDatas: make(map[string]*PlayerGameInfo),
|
||||
TagKey: tagkey,
|
||||
ShopTotal: make(map[int32]*ShopTotal),
|
||||
ShopLastLookTime: make(map[int32]int64),
|
||||
IsFoolPlayer: make(map[string]bool),
|
||||
//测试数据
|
||||
PowerList: []int32{1}, //默认炮台
|
||||
UnMaxPower: 10, //初始化炮倍最小倍数
|
||||
|
@ -781,47 +776,43 @@ func NewPlayerData(acc string, name string, id int32, channel, platform, promote
|
|||
return pd
|
||||
}
|
||||
|
||||
func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, platform, promoter string, inviterId,
|
||||
promoterTree int32, params, tel string, packTag, ip string, subPromoter string, tagkey, accountType int32, deviceOS string) *PlayerData {
|
||||
func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, platform string, params, tel string,
|
||||
packTag, ip string, tagkey, accountType int32, deviceOS string) *PlayerData {
|
||||
if len(name) == 0 {
|
||||
logger.Logger.Trace("New player name is empty.")
|
||||
return nil
|
||||
}
|
||||
tNow := time.Now()
|
||||
pd := &PlayerData{
|
||||
Id: bson.NewObjectId(),
|
||||
AccountId: acc,
|
||||
Name: name,
|
||||
Channel: channel,
|
||||
Platform: platform,
|
||||
SnId: id,
|
||||
InviterId: inviterId,
|
||||
PromoterTree: promoterTree,
|
||||
Head: rand.Int31n(common.HeadRange),
|
||||
HeadUrl: headUrl,
|
||||
Id: bson.NewObjectId(),
|
||||
AccountId: acc,
|
||||
Name: name,
|
||||
Channel: channel,
|
||||
Platform: platform,
|
||||
SnId: id,
|
||||
Head: rand.Int31n(common.HeadRange),
|
||||
HeadUrl: headUrl,
|
||||
//Coin: int64(GameParamData.NewPlayerCoin),
|
||||
Ip: ip,
|
||||
RegIp: ip,
|
||||
Params: params,
|
||||
Tel: tel,
|
||||
SubBeUnderAgentCode: subPromoter,
|
||||
LastLoginTime: tNow.Local(),
|
||||
LastLogoutTime: tNow.AddDate(0, 0, -1).Local(),
|
||||
CreateTime: tNow.Local(),
|
||||
Ver: VER_PLAYER_MAX - 1,
|
||||
HeadOutLine: 1,
|
||||
IsRob: false,
|
||||
BeUnderAgentCode: promoter,
|
||||
PackageID: packTag,
|
||||
YesterdayGameData: NewPlayerGameCtrlData(),
|
||||
TodayGameData: NewPlayerGameCtrlData(),
|
||||
TotalGameData: make(map[int][]*PlayerGameTotal),
|
||||
GDatas: make(map[string]*PlayerGameInfo),
|
||||
TagKey: tagkey,
|
||||
ShopTotal: make(map[int32]*ShopTotal),
|
||||
ShopLastLookTime: make(map[int32]int64),
|
||||
AccountType: accountType,
|
||||
DeviceOS: deviceOS,
|
||||
Ip: ip,
|
||||
RegIp: ip,
|
||||
Params: params,
|
||||
Tel: tel,
|
||||
LastLoginTime: tNow.Local(),
|
||||
LastLogoutTime: tNow.AddDate(0, 0, -1).Local(),
|
||||
CreateTime: tNow.Local(),
|
||||
Ver: VER_PLAYER_MAX - 1,
|
||||
HeadOutLine: 1,
|
||||
IsRob: false,
|
||||
PackageID: packTag,
|
||||
YesterdayGameData: NewPlayerGameCtrlData(),
|
||||
TodayGameData: NewPlayerGameCtrlData(),
|
||||
TotalGameData: make(map[int][]*PlayerGameTotal),
|
||||
GDatas: make(map[string]*PlayerGameInfo),
|
||||
TagKey: tagkey,
|
||||
ShopTotal: make(map[int32]*ShopTotal),
|
||||
ShopLastLookTime: make(map[int32]int64),
|
||||
AccountType: accountType,
|
||||
DeviceOS: deviceOS,
|
||||
}
|
||||
|
||||
pd.InitNewData(params)
|
||||
|
|
Loading…
Reference in New Issue