Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
128038beda | ||
![]() |
a4305759fc | ||
![]() |
37aa2028aa | ||
![]() |
dc42e3b8d4 | ||
![]() |
30b200467e | ||
1216a7d741 | |||
3b1bbffc6c | |||
3957d8f9a8 | |||
![]() |
0cbc90c4f1 | ||
![]() |
69b2db191e | ||
![]() |
f32e1fe47f | ||
![]() |
97a7af158d | ||
![]() |
eda59f8c72 | ||
![]() |
e57b3051f5 | ||
![]() |
a66806a724 | ||
![]() |
c75ad6e121 | ||
![]() |
5bb52d4342 | ||
![]() |
baa20f27a2 | ||
![]() |
1f1400f101 | ||
![]() |
8feb0e1050 | ||
![]() |
c7509063d1 | ||
![]() |
a7c69faee1 | ||
![]() |
0dc104abdf | ||
![]() |
ac48074909 | ||
![]() |
ea36a05b14 | ||
![]() |
9a2930cec4 | ||
ec837c26b3 | |||
![]() |
fcdeb03d01 | ||
![]() |
839ecb8bd9 | ||
![]() |
6736982cc2 | ||
![]() |
01c6c386a9 | ||
![]() |
46fcb8c57c | ||
![]() |
9f10f02d80 | ||
![]() |
7c260b04cb | ||
![]() |
bc43c9e28f | ||
![]() |
7bc0fb7164 | ||
![]() |
a66f1d9a02 | ||
![]() |
4547820c28 | ||
![]() |
8fe90377b7 | ||
![]() |
a9cac80248 | ||
![]() |
829f535c8f | ||
![]() |
3f32e28de4 | ||
![]() |
17c04e0697 | ||
![]() |
4577aab939 | ||
![]() |
4e2973a6c6 | ||
![]() |
ba34ecc95a | ||
![]() |
7c3e85aa59 | ||
![]() |
84188ac723 | ||
![]() |
c7bc4d165f | ||
![]() |
873447d84b | ||
c4977b93a2 | |||
e39a25d864 | |||
ed5855a780 | |||
7885698e0e | |||
f295141c04 | |||
2b1ceec576 | |||
1d6d47d305 | |||
fbb6812101 | |||
![]() |
1622ca5f09 | ||
![]() |
4ad76b5aec | ||
![]() |
521708177c | ||
![]() |
09f2d92207 | ||
![]() |
1b5b5b63e0 | ||
![]() |
ac5a180cd1 |
@ -115,6 +115,10 @@
|
|||||||
"switch_name": "ui.officeSite",
|
"switch_name": "ui.officeSite",
|
||||||
"switch_desc": "29-官网"
|
"switch_desc": "29-官网"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"switch_name": "circuitTask",
|
||||||
|
"switch_desc": "30-巡回赛任务"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"switch_name": "only.allowed.superWhiteList",
|
"switch_name": "only.allowed.superWhiteList",
|
||||||
"switch_desc": "100-只允许至尊白名单用户登录登录"
|
"switch_desc": "100-只允许至尊白名单用户登录登录"
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
"immutable_base_url": "https://api.sandbox.immutable.com",
|
"immutable_base_url": "https://api.sandbox.immutable.com",
|
||||||
"hero_contract_address": "0x65570A86E5aA2B14325f8a13C70b74f7d1E2f5c9",
|
"hero_contract_address": "0x65570A86E5aA2B14325f8a13C70b74f7d1E2f5c9",
|
||||||
"immutable_api_key": "sk_imapik-test-kbe8ZWVEzySQPmdiOd8H_ac92cd",
|
"immutable_api_key": "sk_imapik-test-kbe8ZWVEzySQPmdiOd8H_ac92cd",
|
||||||
"chain_name": "imtbl-zkevm-testnet"
|
"chain_name": "imtbl-zkevm-testnet",
|
||||||
|
"scoreboard_height": 100
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
"game_start_notify_time": 20,
|
"game_start_notify_time": 20,
|
||||||
"delay_delete_time": 60,
|
"delay_delete_time": 60,
|
||||||
"match_real_player": 1,
|
"match_real_player": 1,
|
||||||
"circuit_mode_interval_time": 120
|
"circuit_mode_interval_time": 0
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"f5"
|
"f5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
@ -8,6 +9,7 @@ import (
|
|||||||
"main/mt"
|
"main/mt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"q5"
|
"q5"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -54,6 +56,7 @@ func (this *GameSwitchApi) List(c *gin.Context) {
|
|||||||
page := c.DefaultQuery("page", "")
|
page := c.DefaultQuery("page", "")
|
||||||
result := []struct {
|
result := []struct {
|
||||||
system.GameSwitch
|
system.GameSwitch
|
||||||
|
Servers []int32 `json:"serverList"`
|
||||||
Remark string `json:"remark"`
|
Remark string `json:"remark"`
|
||||||
}{}
|
}{}
|
||||||
f5.GetGoStyleDb().PageQuery(
|
f5.GetGoStyleDb().PageQuery(
|
||||||
@ -82,6 +85,8 @@ func (this *GameSwitchApi) List(c *gin.Context) {
|
|||||||
if exist {
|
if exist {
|
||||||
p.Remark = desc
|
p.Remark = desc
|
||||||
}
|
}
|
||||||
|
p.Servers = make([]int32, 0)
|
||||||
|
json.Unmarshal([]byte(pg.Rows.GetByName("server_list")), &p.Servers)
|
||||||
p.AuditOpen = q5.SafeToInt32(pg.Rows.GetByName("audit_is_open"))
|
p.AuditOpen = q5.SafeToInt32(pg.Rows.GetByName("audit_is_open"))
|
||||||
p.CreateTime = q5.SafeToInt32(pg.Rows.GetByName("createtime"))
|
p.CreateTime = q5.SafeToInt32(pg.Rows.GetByName("createtime"))
|
||||||
p.ModifyTime = q5.SafeToInt32(pg.Rows.GetByName("modifytime"))
|
p.ModifyTime = q5.SafeToInt32(pg.Rows.GetByName("modifytime"))
|
||||||
@ -141,6 +146,7 @@ func (this *GameSwitchApi) Edit(c *gin.Context) {
|
|||||||
req := struct {
|
req := struct {
|
||||||
Name string `binding:"required" json:"switch_name"`
|
Name string `binding:"required" json:"switch_name"`
|
||||||
Open *int32 `binding:"required" json:"is_open"`
|
Open *int32 `binding:"required" json:"is_open"`
|
||||||
|
Servers []int `json:"serverList"`
|
||||||
AuditOpen *int32 `binding:"required" json:"audit_is_open"`
|
AuditOpen *int32 `binding:"required" json:"audit_is_open"`
|
||||||
Remark string `json:"remark"`
|
Remark string `json:"remark"`
|
||||||
}{}
|
}{}
|
||||||
@ -151,7 +157,10 @@ func (this *GameSwitchApi) Edit(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gswitch := new(system.GameSwitch)
|
gswitch := new(struct {
|
||||||
|
system.GameSwitch
|
||||||
|
Servers string `gorm:"column:server_list" json:"serverList"`
|
||||||
|
})
|
||||||
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
||||||
if err := db.Take(gswitch, "switch_name = ?", req.Name).Error; err != nil {
|
if err := db.Take(gswitch, "switch_name = ?", req.Name).Error; err != nil {
|
||||||
if !f5.IsOrmErrRecordNotFound(err) {
|
if !f5.IsOrmErrRecordNotFound(err) {
|
||||||
@ -169,8 +178,11 @@ func (this *GameSwitchApi) Edit(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Ints(req.Servers)
|
||||||
nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
|
nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
|
||||||
gswitch.Opened = *req.Open
|
gswitch.Opened = *req.Open
|
||||||
|
serverbytes, _ := json.Marshal(req.Servers)
|
||||||
|
gswitch.Servers = string(serverbytes)
|
||||||
gswitch.AuditOpen = *req.AuditOpen
|
gswitch.AuditOpen = *req.AuditOpen
|
||||||
gswitch.ModifyTime = nowDaySeconds
|
gswitch.ModifyTime = nowDaySeconds
|
||||||
if err := db.Where("switch_name = ?", req.Name).Save(gswitch).Error; err != nil {
|
if err := db.Where("switch_name = ?", req.Name).Save(gswitch).Error; err != nil {
|
||||||
|
@ -65,11 +65,7 @@ func (pai *PlayerApi) Info(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if len(accountids) == 0 {
|
if len(accountids) == 0 {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 0, "")
|
||||||
"code": 0,
|
|
||||||
"message": "",
|
|
||||||
})
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +77,7 @@ func (pai *PlayerApi) Info(c *gin.Context) {
|
|||||||
filterstr += ")"
|
filterstr += ")"
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 1, "input one of playername, account_id, address, email")
|
||||||
"code": 1,
|
|
||||||
"message": "input one of playername, account_id, address, email",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sql := fmt.Sprintf(`SELECT * FROM t_user WHERE idx > %d AND %s `, cursor, filterstr)
|
sql := fmt.Sprintf(`SELECT * FROM t_user WHERE idx > %d AND %s `, cursor, filterstr)
|
||||||
@ -139,10 +132,7 @@ func (pai *PlayerApi) BagQuery(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqJson.Account_id) > 0xFF {
|
if len(reqJson.Account_id) > 0xFF {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 1, "输入过长")
|
||||||
"code": 1,
|
|
||||||
"message": "输入过长",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,10 +158,7 @@ func (pai *PlayerApi) HeroesQuery(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqJson.Account_id) > 0xFF {
|
if len(reqJson.Account_id) > 0xFF {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 1, "输入过长")
|
||||||
"code": 1,
|
|
||||||
"message": "输入过长",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,10 +254,7 @@ func (pai *PlayerApi) GoldBullionQuery(c *gin.Context) {
|
|||||||
} else if reqJson.Open_address != "" {
|
} else if reqJson.Open_address != "" {
|
||||||
filterstr = " open_address = '" + reqJson.Open_address + "'"
|
filterstr = " open_address = '" + reqJson.Open_address + "'"
|
||||||
} else {
|
} else {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 1, "input one of token_id, open_address")
|
||||||
"code": 1,
|
|
||||||
"message": "input one of token_id, open_address",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,10 +314,7 @@ func (pai *PlayerApi) GameMallQuery(c *gin.Context) {
|
|||||||
} else if reqJson.Seller_address != "" {
|
} else if reqJson.Seller_address != "" {
|
||||||
filterstr = " seller_address = '" + reqJson.Seller_address + "'"
|
filterstr = " seller_address = '" + reqJson.Seller_address + "'"
|
||||||
} else {
|
} else {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr2(c, 1, "input one of order_id, seller, seller_address")
|
||||||
"code": 1,
|
|
||||||
"message": "input one of order_id, seller, seller_address",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,6 +328,51 @@ func (pai *PlayerApi) GameMallQuery(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pai *PlayerApi) InappOrderQuery(c *gin.Context) {
|
||||||
|
type InappOrderQueryForm struct {
|
||||||
|
Order_id string `json:"order_id"`
|
||||||
|
SP_Order_id string `json:"sp_order_id"`
|
||||||
|
Account_id string `json:"account_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
reqJson := InappOrderQueryForm{}
|
||||||
|
if !checkparam(&reqJson, c) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
filterstr := ""
|
||||||
|
if reqJson.Order_id != "" {
|
||||||
|
filterstr = " order_id = '" + reqJson.Order_id + "'"
|
||||||
|
} else if reqJson.SP_Order_id != "" {
|
||||||
|
filterstr = " sp_order_id = '" + reqJson.SP_Order_id + "'"
|
||||||
|
} else if reqJson.Account_id != "" {
|
||||||
|
filterstr = " account_id = '" + reqJson.Account_id + "'"
|
||||||
|
} else {
|
||||||
|
f5.RspErr2(c, 1, "input one of order_id, app store order_id, account_id")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor := q5.ToInt64(c.DefaultQuery("cursor", ""))
|
||||||
|
sql := fmt.Sprintf(`SELECT * FROM t_inapp_order WHERE idx > %d AND %s `, cursor, filterstr)
|
||||||
|
|
||||||
|
query(constant.GAME_DB, cursor, sql, c, func(ds *f5.DataSet) interface{} {
|
||||||
|
p := new(struct {
|
||||||
|
Idx int64 `gorm:"column:idx" json:"idx"`
|
||||||
|
Order_id string `gorm:"column:order_id" json:"order_id"`
|
||||||
|
SP_Order_id string `gorm:"column:sp_order_id" json:"sp_order_id"`
|
||||||
|
Platform int `gorm:"column:platform" json:"platform"`
|
||||||
|
Account_id string `gorm:"column:account_id" json:"account_id"`
|
||||||
|
Goods_id int `gorm:"column:goods_id" json:"goods_id"`
|
||||||
|
Price float64 `gorm:"column:price" json:"price"`
|
||||||
|
Status int `gorm:"column:status" json:"status"`
|
||||||
|
Createtime int `gorm:"column:createtime" json:"createtime"`
|
||||||
|
Modifytime int `gorm:"column:modifytime" json:"modifytime"`
|
||||||
|
})
|
||||||
|
f5.UnmarshalModel(ds, p)
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (pai *PlayerApi) RechargeQuery(c *gin.Context) {
|
func (pai *PlayerApi) RechargeQuery(c *gin.Context) {
|
||||||
type RechargeQueryForm struct {
|
type RechargeQueryForm struct {
|
||||||
Identity string `binding:"required" json:"identity"`
|
Identity string `binding:"required" json:"identity"`
|
||||||
|
@ -19,6 +19,7 @@ func (pr *PlayerRouter) InitPlayerRouter(priRouter *gin.RouterGroup) {
|
|||||||
group.POST("goldbullionquery", middleware.Permission("api/v1/player/goldbullionquery", api.GoldBullionQuery))
|
group.POST("goldbullionquery", middleware.Permission("api/v1/player/goldbullionquery", api.GoldBullionQuery))
|
||||||
group.POST("ticketconsumequery", middleware.Permission("api/v1/player/ticketconsumequery", api.TicketConsumeQuery))
|
group.POST("ticketconsumequery", middleware.Permission("api/v1/player/ticketconsumequery", api.TicketConsumeQuery))
|
||||||
group.POST("gamemallquery", middleware.Permission("api/v1/player/gamemallquery", api.GameMallQuery))
|
group.POST("gamemallquery", middleware.Permission("api/v1/player/gamemallquery", api.GameMallQuery))
|
||||||
|
group.POST("inapporderquery", middleware.Permission("api/v1/player/inapporderquery", api.InappOrderQuery))
|
||||||
group.POST("rechargequery", middleware.Permission("api/v1/player/rechargequery", api.RechargeQuery))
|
group.POST("rechargequery", middleware.Permission("api/v1/player/rechargequery", api.RechargeQuery))
|
||||||
group.POST("vipbindquery", middleware.Permission("api/v1/player/vipbindquery", api.VipBindQuery))
|
group.POST("vipbindquery", middleware.Permission("api/v1/player/vipbindquery", api.VipBindQuery))
|
||||||
group.POST("vipuserquery", middleware.Permission("api/v1/player/vipuserquery", api.VipUserQuery))
|
group.POST("vipuserquery", middleware.Permission("api/v1/player/vipuserquery", api.VipUserQuery))
|
||||||
|
@ -64,6 +64,11 @@ func (this *recharge) deliverGoods(ds *f5.DataSet) bool {
|
|||||||
userIdentity = passportAddress
|
userIdentity = passportAddress
|
||||||
accountId = service.GetAccountIdByAddress(passportAddress)
|
accountId = service.GetAccountIdByAddress(passportAddress)
|
||||||
}
|
}
|
||||||
|
if returnContribution > 0.0 {
|
||||||
|
if this.returnContribution(netId, shortOrderId, userIdentity, returnContribution, payTime) != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
if accountId == "" {
|
if accountId == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -73,11 +78,6 @@ func (this *recharge) deliverGoods(ds *f5.DataSet) bool {
|
|||||||
if this.markOk(idx, accountId) != nil {
|
if this.markOk(idx, accountId) != nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if returnContribution > 0.0 {
|
|
||||||
if this.returnContribution(netId, shortOrderId, userIdentity, returnContribution, payTime) != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
service.UserAddDiamond(accountId, diamond, netId, orderId)
|
service.UserAddDiamond(accountId, diamond, netId, orderId)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ var Friend = new (friend)
|
|||||||
|
|
||||||
func (this *friend) Force(accountId1 string, accountId2 string, nowTime int64,
|
func (this *friend) Force(accountId1 string, accountId2 string, nowTime int64,
|
||||||
cb func (error, int64, int64)) {
|
cb func (error, int64, int64)) {
|
||||||
f5.GetJsStyleDb().Upsert(
|
f5.GetJsStyleDb().UpsertEx(
|
||||||
constant.FRIEND_DB,
|
constant.FRIEND_DB,
|
||||||
"t_friend_relationship",
|
"t_friend_relationship",
|
||||||
[][]string{
|
[][]string{
|
||||||
@ -33,7 +33,14 @@ func (this *friend) Force(accountId1 string, accountId2 string, nowTime int64,
|
|||||||
{"createtime", q5.ToString(nowTime)},
|
{"createtime", q5.ToString(nowTime)},
|
||||||
{"modifytime", q5.ToString(nowTime)},
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
},
|
},
|
||||||
cb)
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
cb(err, lastInsertId, rowsAffected)
|
||||||
|
this.updateAddFriendTask(accountId1, nowTime)
|
||||||
|
this.updateAddFriendTask(accountId2, nowTime)
|
||||||
|
},
|
||||||
|
func (ds *f5.DataSet) bool {
|
||||||
|
return true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *friend) DeleteSoft(accountId1 string, accountId2 string,
|
func (this *friend) DeleteSoft(accountId1 string, accountId2 string,
|
||||||
@ -51,3 +58,26 @@ func (this *friend) DeleteSoft(accountId1 string, accountId2 string,
|
|||||||
},
|
},
|
||||||
cb)
|
cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *friend) updateAddFriendTask(accountId string, nowTime int64) {
|
||||||
|
f5.GetJsStyleDb().Upsert(
|
||||||
|
constant.GAME_DB,
|
||||||
|
"t_rookie_task_value",
|
||||||
|
[][]string{
|
||||||
|
{"account_id", accountId},
|
||||||
|
{"task_type", "16"},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"!value", "value + 1"},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"account_id", accountId},
|
||||||
|
{"task_type", "16"},
|
||||||
|
{"value", "1"},
|
||||||
|
{"createtime", q5.ToString(nowTime)},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
14
server/light_backtask/mt/StakingVip.go
Normal file
14
server/light_backtask/mt/StakingVip.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package mt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
"main/mtb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type StakingVip struct {
|
||||||
|
mtb.StakingVip
|
||||||
|
}
|
||||||
|
|
||||||
|
type StakingVipTable struct {
|
||||||
|
f5.IdMetaTable[StakingVip]
|
||||||
|
}
|
@ -19,6 +19,7 @@ type table struct {
|
|||||||
HashRateCommon *HashRateCommonTable
|
HashRateCommon *HashRateCommonTable
|
||||||
Contract *ContractTable
|
Contract *ContractTable
|
||||||
BcCurrency *BcCurrencyTable
|
BcCurrency *BcCurrencyTable
|
||||||
|
StakingVip *StakingVipTable
|
||||||
}
|
}
|
||||||
|
|
||||||
var Table = f5.New(func(this *table) {
|
var Table = f5.New(func(this *table) {
|
||||||
@ -86,4 +87,9 @@ var Table = f5.New(func(this *table) {
|
|||||||
this.PrimKey = "name"
|
this.PrimKey = "name"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.StakingVip = f5.New(func(this *StakingVipTable) {
|
||||||
|
this.FileName = "../res/stakingVip@stakingVip.json"
|
||||||
|
this.PrimKey = "rank"
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -84,6 +84,7 @@ type Config struct {
|
|||||||
immutable_base_url string
|
immutable_base_url string
|
||||||
chain_name string
|
chain_name string
|
||||||
immutable_api_key string
|
immutable_api_key string
|
||||||
|
scoreboard_height int32
|
||||||
|
|
||||||
_flags1_ uint64
|
_flags1_ uint64
|
||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
@ -137,6 +138,21 @@ type HashRateCommon struct {
|
|||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StakingVip struct {
|
||||||
|
rights string
|
||||||
|
require int64
|
||||||
|
thisPoint int64
|
||||||
|
rank int32
|
||||||
|
vip_name string
|
||||||
|
rate float64
|
||||||
|
vip_working_tips string
|
||||||
|
vip_unworking_tips string
|
||||||
|
id int32
|
||||||
|
|
||||||
|
_flags1_ uint64
|
||||||
|
_flags2_ uint64
|
||||||
|
}
|
||||||
|
|
||||||
func (this *BackTaskCluster) GetInstanceId() int32 {
|
func (this *BackTaskCluster) GetInstanceId() int32 {
|
||||||
return this.instance_id
|
return this.instance_id
|
||||||
}
|
}
|
||||||
@ -481,6 +497,14 @@ func (this *Config) HasImmutableApiKey() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Config) GetScoreboardHeight() int32 {
|
||||||
|
return this.scoreboard_height
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Config) HasScoreboardHeight() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Item) GetName() string {
|
func (this *Item) GetName() string {
|
||||||
return this.name
|
return this.name
|
||||||
}
|
}
|
||||||
@ -625,6 +649,78 @@ func (this *HashRateCommon) HasCecPool() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetRights() string {
|
||||||
|
return this.rights
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasRights() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetRequire() int64 {
|
||||||
|
return this.require
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasRequire() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetThisPoint() int64 {
|
||||||
|
return this.thisPoint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasThisPoint() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetRank() int32 {
|
||||||
|
return this.rank
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasRank() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetVipName() string {
|
||||||
|
return this.vip_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasVipName() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetRate() float64 {
|
||||||
|
return this.rate
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasRate() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetVipWorkingTips() string {
|
||||||
|
return this.vip_working_tips
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasVipWorkingTips() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetVipUnworkingTips() string {
|
||||||
|
return this.vip_unworking_tips
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasVipUnworkingTips() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 8)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) GetId() int32 {
|
||||||
|
return this.id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) HasId() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 9)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func (this *BackTaskCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *BackTaskCluster) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||||
@ -688,6 +784,7 @@ func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.immutable_base_url, "immutable_base_url", &this._flags1_, 3, kv)
|
f5.ReadMetaTableField(&this.immutable_base_url, "immutable_base_url", &this._flags1_, 3, kv)
|
||||||
f5.ReadMetaTableField(&this.chain_name, "chain_name", &this._flags1_, 4, kv)
|
f5.ReadMetaTableField(&this.chain_name, "chain_name", &this._flags1_, 4, kv)
|
||||||
f5.ReadMetaTableField(&this.immutable_api_key, "immutable_api_key", &this._flags1_, 6, kv)
|
f5.ReadMetaTableField(&this.immutable_api_key, "immutable_api_key", &this._flags1_, 6, kv)
|
||||||
|
f5.ReadMetaTableField(&this.scoreboard_height, "scoreboard_height", &this._flags1_, 7, kv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
||||||
@ -722,3 +819,15 @@ func (this *HashRateCommon) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.end_time, "end_time", &this._flags1_, 3, kv)
|
f5.ReadMetaTableField(&this.end_time, "end_time", &this._flags1_, 3, kv)
|
||||||
f5.ReadMetaTableField(&this.cec_pool, "cec_pool", &this._flags1_, 4, kv)
|
f5.ReadMetaTableField(&this.cec_pool, "cec_pool", &this._flags1_, 4, kv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *StakingVip) LoadFromKv(kv map[string]interface{}) {
|
||||||
|
f5.ReadMetaTableField(&this.rights, "rights", &this._flags1_, 1, kv)
|
||||||
|
f5.ReadMetaTableField(&this.require, "require", &this._flags1_, 2, kv)
|
||||||
|
f5.ReadMetaTableField(&this.thisPoint, "thisPoint", &this._flags1_, 3, kv)
|
||||||
|
f5.ReadMetaTableField(&this.rank, "rank", &this._flags1_, 4, kv)
|
||||||
|
f5.ReadMetaTableField(&this.vip_name, "vip_name", &this._flags1_, 5, kv)
|
||||||
|
f5.ReadMetaTableField(&this.rate, "rate", &this._flags1_, 6, kv)
|
||||||
|
f5.ReadMetaTableField(&this.vip_working_tips, "vip_working_tips", &this._flags1_, 7, kv)
|
||||||
|
f5.ReadMetaTableField(&this.vip_unworking_tips, "vip_unworking_tips", &this._flags1_, 8, kv)
|
||||||
|
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 9, kv)
|
||||||
|
}
|
||||||
|
@ -71,6 +71,7 @@ message Config
|
|||||||
optional string immutable_base_url = 3;
|
optional string immutable_base_url = 3;
|
||||||
optional string chain_name = 4;
|
optional string chain_name = 4;
|
||||||
optional string immutable_api_key = 6;
|
optional string immutable_api_key = 6;
|
||||||
|
optional int32 scoreboard_height = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Item
|
message Item
|
||||||
@ -110,3 +111,16 @@ message HashRateCommon
|
|||||||
optional string end_time = 3;
|
optional string end_time = 3;
|
||||||
optional int32 cec_pool = 4;
|
optional int32 cec_pool = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message StakingVip
|
||||||
|
{
|
||||||
|
optional string rights = 1;
|
||||||
|
optional int64 require = 2;
|
||||||
|
optional int64 thisPoint = 3;
|
||||||
|
optional int32 rank = 4;
|
||||||
|
optional string vip_name = 5;
|
||||||
|
optional double rate = 6;
|
||||||
|
optional string vip_working_tips = 7;
|
||||||
|
optional string vip_unworking_tips = 8;
|
||||||
|
optional int32 id = 9;
|
||||||
|
}
|
@ -1,12 +1,13 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"q5"
|
|
||||||
"f5"
|
"f5"
|
||||||
"sync"
|
|
||||||
"strings"
|
|
||||||
"main/constant"
|
"main/constant"
|
||||||
|
"main/mt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"q5"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
type vip struct {
|
type vip struct {
|
||||||
@ -31,6 +32,8 @@ func (this *vip) Add(accountAddress string, val string, idx int64, valField stri
|
|||||||
defer this.lock.Unlock()
|
defer this.lock.Unlock()
|
||||||
|
|
||||||
extKv := [][]string{}
|
extKv := [][]string{}
|
||||||
|
lvParams := map[string]string{}
|
||||||
|
|
||||||
accountAddress = strings.ToLower(accountAddress)
|
accountAddress = strings.ToLower(accountAddress)
|
||||||
err, ds := f5.GetGoStyleDb().NewOrmSelect(
|
err, ds := f5.GetGoStyleDb().NewOrmSelect(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
@ -67,6 +70,15 @@ func (this *vip) Add(accountAddress string, val string, idx int64, valField stri
|
|||||||
bnNewVal := bnOldVal.Add(bnOldVal, bnVal)
|
bnNewVal := bnOldVal.Add(bnOldVal, bnVal)
|
||||||
updateKv = append(updateKv, [][]string{{valField, bnNewVal.String()}}...)
|
updateKv = append(updateKv, [][]string{{valField, bnNewVal.String()}}...)
|
||||||
|
|
||||||
|
lvParams["escec_balance"] = ds.GetByName("escec_balance")
|
||||||
|
lvParams["escec_stacking"] = ds.GetByName("escec_stacking")
|
||||||
|
lvParams["escec_convert"] = ds.GetByName("escec_convert")
|
||||||
|
lvParams["last_convert_time"] = ds.GetByName("last_convert_time")
|
||||||
|
lvParams[valField] = bnNewVal.String()
|
||||||
|
|
||||||
|
newlv := this.calcVipLv(lvParams)
|
||||||
|
updateKv = append(updateKv, []string{"vip_lv", q5.SafeToString(newlv)})
|
||||||
|
|
||||||
err1, _, _ := f5.GetGoStyleDb().NewUpdate(
|
err1, _, _ := f5.GetGoStyleDb().NewUpdate(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
"t_vip_user",
|
"t_vip_user",
|
||||||
@ -78,6 +90,10 @@ func (this *vip) Add(accountAddress string, val string, idx int64, valField stri
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
lvParams[valField] = val
|
||||||
|
newlv := this.calcVipLv(lvParams)
|
||||||
|
insertKv = append(insertKv, []string{"vip_lv", q5.SafeToString(newlv)})
|
||||||
|
|
||||||
err1, _, _ := f5.GetGoStyleDb().NewInsert(
|
err1, _, _ := f5.GetGoStyleDb().NewInsert(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
"t_vip_user",
|
"t_vip_user",
|
||||||
@ -104,6 +120,17 @@ func (this *vip) Replace(accountAddress string, val string, idx int64, valField
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
lvParams := map[string]string{}
|
||||||
|
|
||||||
|
replaceFields:= func() {
|
||||||
|
lvParams[valField] = val
|
||||||
|
for _, sli := range extKv {
|
||||||
|
if len(sli) > 1 {
|
||||||
|
lvParams[sli[0]] = sli[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nowTime := f5.GetApp().GetRealSeconds()
|
nowTime := f5.GetApp().GetRealSeconds()
|
||||||
updateKv := [][]string {
|
updateKv := [][]string {
|
||||||
{valField, val},
|
{valField, val},
|
||||||
@ -123,6 +150,16 @@ func (this *vip) Replace(accountAddress string, val string, idx int64, valField
|
|||||||
if q5.ToInt64(ds.GetByName(idxField)) >= idx {
|
if q5.ToInt64(ds.GetByName(idxField)) >= idx {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lvParams["escec_balance"] = ds.GetByName("escec_balance")
|
||||||
|
lvParams["escec_stacking"] = ds.GetByName("escec_stacking")
|
||||||
|
lvParams["escec_convert"] = ds.GetByName("escec_convert")
|
||||||
|
lvParams["last_convert_time"] = ds.GetByName("last_convert_time")
|
||||||
|
replaceFields()
|
||||||
|
|
||||||
|
newlv := this.calcVipLv(lvParams)
|
||||||
|
updateKv = append(updateKv, []string{"vip_lv", q5.SafeToString(newlv)})
|
||||||
|
|
||||||
err1, _, _ := f5.GetGoStyleDb().NewUpdate(
|
err1, _, _ := f5.GetGoStyleDb().NewUpdate(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
"t_vip_user",
|
"t_vip_user",
|
||||||
@ -134,6 +171,10 @@ func (this *vip) Replace(accountAddress string, val string, idx int64, valField
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
replaceFields()
|
||||||
|
newlv := this.calcVipLv(lvParams)
|
||||||
|
insertKv = append(insertKv, []string{"vip_lv", q5.SafeToString(newlv)})
|
||||||
|
|
||||||
err1, _, _ := f5.GetGoStyleDb().NewInsert(
|
err1, _, _ := f5.GetGoStyleDb().NewInsert(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
"t_vip_user",
|
"t_vip_user",
|
||||||
@ -151,7 +192,7 @@ Withdraw 所有
|
|||||||
|
|
||||||
按时间排序处理事件的先后顺序
|
按时间排序处理事件的先后顺序
|
||||||
|
|
||||||
通过Vester.sol的remainingEsToken方法获取, 如果要本地计算的话, 那就取每次Deposit事件的时间和amount, 加上先前的转换的余额, 再按total * (now - deposit_time) / (365 * 24 * 2600)
|
通过Vester.sol的remainingEsToken方法获取, 如果要本地计算的话, 那就取每次Deposit事件的时间和amount, 加上先前的转换的余额, 再按total * (now - deposit_time) / (365 * 24 * 3600)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
||||||
@ -202,7 +243,7 @@ func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
|||||||
if lastDeposit != nil {
|
if lastDeposit != nil {
|
||||||
if nowTime > lastDeposit.chainTimestamp {
|
if nowTime > lastDeposit.chainTimestamp {
|
||||||
bnPassTime := new(big.Int).SetInt64(int64(nowTime - lastDeposit.chainTimestamp))
|
bnPassTime := new(big.Int).SetInt64(int64(nowTime - lastDeposit.chainTimestamp))
|
||||||
bnTotalTime := new(big.Int).SetInt64(int64(365 * 24 * 2600))
|
bnTotalTime := new(big.Int).SetInt64(int64(365 * 24 * 3600))
|
||||||
bnTmp := bnTotal.Mul(bnTotal, bnPassTime)
|
bnTmp := bnTotal.Mul(bnTotal, bnPassTime)
|
||||||
bnInterest := bnTmp.Div(bnTmp, bnTotalTime)
|
bnInterest := bnTmp.Div(bnTmp, bnTotalTime)
|
||||||
bnTotal = bnTotal.Sub(bnTotal, bnInterest)
|
bnTotal = bnTotal.Sub(bnTotal, bnInterest)
|
||||||
@ -234,3 +275,66 @@ func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *vip) calcVipLv(params map[string]string) (lv int64) {
|
||||||
|
balancestr := params["escec_balance"]
|
||||||
|
if balancestr == "" {
|
||||||
|
balancestr = "0"
|
||||||
|
}
|
||||||
|
escec_balance, ok := new(big.Int).SetString(balancestr, 10)
|
||||||
|
if !ok {
|
||||||
|
escec_balance = new(big.Int).SetInt64(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
stackingstr := params["escec_stacking"]
|
||||||
|
if stackingstr == "" {
|
||||||
|
stackingstr = "0"
|
||||||
|
}
|
||||||
|
escec_stacking, ok := new(big.Int).SetString(stackingstr, 10)
|
||||||
|
if !ok {
|
||||||
|
escec_stacking = new(big.Int).SetInt64(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
curExec := new(big.Int).Add(escec_balance, escec_stacking)
|
||||||
|
|
||||||
|
convertstr := params["escec_convert"]
|
||||||
|
if convertstr == "" {
|
||||||
|
convertstr = "0"
|
||||||
|
}
|
||||||
|
escec_convert, ok := new(big.Int).SetString(convertstr, 10)
|
||||||
|
if !ok {
|
||||||
|
escec_convert = new(big.Int).SetInt64(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
last_convert_time := q5.SafeToInt64(params["last_convert_time"])
|
||||||
|
nowsecs := f5.GetApp().GetRealSeconds()
|
||||||
|
diff := nowsecs - last_convert_time
|
||||||
|
if diff < 0 {
|
||||||
|
diff = 0
|
||||||
|
}
|
||||||
|
elapse := new(big.Int).SetInt64(diff)
|
||||||
|
depositExec := new(big.Int).Mul(escec_convert, elapse)
|
||||||
|
depositExec = depositExec.Div(depositExec, new(big.Int).SetInt64(365*24*3600))
|
||||||
|
if depositExec.Cmp(escec_convert) < 0 {
|
||||||
|
depositExec = new(big.Int).Sub(escec_convert, depositExec)
|
||||||
|
} else {
|
||||||
|
depositExec.SetInt64(0)
|
||||||
|
}
|
||||||
|
curExec = curExec.Add(curExec, depositExec)
|
||||||
|
convercurExec := new(big.Int).Div(curExec, new(big.Int).SetInt64(1000*1000*1000*1000*1000*1000)).Int64()
|
||||||
|
lv = 0
|
||||||
|
for {
|
||||||
|
cfg := mt.Table.StakingVip.GetById(lv)
|
||||||
|
nextlvcfg := mt.Table.StakingVip.GetById(lv + 1)
|
||||||
|
if cfg != nil && nextlvcfg != nil {
|
||||||
|
if cfg.GetRequire() <= convercurExec && nextlvcfg.GetRequire() > convercurExec {
|
||||||
|
return lv
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
lv++
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
99
server/light_backtask/task/rankchart.go
Normal file
99
server/light_backtask/task/rankchart.go
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"f5"
|
||||||
|
"main/constant"
|
||||||
|
"main/mt"
|
||||||
|
"q5"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type rankchart struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type rankitem struct {
|
||||||
|
Idx int64 `json:"idx"`
|
||||||
|
Account string `json:"account_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Head int32 `json:"head_id"`
|
||||||
|
HeadFrame int32 `json:"head_frame"`
|
||||||
|
Score int32 `json:"score"`
|
||||||
|
Rank int32 `json:"rank"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rankchart) init() {
|
||||||
|
// go r.processLoop()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rankchart) unInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rankchart) processLoop() {
|
||||||
|
for {
|
||||||
|
height := mt.Table.Config.GetById(0).GetScoreboardHeight()
|
||||||
|
r.processScoreRank(height)
|
||||||
|
time.Sleep(time.Minute)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rankchart) processScoreRank(height int32) {
|
||||||
|
sql := `SELECT idx, account_id, name, head_id, head_frame, score, score_modifytime FROM t_user WHERE idx > 0`
|
||||||
|
order := " ORDER BY score DESC, score_modifytime ASC, idx ASC "
|
||||||
|
const perpage = int32(512)
|
||||||
|
pageno := int32(1)
|
||||||
|
item := new(rankitem)
|
||||||
|
|
||||||
|
for {
|
||||||
|
datalist := []string{}
|
||||||
|
var queryerr error
|
||||||
|
lastpage := false
|
||||||
|
f5.GetGoStyleDb().PageQuery(
|
||||||
|
constant.GAME_DB,
|
||||||
|
perpage,
|
||||||
|
pageno,
|
||||||
|
sql,
|
||||||
|
[]string{},
|
||||||
|
f5.GetDbFilter().Comp([]f5.DbQueryFilter{}...),
|
||||||
|
order,
|
||||||
|
func(err error, p *f5.Pagination) {
|
||||||
|
if err != nil {
|
||||||
|
queryerr = err
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.CurrentPage == p.TotalPages {
|
||||||
|
lastpage = true
|
||||||
|
}
|
||||||
|
|
||||||
|
for p.Rows.Next() {
|
||||||
|
item.Rank = int32(p.Rows.NumOfReaded()) + (pageno-1)*(perpage)
|
||||||
|
if height > 0 && item.Rank > height {
|
||||||
|
lastpage = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
item.Idx = q5.SafeToInt64(p.Rows.GetByName("idx"))
|
||||||
|
item.Account = p.Rows.GetByName("account_id")
|
||||||
|
item.Name = p.Rows.GetByName("name")
|
||||||
|
item.Head = q5.SafeToInt32(p.Rows.GetByName("head_id"))
|
||||||
|
item.HeadFrame = q5.SafeToInt32(p.Rows.GetByName("head_frame"))
|
||||||
|
item.Score = q5.SafeToInt32(p.Rows.GetByName("score"))
|
||||||
|
rankdata, _ := json.Marshal(item)
|
||||||
|
datalist = append(datalist, string(rankdata))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if len(datalist) > 0 {
|
||||||
|
// push to redis
|
||||||
|
// fmt.Println(datalist)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if queryerr != nil || lastpage {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
pageno++
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,5 @@
|
|||||||
package task
|
package task
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
type taskMgr struct {
|
type taskMgr struct {
|
||||||
webHook
|
webHook
|
||||||
repairNft
|
repairNft
|
||||||
@ -16,6 +13,7 @@ type taskMgr struct {
|
|||||||
esCecTransfer
|
esCecTransfer
|
||||||
stackingCec
|
stackingCec
|
||||||
vester
|
vester
|
||||||
|
rankchart
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *taskMgr) Init() {
|
func (this *taskMgr) Init() {
|
||||||
@ -31,6 +29,7 @@ func (this *taskMgr) Init() {
|
|||||||
this.esCecTransfer.init()
|
this.esCecTransfer.init()
|
||||||
this.stackingCec.init()
|
this.stackingCec.init()
|
||||||
this.vester.init()
|
this.vester.init()
|
||||||
|
this.rankchart.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *taskMgr) UnInit() {
|
func (this *taskMgr) UnInit() {
|
||||||
@ -46,4 +45,5 @@ func (this *taskMgr) UnInit() {
|
|||||||
this.sysMail.unInit()
|
this.sysMail.unInit()
|
||||||
this.repairNft.unInit()
|
this.repairNft.unInit()
|
||||||
this.webHook.unInit()
|
this.webHook.unInit()
|
||||||
|
this.rankchart.unInit()
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,8 @@ func (this *player) MarkMails(mails []common.Mail) error {
|
|||||||
mi.expireTime = m.GetExpireTime()
|
mi.expireTime = m.GetExpireTime()
|
||||||
this.inboxHash[mi.mailId] = mi
|
this.inboxHash[mi.mailId] = mi
|
||||||
} else if mi.state != constant.INBOX_STATE_NONE {
|
} else if mi.state != constant.INBOX_STATE_NONE {
|
||||||
|
if mi.state != constant.INBOX_STATE_DELETED &&
|
||||||
|
mi.state != constant.INBOX_STATE_RECEIVED {
|
||||||
err := model.Inbox.Mark(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
err := model.Inbox.Mark(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resultErr = err
|
resultErr = err
|
||||||
@ -87,6 +89,7 @@ func (this *player) MarkMails(mails []common.Mail) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return resultErr
|
return resultErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ func (ac *accountContribution) sum() float64 {
|
|||||||
|
|
||||||
type contribution struct {
|
type contribution struct {
|
||||||
historyContribution float64
|
historyContribution float64
|
||||||
|
stakingContribution float64
|
||||||
rechargeContribution float64
|
rechargeContribution float64
|
||||||
gameContribution float64
|
gameContribution float64
|
||||||
gcTime int64
|
gcTime int64
|
||||||
@ -44,7 +45,7 @@ func (this *contribution) unInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *contribution) sum() float64 {
|
func (c *contribution) sum() float64 {
|
||||||
return c.historyContribution + c.rechargeContribution + c.gameContribution
|
return c.historyContribution + c.stakingContribution + c.rechargeContribution + c.gameContribution
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) {
|
func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) {
|
||||||
@ -252,8 +253,10 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
|
|||||||
this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
sql = `SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE idx > 0`
|
if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant {
|
||||||
|
sql := `SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE idx > 0`
|
||||||
f5.GetGoStyleDb().RawQuery(
|
f5.GetGoStyleDb().RawQuery(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
sql,
|
sql,
|
||||||
@ -264,14 +267,11 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ds.Next() {
|
if ds.Next() {
|
||||||
tmp, _ := q5.ToFloat64Ex(ds.GetByIndex(0))
|
this.stakingContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
||||||
this.historyContribution += tmp
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant {
|
sql = `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
|
||||||
sql := `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
|
|
||||||
f5.GetGoStyleDb().RawQuery(
|
f5.GetGoStyleDb().RawQuery(
|
||||||
constant.GAME_DB,
|
constant.GAME_DB,
|
||||||
sql,
|
sql,
|
||||||
|
@ -10,23 +10,31 @@ import (
|
|||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoginRsp struct {
|
type BattleItem struct {
|
||||||
Errcode int `json:"errcode"`
|
ItemId int32 `json:"item_id"`
|
||||||
Errmsg string `json:"errmsg"`
|
ItemNum int32 `json:"item_num"`
|
||||||
Info struct {
|
ItemType int32 `json:"item_type"`
|
||||||
UserInfo struct {
|
ItemSubType int32 `json:"item_sub_type"`
|
||||||
Activated string `json:"activated"`
|
}
|
||||||
RenameCount string `json:"rename_count"`
|
|
||||||
|
type UserInfo struct {
|
||||||
|
//Activated string `json:"activated"`
|
||||||
|
//RenameCount string `json:"rename_count"`
|
||||||
AccountId string `json:"account_id"`
|
AccountId string `json:"account_id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
HeadId string `json:"head_id"`
|
HeadId string `json:"head_id"`
|
||||||
HeroId string `json:"hero_id"`
|
//HeroId string `json:"hero_id"`
|
||||||
HeadFrame string `json:"head_frame"`
|
HeadFrame string `json:"head_frame"`
|
||||||
TotalLucky interface{} `json:"total_lucky"`
|
TotalLucky interface{} `json:"total_lucky"`
|
||||||
AdmissionItemNum interface{} `json:"admission_item_num"`
|
AdmissionItemNum interface{} `json:"admission_item_num"`
|
||||||
CircuitScore interface{} `json:"circuit_score"`
|
CircuitScore interface{} `json:"circuit_score"`
|
||||||
} `json:"user_info"`
|
VipLv interface{} `json:"vip_lv"`
|
||||||
HeroInfo struct {
|
VipExp interface{} `json:"vip_exp"`
|
||||||
|
HasVipLucky interface{} `json:"has_vip_lucky"`
|
||||||
|
HasLuckySymbol interface{} `json:"has_lucky_symbol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HeroInfo struct {
|
||||||
HeroUniId string `json:"hero_uniid"`
|
HeroUniId string `json:"hero_uniid"`
|
||||||
HeroId string `json:"hero_id"`
|
HeroId string `json:"hero_id"`
|
||||||
Quality string `json:"quality"`
|
Quality string `json:"quality"`
|
||||||
@ -36,7 +44,14 @@ type LoginRsp struct {
|
|||||||
CurrentTimes interface{} `json:"current_times"`
|
CurrentTimes interface{} `json:"current_times"`
|
||||||
TotalTimes interface{} `json:"total_times"`
|
TotalTimes interface{} `json:"total_times"`
|
||||||
SkinId interface{} `json:"skin_id"`
|
SkinId interface{} `json:"skin_id"`
|
||||||
} `json:"hero_info"`
|
}
|
||||||
|
|
||||||
|
type LoginRsp struct {
|
||||||
|
Errcode int `json:"errcode"`
|
||||||
|
Errmsg string `json:"errmsg"`
|
||||||
|
Info struct {
|
||||||
|
UserInfo UserInfo `json:"user_info"`
|
||||||
|
HeroInfo HeroInfo `json:"hero_info"`
|
||||||
MapInfo *MapInfoRsp `json:"map_info"`
|
MapInfo *MapInfoRsp `json:"map_info"`
|
||||||
} `json:"info"`
|
} `json:"info"`
|
||||||
}
|
}
|
||||||
@ -45,29 +60,8 @@ type UserRsp struct {
|
|||||||
Errcode int `json:"errcode"`
|
Errcode int `json:"errcode"`
|
||||||
Errmsg string `json:"errmsg"`
|
Errmsg string `json:"errmsg"`
|
||||||
Info struct {
|
Info struct {
|
||||||
UserInfo struct {
|
UserInfo UserInfo `json:"user_info"`
|
||||||
Activated string `json:"activated"`
|
HeroInfo HeroInfo `json:"hero_info"`
|
||||||
RenameCount string `json:"rename_count"`
|
|
||||||
AccountId string `json:"account_id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
HeadId string `json:"head_id"`
|
|
||||||
HeroId string `json:"hero_id"`
|
|
||||||
HeadFrame string `json:"head_frame"`
|
|
||||||
TotalLucky interface{} `json:"total_lucky"`
|
|
||||||
AdmissionItemNum interface{} `json:"admission_item_num"`
|
|
||||||
CircuitScore interface{} `json:"circuit_score"`
|
|
||||||
} `json:"user_info"`
|
|
||||||
HeroInfo struct {
|
|
||||||
HeroUniId string `json:"hero_uniid"`
|
|
||||||
HeroId string `json:"hero_id"`
|
|
||||||
Quality string `json:"quality"`
|
|
||||||
SpecSkill string `json:"spec_skill"`
|
|
||||||
Wealth interface{} `json:"wealth"`
|
|
||||||
ValidLefttime interface{} `json:"valid_lefttime"`
|
|
||||||
CurrentTimes interface{} `json:"current_times"`
|
|
||||||
TotalTimes interface{} `json:"total_times"`
|
|
||||||
SkinId interface{} `json:"skin_id"`
|
|
||||||
} `json:"hero_info"`
|
|
||||||
} `json:"info"`
|
} `json:"info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,30 +87,8 @@ type UpdateBattleInfoRsp struct {
|
|||||||
Errcode int `json:"errcode"`
|
Errcode int `json:"errcode"`
|
||||||
Errmsg string `json:"errmsg"`
|
Errmsg string `json:"errmsg"`
|
||||||
Info struct {
|
Info struct {
|
||||||
UserInfo struct {
|
UserInfo UserInfo `json:"user_info"`
|
||||||
Activated string `json:"activated"`
|
HeroInfo HeroInfo `json:"hero_info"`
|
||||||
RenameCount string `json:"rename_count"`
|
|
||||||
AccountId string `json:"account_id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
HeadId string `json:"head_id"`
|
|
||||||
HeroId string `json:"hero_id"`
|
|
||||||
HeadFrame string `json:"head_frame"`
|
|
||||||
SpecSkill string `json:"spec_skill"`
|
|
||||||
TotalLucky interface{} `json:"total_lucky"`
|
|
||||||
AdmissionItemNum interface{} `json:"admission_item_num"`
|
|
||||||
CircuitScore interface{} `json:"circuit_score"`
|
|
||||||
} `json:"user_info"`
|
|
||||||
HeroInfo struct {
|
|
||||||
HeroUniId string `json:"hero_uniid"`
|
|
||||||
HeroId string `json:"hero_id"`
|
|
||||||
Quality string `json:"quality"`
|
|
||||||
SpecSkill string `json:"spec_skill"`
|
|
||||||
Wealth interface{} `json:"wealth"`
|
|
||||||
ValidLefttime interface{} `json:"valid_lefttime"`
|
|
||||||
CurrentTimes interface{} `json:"current_times"`
|
|
||||||
TotalTimes interface{} `json:"total_times"`
|
|
||||||
SkinId interface{} `json:"skin_id"`
|
|
||||||
} `json:"hero_info"`
|
|
||||||
} `json:"info"`
|
} `json:"info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +150,7 @@ type Player interface {
|
|||||||
IsBattling() bool
|
IsBattling() bool
|
||||||
SetBattling(bool)
|
SetBattling(bool)
|
||||||
GenNextCopy() Player
|
GenNextCopy() Player
|
||||||
|
GetBattleItems() []*BattleItem
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -41,3 +41,13 @@ const (
|
|||||||
HISTORY_MGR_MODULE_IDX
|
HISTORY_MGR_MODULE_IDX
|
||||||
MAX_MODULE_IDX
|
MAX_MODULE_IDX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
LUCKY_SYMBOL_ITEM_ID = 900007
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
FUNC_TYPE_ITEM_TYPE = 9
|
||||||
|
|
||||||
|
LUCKY_SYMBOL_ITEM_SUB_TYPE = 8
|
||||||
|
)
|
||||||
|
@ -49,6 +49,7 @@ type MsgHandler interface {
|
|||||||
CMChooseHero(*f5.MsgHdr, *CMChooseHero)
|
CMChooseHero(*f5.MsgHdr, *CMChooseHero)
|
||||||
CMChooseMap(*f5.MsgHdr, *CMChooseMap)
|
CMChooseMap(*f5.MsgHdr, *CMChooseMap)
|
||||||
CMRefreshUser(*f5.MsgHdr, *CMRefreshUser)
|
CMRefreshUser(*f5.MsgHdr, *CMRefreshUser)
|
||||||
|
CMChooseBattleItem(*f5.MsgHdr, *CMChooseBattleItem)
|
||||||
CMGrantInvitePermission(*f5.MsgHdr, *CMGrantInvitePermission)
|
CMGrantInvitePermission(*f5.MsgHdr, *CMGrantInvitePermission)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +95,9 @@ func (this *MsgHandlerImpl) CMChooseMap(hdr *f5.MsgHdr, msg *CMChooseMap) {
|
|||||||
func (this *MsgHandlerImpl) CMRefreshUser(hdr *f5.MsgHdr, msg *CMRefreshUser) {
|
func (this *MsgHandlerImpl) CMRefreshUser(hdr *f5.MsgHdr, msg *CMRefreshUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MsgHandlerImpl) CMChooseBattleItem(hdr *f5.MsgHdr, msg *CMChooseBattleItem) {
|
||||||
|
}
|
||||||
|
|
||||||
func (this *MsgHandlerImpl) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *CMGrantInvitePermission) {
|
func (this *MsgHandlerImpl) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *CMGrantInvitePermission) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,6 +217,14 @@ func (this *SMRefreshUser) GetNetMsgId() uint16 {
|
|||||||
return uint16(SMMessageIdE__SMRefreshUser)
|
return uint16(SMMessageIdE__SMRefreshUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CMChooseBattleItem) GetNetMsgId() uint16 {
|
||||||
|
return uint16(CMMessageIdE__CMChooseBattleItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SMChooseBattleItem) GetNetMsgId() uint16 {
|
||||||
|
return uint16(SMMessageIdE__SMChooseBattleItem)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *CMGrantInvitePermission) GetNetMsgId() uint16 {
|
func (this *CMGrantInvitePermission) GetNetMsgId() uint16 {
|
||||||
return uint16(CMMessageIdE__CMGrantInvitePermission)
|
return uint16(CMMessageIdE__CMGrantInvitePermission)
|
||||||
}
|
}
|
||||||
@ -313,6 +325,12 @@ func (this *SMChooseMap) Err(errCode int32, errMsg string) *SMChooseMap {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *SMChooseBattleItem) Err(errCode int32, errMsg string) *SMChooseBattleItem {
|
||||||
|
this.Errcode = proto.Int32(errCode)
|
||||||
|
this.Errmsg = proto.String(errMsg)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
func (this *SMGrantInvitePermission) Err(errCode int32, errMsg string) *SMGrantInvitePermission {
|
func (this *SMGrantInvitePermission) Err(errCode int32, errMsg string) *SMGrantInvitePermission {
|
||||||
this.Errcode = proto.Int32(errCode)
|
this.Errcode = proto.Int32(errCode)
|
||||||
this.Errmsg = proto.String(errMsg)
|
this.Errmsg = proto.String(errMsg)
|
||||||
@ -489,6 +507,18 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlers[int(CMMessageIdE__CMChooseBattleItem)] = &CsNetMsgHandler{
|
||||||
|
MsgId: int(CMMessageIdE__CMChooseBattleItem),
|
||||||
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
msg := &CMChooseBattleItem{}
|
||||||
|
proto.Unmarshal(data, msg)
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||||
|
handler.CMChooseBattleItem(hdr, hdr.Msg.(*CMChooseBattleItem))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
handlers[int(CMMessageIdE__CMGrantInvitePermission)] = &CsNetMsgHandler{
|
handlers[int(CMMessageIdE__CMGrantInvitePermission)] = &CsNetMsgHandler{
|
||||||
MsgId: int(CMMessageIdE__CMGrantInvitePermission),
|
MsgId: int(CMMessageIdE__CMGrantInvitePermission),
|
||||||
ParseCb: func (data []byte) interface{} {
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
@ -56,7 +56,7 @@ func (this *historyMgr) PushLastBattleInfo(hum common.Player) {
|
|||||||
|
|
||||||
func (this *historyMgr) CanStart(accountId string, mapId int32, modeId int32) bool {
|
func (this *historyMgr) CanStart(accountId string, mapId int32, modeId int32) bool {
|
||||||
u := this.getUser(accountId)
|
u := this.getUser(accountId)
|
||||||
if u == nil && modeId == jccommon.MAP_MODE_CIRCUIT {
|
if u != nil && modeId == jccommon.MAP_MODE_CIRCUIT {
|
||||||
key := q5.MkInt64(mapId, modeId)
|
key := q5.MkInt64(mapId, modeId)
|
||||||
if startTime, ok := u.mapAndModeHash[key]; ok {
|
if startTime, ok := u.mapAndModeHash[key]; ok {
|
||||||
nowTime := q5.ToInt32(f5.GetApp().GetRealSeconds())
|
nowTime := q5.ToInt32(f5.GetApp().GetRealSeconds())
|
||||||
|
@ -30,6 +30,7 @@ func (this *HandlerMgr) Init() {
|
|||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMChooseMap), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMChooseMap), constant.PLAYER_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMGrantInvitePermission), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMGrantInvitePermission), constant.PLAYER_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRefreshUser), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMRefreshUser), constant.PLAYER_HANDLER_ID)
|
||||||
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMChooseBattleItem), constant.PLAYER_HANDLER_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HandlerMgr) UnInit() {
|
func (this *HandlerMgr) UnInit() {
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"main/common"
|
"main/common"
|
||||||
|
"main/constant"
|
||||||
. "main/global"
|
. "main/global"
|
||||||
"fmt"
|
"fmt"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -44,6 +45,11 @@ type player struct {
|
|||||||
team common.Team
|
team common.Team
|
||||||
battling bool
|
battling bool
|
||||||
sortIdx int32
|
sortIdx int32
|
||||||
|
vipLv int32
|
||||||
|
vipExp int64
|
||||||
|
hasVipLucky int32
|
||||||
|
hasLuckySymbol int32
|
||||||
|
battleItems []*common.BattleItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) SendMsg(rspMsg proto.Message) {
|
func (this *player) SendMsg(rspMsg proto.Message) {
|
||||||
@ -52,29 +58,39 @@ func (this *player) SendMsg(rspMsg proto.Message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) parseUserInfo(userInfo *common.UserInfo){
|
||||||
|
this.name = userInfo.Name
|
||||||
|
this.avatarUrl = userInfo.HeadId
|
||||||
|
this.headFrame = userInfo.HeadFrame
|
||||||
|
q5.DuckToSimple(userInfo.TotalLucky, &this.totalLucky)
|
||||||
|
q5.DuckToSimple(userInfo.AdmissionItemNum, &this.admissionItemNum)
|
||||||
|
q5.DuckToSimple(userInfo.CircuitScore, &this.circuitScore)
|
||||||
|
q5.DuckToSimple(userInfo.VipLv, &this.vipLv)
|
||||||
|
q5.DuckToSimple(userInfo.VipExp, &this.vipExp)
|
||||||
|
q5.DuckToSimple(userInfo.HasVipLucky, &this.hasVipLucky)
|
||||||
|
q5.DuckToSimple(userInfo.HasLuckySymbol, &this.hasLuckySymbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *player) parseHeroInfo(heroInfo *common.HeroInfo){
|
||||||
|
this.hero.heroUniId = heroInfo.HeroUniId
|
||||||
|
this.hero.heroId = q5.ToInt32(heroInfo.HeroId)
|
||||||
|
this.hero.quality = q5.ToInt32(heroInfo.Quality)
|
||||||
|
this.hero.specSkill = q5.ToInt32(heroInfo.SpecSkill)
|
||||||
|
q5.DuckToSimple(heroInfo.Wealth, &this.hero.wealth)
|
||||||
|
q5.DuckToSimple(heroInfo.ValidLefttime, &this.hero.validLeftTime)
|
||||||
|
q5.DuckToSimple(heroInfo.CurrentTimes, &this.hero.currentTimes)
|
||||||
|
q5.DuckToSimple(heroInfo.TotalTimes, &this.hero.totalTimes)
|
||||||
|
q5.DuckToSimple(heroInfo.SkinId, &this.hero.skinId)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) init(req *pendingLoginRequest, rsp *common.LoginRsp){
|
func (this *player) init(req *pendingLoginRequest, rsp *common.LoginRsp){
|
||||||
this.socket = req.hdr.GetSocket()
|
this.socket = req.hdr.GetSocket()
|
||||||
this.accountId = req.msg.GetAccountId()
|
this.accountId = req.msg.GetAccountId()
|
||||||
this.sessionId = req.msg.GetSessionId()
|
this.sessionId = req.msg.GetSessionId()
|
||||||
this.zoneId = req.msg.GetZoneId()
|
this.zoneId = req.msg.GetZoneId()
|
||||||
this.nodeId = req.msg.GetNodeId()
|
this.nodeId = req.msg.GetNodeId()
|
||||||
this.name = rsp.Info.UserInfo.Name
|
this.parseUserInfo(&rsp.Info.UserInfo)
|
||||||
this.avatarUrl = rsp.Info.UserInfo.HeadId
|
this.parseHeroInfo(&rsp.Info.HeroInfo)
|
||||||
this.headFrame = rsp.Info.UserInfo.HeadFrame
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.CircuitScore, &this.circuitScore)
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.TotalLucky, &this.totalLucky)
|
|
||||||
{
|
|
||||||
this.hero.heroUniId = rsp.Info.HeroInfo.HeroUniId
|
|
||||||
this.hero.heroId = q5.ToInt32(rsp.Info.HeroInfo.HeroId)
|
|
||||||
this.hero.quality = q5.ToInt32(rsp.Info.HeroInfo.Quality)
|
|
||||||
this.hero.specSkill = q5.ToInt32(rsp.Info.HeroInfo.SpecSkill)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.Wealth, &this.hero.wealth)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
|
func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
|
||||||
@ -83,23 +99,8 @@ func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
|
|||||||
this.sessionId = req.msg.GetSessionId()
|
this.sessionId = req.msg.GetSessionId()
|
||||||
this.zoneId = req.msg.GetZoneId()
|
this.zoneId = req.msg.GetZoneId()
|
||||||
this.nodeId = req.msg.GetNodeId()
|
this.nodeId = req.msg.GetNodeId()
|
||||||
this.name = rsp.Info.UserInfo.Name
|
this.parseUserInfo(&rsp.Info.UserInfo)
|
||||||
this.avatarUrl = rsp.Info.UserInfo.HeadId
|
this.parseHeroInfo(&rsp.Info.HeroInfo)
|
||||||
this.headFrame = rsp.Info.UserInfo.HeadFrame
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.CircuitScore, &this.circuitScore)
|
|
||||||
q5.DuckToSimple(rsp.Info.UserInfo.TotalLucky, &this.totalLucky)
|
|
||||||
{
|
|
||||||
this.hero.heroUniId = rsp.Info.HeroInfo.HeroUniId
|
|
||||||
this.hero.heroId = q5.ToInt32(rsp.Info.HeroInfo.HeroId)
|
|
||||||
this.hero.quality = q5.ToInt32(rsp.Info.HeroInfo.Quality)
|
|
||||||
this.hero.specSkill = q5.ToInt32(rsp.Info.HeroInfo.SpecSkill)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.Wealth, &this.hero.wealth)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
|
|
||||||
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) GetSocket() f5.WspCliConn {
|
func (this *player) GetSocket() f5.WspCliConn {
|
||||||
@ -207,6 +208,19 @@ func (this *player) GenNextCopy() common.Player {
|
|||||||
return nextCopy
|
return nextCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) GetBattleItems() []*common.BattleItem {
|
||||||
|
var result = this.battleItems[0:]
|
||||||
|
if this.isLuckySymbolMap() {
|
||||||
|
p := new(common.BattleItem)
|
||||||
|
p.ItemId = constant.LUCKY_SYMBOL_ITEM_ID
|
||||||
|
p.ItemNum = 1
|
||||||
|
p.ItemType = constant.FUNC_TYPE_ITEM_TYPE
|
||||||
|
p.ItemSubType = constant.LUCKY_SYMBOL_ITEM_SUB_TYPE
|
||||||
|
q5.AppendSlice(&result, p)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
||||||
member_pb.AccountId = proto.String(this.accountId)
|
member_pb.AccountId = proto.String(this.accountId)
|
||||||
member_pb.Name = proto.String(this.name)
|
member_pb.Name = proto.String(this.name)
|
||||||
@ -238,6 +252,22 @@ func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
|||||||
member_pb.ValidLefttime = proto.Int32(this.hero.validLeftTime)
|
member_pb.ValidLefttime = proto.Int32(this.hero.validLeftTime)
|
||||||
member_pb.AdmissionItemNum = proto.Int32(this.admissionItemNum)
|
member_pb.AdmissionItemNum = proto.Int32(this.admissionItemNum)
|
||||||
member_pb.CircuitScore = proto.Int32(this.circuitScore)
|
member_pb.CircuitScore = proto.Int32(this.circuitScore)
|
||||||
|
member_pb.VipLv = proto.Int32(this.vipLv)
|
||||||
|
member_pb.VipExp = proto.Int64(this.vipExp)
|
||||||
|
member_pb.HasVipLucky = proto.Int32(this.hasVipLucky)
|
||||||
|
q5.NewSlice(&member_pb.BattleItems, 0, 0)
|
||||||
|
for _, p := range(this.battleItems) {
|
||||||
|
item_pb := new(cs.MFBattleItem)
|
||||||
|
item_pb.ItemId = proto.Int32(p.ItemId)
|
||||||
|
item_pb.ItemNum = proto.Int32(p.ItemNum)
|
||||||
|
q5.AppendSlice(&member_pb.BattleItems, item_pb)
|
||||||
|
}
|
||||||
|
if this.hasLuckySymbol != 0 && this.isLuckySymbolMap() {
|
||||||
|
item_pb := new(cs.MFBattleItem)
|
||||||
|
item_pb.ItemId = proto.Int32(constant.LUCKY_SYMBOL_ITEM_ID)
|
||||||
|
item_pb.ItemNum = proto.Int32(1)
|
||||||
|
q5.AppendSlice(&member_pb.BattleItems, item_pb)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) CMLeaveTeam(hdr *f5.MsgHdr, msg *cs.CMLeaveTeam) {
|
func (this *player) CMLeaveTeam(hdr *f5.MsgHdr, msg *cs.CMLeaveTeam) {
|
||||||
@ -432,23 +462,8 @@ func (this *player) CMRefreshUser(hdr *f5.MsgHdr, msg *cs.CMRefreshUser) {
|
|||||||
func(rsp f5.HttpCliResponse) {
|
func(rsp f5.HttpCliResponse) {
|
||||||
this.SendMsg(rspMsg)
|
this.SendMsg(rspMsg)
|
||||||
if rsp.GetErr() == nil && rsp.JsonParseOk() {
|
if rsp.GetErr() == nil && rsp.JsonParseOk() {
|
||||||
this.name = rspObj.Info.UserInfo.Name
|
this.parseUserInfo(&rspObj.Info.UserInfo)
|
||||||
this.avatarUrl = rspObj.Info.UserInfo.HeadId
|
this.parseHeroInfo(&rspObj.Info.HeroInfo)
|
||||||
this.headFrame = rspObj.Info.UserInfo.HeadFrame
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.CircuitScore, &this.circuitScore)
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.TotalLucky, &this.totalLucky)
|
|
||||||
{
|
|
||||||
this.hero.heroUniId = rspObj.Info.HeroInfo.HeroUniId
|
|
||||||
this.hero.heroId = q5.ToInt32(rspObj.Info.HeroInfo.HeroId)
|
|
||||||
this.hero.quality = q5.ToInt32(rspObj.Info.HeroInfo.Quality)
|
|
||||||
this.hero.specSkill = q5.ToInt32(rspObj.Info.HeroInfo.SpecSkill)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.Wealth, &this.hero.wealth)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.SkinId, &this.hero.skinId)
|
|
||||||
}
|
|
||||||
if this.GetTeam() != nil {
|
if this.GetTeam() != nil {
|
||||||
this.GetTeam().SendUpdateNotify()
|
this.GetTeam().SendUpdateNotify()
|
||||||
}
|
}
|
||||||
@ -486,25 +501,9 @@ func (this *player) updateChoose(skillId int32, heroUniId string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
this.name = rspObj.Info.UserInfo.Name
|
this.parseUserInfo(&rspObj.Info.UserInfo)
|
||||||
this.avatarUrl = rspObj.Info.UserInfo.HeadId
|
this.parseHeroInfo(&rspObj.Info.HeroInfo)
|
||||||
this.headFrame = rspObj.Info.UserInfo.HeadFrame
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.CircuitScore, &this.circuitScore)
|
|
||||||
q5.DuckToSimple(rspObj.Info.UserInfo.TotalLucky, &this.totalLucky)
|
|
||||||
{
|
|
||||||
this.hero.heroUniId = rspObj.Info.HeroInfo.HeroUniId
|
|
||||||
this.hero.heroId = q5.ToInt32(rspObj.Info.HeroInfo.HeroId)
|
|
||||||
this.hero.quality = q5.ToInt32(rspObj.Info.HeroInfo.Quality)
|
|
||||||
this.hero.specSkill = q5.ToInt32(rspObj.Info.HeroInfo.SpecSkill)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.Wealth, &this.hero.wealth)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
|
|
||||||
q5.DuckToSimple(rspObj.Info.HeroInfo.SkinId, &this.hero.skinId)
|
|
||||||
}
|
|
||||||
cb(0, "")
|
cb(0, "")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -570,6 +569,88 @@ func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvit
|
|||||||
this.GetTeam().SendUpdateNotify()
|
this.GetTeam().SendUpdateNotify()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) CMChooseBattleItem(hdr *f5.MsgHdr, msg *cs.CMChooseBattleItem) {
|
||||||
|
rspMsg := &cs.SMChooseBattleItem{}
|
||||||
|
if this.GetTeam().IsLock() {
|
||||||
|
rspMsg.Errcode = proto.Int32(1)
|
||||||
|
rspMsg.Errmsg = proto.String("team already started")
|
||||||
|
this.SendMsg(rspMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
params := map[string]string{
|
||||||
|
"c": "User",
|
||||||
|
"a": "getBattleItem",
|
||||||
|
"account_id": this.accountId,
|
||||||
|
"session_id": this.sessionId,
|
||||||
|
"item_id": q5.ToString(*msg.ItemId),
|
||||||
|
}
|
||||||
|
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
|
||||||
|
f5.GetHttpCliMgr().SendJsStyleRequest(
|
||||||
|
url,
|
||||||
|
params,
|
||||||
|
func(rsp f5.HttpCliResponse) {
|
||||||
|
f5.GetSysLog().Info("getBattleItem:%s", rsp.GetRawData())
|
||||||
|
if this.GetTeam() != nil && !this.GetTeam().IsLock() {
|
||||||
|
if rsp.GetErr() != nil {
|
||||||
|
rspMsg.Errcode = proto.Int32(1)
|
||||||
|
rspMsg.Errmsg = proto.String("team already started")
|
||||||
|
this.SendMsg(rspMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rspObj := struct {
|
||||||
|
Errcode int `json:"errcode"`
|
||||||
|
Errmsg string `json:"errmsg"`
|
||||||
|
ItemId interface{} `json:"item_id"`
|
||||||
|
ItemNum interface{} `json:"item_num"`
|
||||||
|
ItemType interface{} `json:"item_type"`
|
||||||
|
ItemSubType interface{} `json:"item_sub_type"`
|
||||||
|
HasLuckySymbol interface{} `json:"has_lucky_symbol"`
|
||||||
|
TotalLucky interface{} `json:"total_lucky"`
|
||||||
|
}{}
|
||||||
|
err := json.Unmarshal([]byte(rsp.GetRawData()), &rspObj)
|
||||||
|
if err != nil || rspObj.Errcode != 0 {
|
||||||
|
rspMsg.Errcode = proto.Int32(500)
|
||||||
|
rspMsg.Errmsg = proto.String("server internal error")
|
||||||
|
this.SendMsg(rspMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var itemId int32
|
||||||
|
var itemNum int32
|
||||||
|
var itemType int32
|
||||||
|
var itemSubType int32
|
||||||
|
q5.DuckToSimple(rspObj.ItemId, &itemId)
|
||||||
|
q5.DuckToSimple(rspObj.ItemNum, &itemNum)
|
||||||
|
q5.DuckToSimple(rspObj.ItemType, &itemType)
|
||||||
|
q5.DuckToSimple(rspObj.ItemSubType, &itemSubType)
|
||||||
|
q5.DuckToSimple(rspObj.HasLuckySymbol, &this.hasLuckySymbol)
|
||||||
|
q5.DuckToSimple(rspObj.TotalLucky, &this.totalLucky)
|
||||||
|
if itemNum > 0 {
|
||||||
|
found := false
|
||||||
|
for _, p := range(this.battleItems) {
|
||||||
|
if p.ItemType == itemType && p.ItemSubType == itemSubType {
|
||||||
|
p.ItemId = itemId
|
||||||
|
p.ItemNum = itemNum
|
||||||
|
p.ItemType = itemType
|
||||||
|
p.ItemSubType = itemSubType
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found && itemId != constant.LUCKY_SYMBOL_ITEM_ID {
|
||||||
|
p := new(common.BattleItem)
|
||||||
|
p.ItemId = itemId
|
||||||
|
p.ItemNum = itemNum
|
||||||
|
p.ItemType = itemType
|
||||||
|
p.ItemSubType = itemSubType
|
||||||
|
q5.AppendSlice(&this.battleItems, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.SendMsg(rspMsg)
|
||||||
|
this.GetTeam().SendUpdateNotify()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) IsBattling() bool {
|
func (this *player) IsBattling() bool {
|
||||||
return this.battling
|
return this.battling
|
||||||
}
|
}
|
||||||
@ -578,7 +659,12 @@ func (this *player) SetBattling(state bool) {
|
|||||||
this.battling = state
|
this.battling = state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) isLuckySymbolMap() bool {
|
||||||
|
return this.GetTeam().GetModeId() == 4
|
||||||
|
}
|
||||||
|
|
||||||
func newPlayer() *player {
|
func newPlayer() *player {
|
||||||
hum := new(player)
|
hum := new(player)
|
||||||
|
q5.NewSlice(&hum.battleItems, 0, 2)
|
||||||
return hum
|
return hum
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ enum CMMessageId_e
|
|||||||
_CMChooseHero = 116;
|
_CMChooseHero = 116;
|
||||||
_CMChooseMap = 117;
|
_CMChooseMap = 117;
|
||||||
_CMRefreshUser = 118;
|
_CMRefreshUser = 118;
|
||||||
|
_CMChooseBattleItem = 119;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SMMessageId_e
|
enum SMMessageId_e
|
||||||
@ -41,6 +42,7 @@ enum SMMessageId_e
|
|||||||
_SMChooseHero = 116;
|
_SMChooseHero = 116;
|
||||||
_SMChooseMap = 117;
|
_SMChooseMap = 117;
|
||||||
_SMRefreshUser = 118;
|
_SMRefreshUser = 118;
|
||||||
|
_SMChooseBattleItem = 120;
|
||||||
|
|
||||||
_SMTeamUpdateNotify = 1001;
|
_SMTeamUpdateNotify = 1001;
|
||||||
_SMTeamStateNotify = 1002;
|
_SMTeamStateNotify = 1002;
|
||||||
|
@ -122,6 +122,13 @@ message MFJoinMsg
|
|||||||
optional string payload = 2; //透传数据
|
optional string payload = 2; //透传数据
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//带入战斗的道具
|
||||||
|
message MFBattleItem
|
||||||
|
{
|
||||||
|
optional int32 item_id = 1; //道具id
|
||||||
|
optional int32 item_num = 2; //道具数量
|
||||||
|
}
|
||||||
|
|
||||||
//队伍成员
|
//队伍成员
|
||||||
message MFTeamMember
|
message MFTeamMember
|
||||||
{
|
{
|
||||||
@ -141,6 +148,10 @@ message MFTeamMember
|
|||||||
optional int32 admission_item_num = 14; //门票数
|
optional int32 admission_item_num = 14; //门票数
|
||||||
optional int32 battling = 15; //是否战斗中
|
optional int32 battling = 15; //是否战斗中
|
||||||
optional int32 circuit_score = 16; //循回赛积分
|
optional int32 circuit_score = 16; //循回赛积分
|
||||||
|
optional int32 vip_lv = 17; //vip等级
|
||||||
|
optional int64 vip_exp = 18; //vip经验
|
||||||
|
optional int32 has_vip_lucky = 19; //是否有vip幸运值加成
|
||||||
|
repeated MFBattleItem battle_items = 20; //带入战斗的道具
|
||||||
}
|
}
|
||||||
|
|
||||||
//队伍信息
|
//队伍信息
|
||||||
@ -332,6 +343,18 @@ message SMRefreshUser
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//选择带入战斗的道具
|
||||||
|
message CMChooseBattleItem
|
||||||
|
{
|
||||||
|
optional int32 item_id = 1; //道具id
|
||||||
|
}
|
||||||
|
|
||||||
|
message SMChooseBattleItem
|
||||||
|
{
|
||||||
|
optional int32 errcode = 1; //错误码 0:成功
|
||||||
|
optional string errmsg = 2; //错误描述
|
||||||
|
}
|
||||||
|
|
||||||
//授予邀请队友权限
|
//授予邀请队友权限
|
||||||
message CMGrantInvitePermission
|
message CMGrantInvitePermission
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ func (this *team) GetMapId() int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) GetModeId() int32 {
|
func (this *team) GetModeId() int32 {
|
||||||
return this.mapInfo.MapId
|
return q5.SafeToInt32(this.mapInfo.ModeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) GetZnKey() int64 {
|
func (this *team) GetZnKey() int64 {
|
||||||
@ -385,6 +385,8 @@ func (this *team) genStartGameInfo() {
|
|||||||
HeroUniId string `json:"hero_uniid"`
|
HeroUniId string `json:"hero_uniid"`
|
||||||
IsAndroid int32 `json:"is_android"`
|
IsAndroid int32 `json:"is_android"`
|
||||||
RobotId int32 `json:"robot_id"`
|
RobotId int32 `json:"robot_id"`
|
||||||
|
HasLuckySymbol int32 `json:"has_lucky_symbol"`
|
||||||
|
BattleItems []*common.BattleItem `json:"battle_items"`
|
||||||
} `json:"members"`
|
} `json:"members"`
|
||||||
} `json:"team_list"`
|
} `json:"team_list"`
|
||||||
ObList []struct {
|
ObList []struct {
|
||||||
@ -436,6 +438,7 @@ func (this *team) genStartGameInfo() {
|
|||||||
ele2.AccountId = m.GetAccountId()
|
ele2.AccountId = m.GetAccountId()
|
||||||
ele2.SpecSkill = m.GetSpecSkill()
|
ele2.SpecSkill = m.GetSpecSkill()
|
||||||
ele2.HeroUniId = m.GetHeroUniid()
|
ele2.HeroUniId = m.GetHeroUniid()
|
||||||
|
ele2.BattleItems = m.GetBattleItems()
|
||||||
GetHistoryMgr().AddBattle(m.GetAccountId(),
|
GetHistoryMgr().AddBattle(m.GetAccountId(),
|
||||||
this.mapInfo.MapId,
|
this.mapInfo.MapId,
|
||||||
q5.SafeToInt32(this.mapInfo.ModeId))
|
q5.SafeToInt32(this.mapInfo.ModeId))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user