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