Compare commits
No commits in common. "master" and "cec" have entirely different histories.
@ -115,10 +115,6 @@
|
|||||||
"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,6 +4,5 @@
|
|||||||
"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
|
|
||||||
}
|
}
|
||||||
|
@ -1,123 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"rights": "1:5",
|
|
||||||
"require": 0,
|
|
||||||
"thisPoint": 1000,
|
|
||||||
"rank": 0,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:10",
|
|
||||||
"require": 1000,
|
|
||||||
"thisPoint": 1000,
|
|
||||||
"rank": 1,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1.2,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 101
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:10|2:0.05",
|
|
||||||
"require": 2200,
|
|
||||||
"thisPoint": 2000,
|
|
||||||
"rank": 2,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1.4,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 102
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:15|2:0.05",
|
|
||||||
"require": 5000,
|
|
||||||
"thisPoint": 4000,
|
|
||||||
"rank": 3,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1.6,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 103
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:15|2:0.075|4:0.05",
|
|
||||||
"require": 11400,
|
|
||||||
"thisPoint": 8000,
|
|
||||||
"rank": 4,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1.8,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 104
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:20|2:0.075|4:0.05",
|
|
||||||
"require": 25800,
|
|
||||||
"thisPoint": 16000,
|
|
||||||
"rank": 5,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 2,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 105
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:20|2:0.1|4:0.075|5:0.05",
|
|
||||||
"require": 57800,
|
|
||||||
"thisPoint": 32000,
|
|
||||||
"rank": 6,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 2.2,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 106
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:25|2:0.1|4:0.075|5:0.05",
|
|
||||||
"require": 128200,
|
|
||||||
"thisPoint": 64000,
|
|
||||||
"rank": 7,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 2.4,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 107
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:25|2:0.125|4:0.1|5:0.075|3:2",
|
|
||||||
"require": 281800,
|
|
||||||
"thisPoint": 128000,
|
|
||||||
"rank": 8,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 2.6,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 108
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:30|2:0.125|4:0.1|5:0.075|3:3",
|
|
||||||
"require": 614600,
|
|
||||||
"thisPoint": 256000,
|
|
||||||
"rank": 9,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 2.8,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 109
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rights": "1:30|2:0.15|4:0.125|5:0.1|3:5|6:100",
|
|
||||||
"require": 1331400,
|
|
||||||
"thisPoint": -1,
|
|
||||||
"rank": 10,
|
|
||||||
"vip_name": "item_desc_210001",
|
|
||||||
"rate": 1,
|
|
||||||
"vip_working_tips": "item_desc_210001",
|
|
||||||
"vip_unworking_tips": "item_desc_210001",
|
|
||||||
"id": 110
|
|
||||||
}
|
|
||||||
]
|
|
@ -1 +0,0 @@
|
|||||||
../../light_backtask/res/stakingVip@stakingVip.json
|
|
@ -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": 0
|
"circuit_mode_interval_time": 120
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"f5"
|
"f5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
@ -9,7 +8,6 @@ import (
|
|||||||
"main/mt"
|
"main/mt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"q5"
|
"q5"
|
||||||
"sort"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -56,8 +54,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(
|
||||||
constant.CONF_DB,
|
constant.CONF_DB,
|
||||||
@ -85,8 +82,6 @@ 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"))
|
||||||
@ -146,7 +141,6 @@ 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"`
|
||||||
}{}
|
}{}
|
||||||
@ -157,10 +151,7 @@ func (this *GameSwitchApi) Edit(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gswitch := new(struct {
|
gswitch := new(system.GameSwitch)
|
||||||
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) {
|
||||||
@ -178,11 +169,8 @@ 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 {
|
||||||
@ -258,7 +246,7 @@ func (this *GameSwitchApi) Refresh(c *gin.Context) {
|
|||||||
if q5.DecodeJson(rsp.GetRawData(), &rspJson) != nil {
|
if q5.DecodeJson(rsp.GetRawData(), &rspJson) != nil {
|
||||||
f5.RspErr2(c, 500, "server internal error")
|
f5.RspErr2(c, 500, "server internal error")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f5.RspErr2(c, rspJson.ErrCode, rspJson.ErrMsg)
|
f5.RspErr2(c, rspJson.ErrCode, rspJson.ErrMsg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,11 @@ func (pai *PlayerApi) Info(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if len(accountids) == 0 {
|
if len(accountids) == 0 {
|
||||||
f5.RspErr2(c, 0, "")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 0,
|
||||||
|
"message": "",
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +81,10 @@ func (pai *PlayerApi) Info(c *gin.Context) {
|
|||||||
filterstr += ")"
|
filterstr += ")"
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
f5.RspErr2(c, 1, "input one of playername, account_id, address, email")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"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)
|
||||||
@ -132,7 +139,10 @@ func (pai *PlayerApi) BagQuery(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqJson.Account_id) > 0xFF {
|
if len(reqJson.Account_id) > 0xFF {
|
||||||
f5.RspErr2(c, 1, "输入过长")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 1,
|
||||||
|
"message": "输入过长",
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +168,10 @@ func (pai *PlayerApi) HeroesQuery(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqJson.Account_id) > 0xFF {
|
if len(reqJson.Account_id) > 0xFF {
|
||||||
f5.RspErr2(c, 1, "输入过长")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 1,
|
||||||
|
"message": "输入过长",
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +267,10 @@ 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 {
|
||||||
f5.RspErr2(c, 1, "input one of token_id, open_address")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 1,
|
||||||
|
"message": "input one of token_id, open_address",
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +330,10 @@ 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 {
|
||||||
f5.RspErr2(c, 1, "input one of order_id, seller, seller_address")
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 1,
|
||||||
|
"message": "input one of order_id, seller, seller_address",
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,51 +347,6 @@ 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,7 +19,6 @@ 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))
|
||||||
|
@ -22,14 +22,12 @@ import (
|
|||||||
其他的需要校验
|
其他的需要校验
|
||||||
|
|
||||||
OutApp不需要限制并发数!!!
|
OutApp不需要限制并发数!!!
|
||||||
Callback 也不需要
|
|
||||||
*/
|
*/
|
||||||
func CaForward(c *gin.Context) {
|
func CaForward(c *gin.Context) {
|
||||||
accountId := c.DefaultQuery("account_id", "")
|
accountId := c.DefaultQuery("account_id", "")
|
||||||
sessionId := c.DefaultQuery("session_id", "")
|
sessionId := c.DefaultQuery("session_id", "")
|
||||||
|
|
||||||
cmd:=c.DefaultQuery("c", "")
|
var needlimit bool = !strings.HasPrefix(c.DefaultQuery("c", ""), "OutApp")
|
||||||
var needlimit bool = !strings.HasPrefix(cmd, "OutApp") && !strings.HasPrefix(cmd, "Callback")
|
|
||||||
if needlimit && !jccommon.IsValidSessionId(accountId, sessionId) {
|
if needlimit && !jccommon.IsValidSessionId(accountId, sessionId) {
|
||||||
f5.RspErr(c, 500, "invalid session_id")
|
f5.RspErr(c, 500, "invalid session_id")
|
||||||
c.Abort()
|
c.Abort()
|
||||||
|
@ -64,11 +64,6 @@ 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
|
||||||
}
|
}
|
||||||
@ -78,6 +73,11 @@ 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().UpsertEx(
|
f5.GetJsStyleDb().Upsert(
|
||||||
constant.FRIEND_DB,
|
constant.FRIEND_DB,
|
||||||
"t_friend_relationship",
|
"t_friend_relationship",
|
||||||
[][]string{
|
[][]string{
|
||||||
@ -33,14 +33,7 @@ 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)},
|
||||||
},
|
},
|
||||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
cb)
|
||||||
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,
|
||||||
@ -58,26 +51,3 @@ 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) {
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
package mt
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"main/mtb"
|
|
||||||
)
|
|
||||||
|
|
||||||
type StakingVip struct {
|
|
||||||
mtb.StakingVip
|
|
||||||
}
|
|
||||||
|
|
||||||
type StakingVipTable struct {
|
|
||||||
f5.IdMetaTable[StakingVip]
|
|
||||||
}
|
|
@ -19,7 +19,6 @@ 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) {
|
||||||
@ -87,9 +86,4 @@ 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,7 +84,6 @@ 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
|
||||||
@ -138,21 +137,6 @@ 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
|
||||||
}
|
}
|
||||||
@ -497,14 +481,6 @@ 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
|
||||||
}
|
}
|
||||||
@ -649,78 +625,6 @@ 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)
|
||||||
@ -784,7 +688,6 @@ 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{}) {
|
||||||
@ -819,15 +722,3 @@ 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,7 +71,6 @@ 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,17 +109,4 @@ message HashRateCommon
|
|||||||
optional string start_time = 2;
|
optional string start_time = 2;
|
||||||
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,13 +1,12 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"f5"
|
|
||||||
"main/constant"
|
|
||||||
"main/mt"
|
|
||||||
"math/big"
|
|
||||||
"q5"
|
"q5"
|
||||||
"strings"
|
"f5"
|
||||||
"sync"
|
"sync"
|
||||||
|
"strings"
|
||||||
|
"main/constant"
|
||||||
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
||||||
type vip struct {
|
type vip struct {
|
||||||
@ -32,8 +31,6 @@ 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,
|
||||||
@ -69,15 +66,6 @@ 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,
|
||||||
@ -90,10 +78,6 @@ 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",
|
||||||
@ -120,17 +104,6 @@ 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},
|
||||||
@ -150,16 +123,6 @@ 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",
|
||||||
@ -171,10 +134,6 @@ 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",
|
||||||
@ -192,7 +151,7 @@ Withdraw 所有
|
|||||||
|
|
||||||
按时间排序处理事件的先后顺序
|
按时间排序处理事件的先后顺序
|
||||||
|
|
||||||
通过Vester.sol的remainingEsToken方法获取, 如果要本地计算的话, 那就取每次Deposit事件的时间和amount, 加上先前的转换的余额, 再按total * (now - deposit_time) / (365 * 24 * 3600)
|
通过Vester.sol的remainingEsToken方法获取, 如果要本地计算的话, 那就取每次Deposit事件的时间和amount, 加上先前的转换的余额, 再按total * (now - deposit_time) / (365 * 24 * 2600)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
||||||
@ -243,7 +202,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 * 3600))
|
bnTotalTime := new(big.Int).SetInt64(int64(365 * 24 * 2600))
|
||||||
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)
|
||||||
@ -275,66 +234,3 @@ 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
|
|
||||||
}
|
|
||||||
|
@ -1,99 +0,0 @@
|
|||||||
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,5 +1,8 @@
|
|||||||
package task
|
package task
|
||||||
|
|
||||||
|
import (
|
||||||
|
)
|
||||||
|
|
||||||
type taskMgr struct {
|
type taskMgr struct {
|
||||||
webHook
|
webHook
|
||||||
repairNft
|
repairNft
|
||||||
@ -13,7 +16,6 @@ type taskMgr struct {
|
|||||||
esCecTransfer
|
esCecTransfer
|
||||||
stackingCec
|
stackingCec
|
||||||
vester
|
vester
|
||||||
rankchart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *taskMgr) Init() {
|
func (this *taskMgr) Init() {
|
||||||
@ -29,7 +31,6 @@ 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() {
|
||||||
@ -45,5 +46,4 @@ 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,16 +77,13 @@ 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 &&
|
err := model.Inbox.Mark(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
||||||
mi.state != constant.INBOX_STATE_RECEIVED {
|
if err != nil {
|
||||||
err := model.Inbox.Mark(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
resultErr = err
|
||||||
if err != nil {
|
break
|
||||||
resultErr = err
|
|
||||||
break
|
|
||||||
}
|
|
||||||
mi.state = constant.INBOX_STATE_READ
|
|
||||||
mi.expireTime = m.GetExpireTime()
|
|
||||||
}
|
}
|
||||||
|
mi.state = constant.INBOX_STATE_READ
|
||||||
|
mi.expireTime = m.GetExpireTime()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"main/api/v1/recharge"
|
"main/api/v1/recharge"
|
||||||
"main/api/v1/shopcart"
|
"main/api/v1/shopcart"
|
||||||
"main/api/v1/user"
|
"main/api/v1/user"
|
||||||
"main/api/v1/vip"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ApiGroup struct {
|
type ApiGroup struct {
|
||||||
@ -29,7 +28,6 @@ type ApiGroup struct {
|
|||||||
EventApiGroup event.ApiGroup
|
EventApiGroup event.ApiGroup
|
||||||
RechargeApiGroup recharge.ApiGroup
|
RechargeApiGroup recharge.ApiGroup
|
||||||
SwitchApiGroup game_switch.ApiGroup
|
SwitchApiGroup game_switch.ApiGroup
|
||||||
VIPApiGroup vip.ApiGroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ApiGroupApp = new(ApiGroup)
|
var ApiGroupApp = new(ApiGroup)
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package vip
|
|
||||||
|
|
||||||
type ApiGroup struct {
|
|
||||||
VIPApi
|
|
||||||
}
|
|
@ -1,237 +0,0 @@
|
|||||||
package vip
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"main/constant"
|
|
||||||
"main/mt"
|
|
||||||
"main/service"
|
|
||||||
"math/big"
|
|
||||||
"q5"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
type VIPApi struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *VIPApi) Info(c *gin.Context) {
|
|
||||||
accountAddress := c.MustGet("account_address").(string)
|
|
||||||
rspObj := struct {
|
|
||||||
ErrCode int32 `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
ContributionPoint string `json:"contribution_point"`
|
|
||||||
Info struct {
|
|
||||||
BindPassport string `json:"bind_passport_address"`
|
|
||||||
Email string `json:"bind_email"`
|
|
||||||
} `json:"info"`
|
|
||||||
}{}
|
|
||||||
|
|
||||||
{
|
|
||||||
var dbErr error
|
|
||||||
sql := "SELECT passport_address,lower_case_email FROM t_vip_bind WHERE account_address = ?;"
|
|
||||||
params := []string{
|
|
||||||
accountAddress,
|
|
||||||
}
|
|
||||||
f5.GetGoStyleDb().RawQuery(
|
|
||||||
constant.BCNFT_DB,
|
|
||||||
sql,
|
|
||||||
params,
|
|
||||||
func(err error, ds *f5.DataSet) {
|
|
||||||
dbErr = err
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ds.Next() {
|
|
||||||
rspObj.Info.BindPassport = ds.GetByIndex(0)
|
|
||||||
rspObj.Info.Email = ds.GetByIndex(1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if dbErr != nil {
|
|
||||||
f5.RspErr(c, 500, "server internal error")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *VIPApi) Bind(c *gin.Context) {
|
|
||||||
accountAddress := c.GetString("account_address")
|
|
||||||
if accountAddress == "" {
|
|
||||||
f5.RspErr(c, 1, "bad request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
reqObj := struct {
|
|
||||||
Passport_jwt string `json:"passport_jwt"`
|
|
||||||
}{}
|
|
||||||
|
|
||||||
if err := c.ShouldBindJSON(&reqObj); err != nil {
|
|
||||||
f5.RspErr(c, 1, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
info := map[string]interface{}{}
|
|
||||||
info["account_address"] = ""
|
|
||||||
info["email"] = ""
|
|
||||||
service.JwtAuth.JwtAuthHandle(reqObj.Passport_jwt, &info, constant.JWT_PASSPORT)
|
|
||||||
passport_addr := info["account_address"].(string)
|
|
||||||
if passport_addr == "" || accountAddress == passport_addr {
|
|
||||||
f5.RspErr(c, 1, "bad request passport")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
email := info["email"].(string)
|
|
||||||
|
|
||||||
bound := false
|
|
||||||
{
|
|
||||||
var dbErr error
|
|
||||||
sql := "SELECT idx FROM t_vip_bind WHERE account_address = ? OR passport_address = ?;"
|
|
||||||
params := []string{
|
|
||||||
accountAddress,
|
|
||||||
passport_addr,
|
|
||||||
}
|
|
||||||
f5.GetGoStyleDb().RawQuery(
|
|
||||||
constant.BCNFT_DB,
|
|
||||||
sql,
|
|
||||||
params,
|
|
||||||
func(err error, ds *f5.DataSet) {
|
|
||||||
dbErr = err
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ds.Next() {
|
|
||||||
bound = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if dbErr != nil {
|
|
||||||
f5.RspErr(c, 500, "server internal error")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if bound {
|
|
||||||
f5.RspErr(c, 1, "account or passport bound")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ts := f5.GetApp().GetRealSeconds()
|
|
||||||
var dbErr error
|
|
||||||
f5.GetGoStyleDb().Insert(
|
|
||||||
constant.BCNFT_DB,
|
|
||||||
"t_vip_bind",
|
|
||||||
[][]string{
|
|
||||||
{"account_address", accountAddress},
|
|
||||||
{"passport_address", passport_addr},
|
|
||||||
{"email", email},
|
|
||||||
{"lower_case_email", strings.ToLower(email)},
|
|
||||||
{"createtime", q5.ToString(ts)},
|
|
||||||
{"modifytime", q5.ToString(ts)},
|
|
||||||
},
|
|
||||||
func(err error, lastInsertId int64, rowsAffected int64) {
|
|
||||||
if err != nil {
|
|
||||||
dbErr = err
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if dbErr != nil {
|
|
||||||
f5.RspErr(c, 500, "server internal error")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f5.RspErr(c, 0, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *VIPApi) Details(c *gin.Context) {
|
|
||||||
accountAddress := c.GetString("account_address")
|
|
||||||
if accountAddress == "" {
|
|
||||||
f5.RspErr(c, 1, "bad request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rspObj := struct {
|
|
||||||
ErrCode int32 `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
Info struct {
|
|
||||||
Level int32 `json:"level"`
|
|
||||||
Cur int64 `json:"curpoint"`
|
|
||||||
Target int64 `json:"target"`
|
|
||||||
} `json:"info"`
|
|
||||||
}{}
|
|
||||||
|
|
||||||
{
|
|
||||||
var dbErr error
|
|
||||||
found := false
|
|
||||||
sql := "SELECT * FROM t_vip_user WHERE account_address = ?"
|
|
||||||
params := []string{
|
|
||||||
accountAddress,
|
|
||||||
}
|
|
||||||
f5.GetGoStyleDb().RawQuery(
|
|
||||||
constant.BCNFT_DB,
|
|
||||||
sql,
|
|
||||||
params,
|
|
||||||
func(err error, ds *f5.DataSet) {
|
|
||||||
dbErr = err
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ds.Next() {
|
|
||||||
found = true
|
|
||||||
rspObj.Info.Level = q5.SafeToInt32(ds.GetByName("vip_lv"))
|
|
||||||
cfg := mt.Table.StakingVip.GetById(q5.SafeToInt64(rspObj.Info.Level))
|
|
||||||
if cfg != nil {
|
|
||||||
rspObj.Info.Target = cfg.GetThisPoint()
|
|
||||||
bigintobj := new(big.Int)
|
|
||||||
escec_balance, ok := bigintobj.SetString(ds.GetByName("escec_balance"), 10)
|
|
||||||
if !ok {
|
|
||||||
f5.GetSysLog().Warning("escec_balance err:%s", ds.GetByName("escec_balance"))
|
|
||||||
}
|
|
||||||
|
|
||||||
escec_stacking, ok := bigintobj.SetString(ds.GetByName("escec_stacking"), 10)
|
|
||||||
if !ok {
|
|
||||||
f5.GetSysLog().Warning("escec_stacking err:%s", ds.GetByName("escec_stacking"))
|
|
||||||
}
|
|
||||||
|
|
||||||
curExec := bigintobj.Add(escec_balance, escec_stacking)
|
|
||||||
|
|
||||||
escec_convert, ok := bigintobj.SetString(ds.GetByName("escec_convert"), 10)
|
|
||||||
if !ok {
|
|
||||||
f5.GetSysLog().Warning("escec_convert err:%s", ds.GetByName("escec_convert"))
|
|
||||||
}
|
|
||||||
|
|
||||||
last_convert_time := q5.SafeToInt64(ds.GetByName("last_convert_time"))
|
|
||||||
nowsecs := f5.GetApp().GetRealSeconds()
|
|
||||||
elaspse := bigintobj.SetInt64(nowsecs - last_convert_time)
|
|
||||||
depositExec := bigintobj.Mul(escec_convert, elaspse)
|
|
||||||
depositExec = bigintobj.Div(depositExec, bigintobj.SetInt64(365*24*3600))
|
|
||||||
depositExec = bigintobj.Sub(escec_convert, depositExec)
|
|
||||||
curExec = bigintobj.Add(curExec, depositExec)
|
|
||||||
convercurExec := bigintobj.Div(curExec, bigintobj.SetInt64(10^18)).Int64()
|
|
||||||
nextlvcfg := mt.Table.StakingVip.GetById(q5.SafeToInt64(rspObj.Info.Level + 1))
|
|
||||||
if nextlvcfg != nil && convercurExec >= cfg.GetRequire() {
|
|
||||||
rspObj.Info.Cur = cfg.GetThisPoint() * (convercurExec - cfg.GetRequire()) /(nextlvcfg.GetRequire() - cfg.GetRequire())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if dbErr != nil {
|
|
||||||
f5.RspErr(c, 500, "server internal error")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !found {
|
|
||||||
f5.RspErr(c, 1, "not vip")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
}
|
|
@ -31,8 +31,3 @@ const (
|
|||||||
const (
|
const (
|
||||||
GAME_SWITCH_HERO_MINT = "heroMint"
|
GAME_SWITCH_HERO_MINT = "heroMint"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
JWT_METAMAST = 1
|
|
||||||
JWT_PASSPORT = 2
|
|
||||||
)
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
|
"main/mt"
|
||||||
"fmt"
|
"fmt"
|
||||||
"jccommon"
|
"jccommon"
|
||||||
"main/mt"
|
|
||||||
"q5"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ func internalJwtAuth(c *gin.Context, maybe bool) {
|
|||||||
tokenHeader := c.Request.Header.Get("Authorization")
|
tokenHeader := c.Request.Header.Get("Authorization")
|
||||||
jwtToken := ""
|
jwtToken := ""
|
||||||
if len(tokenHeader) > 8 {
|
if len(tokenHeader) > 8 {
|
||||||
jwtToken = tokenHeader[7:]
|
jwtToken = tokenHeader[7:len(tokenHeader)]
|
||||||
} else {
|
} else {
|
||||||
if maybe {
|
if maybe {
|
||||||
c.Set("open_id", "")
|
c.Set("open_id", "")
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
package mt
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"main/mtb"
|
|
||||||
)
|
|
||||||
|
|
||||||
type StakingVip struct {
|
|
||||||
mtb.StakingVip
|
|
||||||
}
|
|
||||||
|
|
||||||
type StakingVipTable struct {
|
|
||||||
f5.IdMetaTable[StakingVip]
|
|
||||||
}
|
|
@ -19,7 +19,6 @@ type table struct {
|
|||||||
Currency *CurrencyTable
|
Currency *CurrencyTable
|
||||||
AccountDb *AccountDbTable
|
AccountDb *AccountDbTable
|
||||||
ConfDb *ConfDbTable
|
ConfDb *ConfDbTable
|
||||||
StakingVip *StakingVipTable
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var Table = f5.New(func(this *table) {
|
var Table = f5.New(func(this *table) {
|
||||||
@ -86,9 +85,4 @@ var Table = f5.New(func(this *table) {
|
|||||||
this.FileName = "../res/recharge@recharge.json"
|
this.FileName = "../res/recharge@recharge.json"
|
||||||
this.PrimKey = "id"
|
this.PrimKey = "id"
|
||||||
})
|
})
|
||||||
|
|
||||||
this.StakingVip = f5.New(func(this *StakingVipTable) {
|
|
||||||
this.FileName = "../res/stakingVip@stakingVip.json"
|
|
||||||
this.PrimKey = "rank"
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
@ -139,21 +139,6 @@ type Web3SignCluster 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 *MarketServerCluster) GetInstanceId() int32 {
|
func (this *MarketServerCluster) GetInstanceId() int32 {
|
||||||
return this.instance_id
|
return this.instance_id
|
||||||
}
|
}
|
||||||
@ -610,78 +595,6 @@ func (this *Web3SignCluster) HasUrl() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
return (this._flags1_ & (uint64(1) << 1)) > 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 *MarketServerCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *MarketServerCluster) 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)
|
||||||
@ -778,15 +691,3 @@ func (this *Web3ServiceCluster) LoadFromKv(kv map[string]interface{}) {
|
|||||||
func (this *Web3SignCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *Web3SignCluster) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.url, "url", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.url, "url", &this._flags1_, 1, 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)
|
|
||||||
}
|
|
||||||
|
@ -110,16 +110,3 @@ message Web3SignCluster
|
|||||||
{
|
{
|
||||||
optional string url = 1;
|
optional string url = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
@ -15,7 +15,6 @@ import (
|
|||||||
"main/router/recharge"
|
"main/router/recharge"
|
||||||
"main/router/shopcart"
|
"main/router/shopcart"
|
||||||
"main/router/user"
|
"main/router/user"
|
||||||
"main/router/vip"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type routerMgr struct {
|
type routerMgr struct {
|
||||||
@ -31,7 +30,6 @@ type routerMgr struct {
|
|||||||
event event.RouterGroup
|
event event.RouterGroup
|
||||||
recharge recharge.RouterGroup
|
recharge recharge.RouterGroup
|
||||||
gameswitch game_switch.RouterGroup
|
gameswitch game_switch.RouterGroup
|
||||||
vip vip.RouterGroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *routerMgr) Init() {
|
func (this *routerMgr) Init() {
|
||||||
@ -50,7 +48,6 @@ func (this *routerMgr) Init() {
|
|||||||
this.event.EventRouter.InitRouter()
|
this.event.EventRouter.InitRouter()
|
||||||
this.recharge.RechargeRouter.InitRouter()
|
this.recharge.RechargeRouter.InitRouter()
|
||||||
this.gameswitch.GameSwitchRouter.InitRouter()
|
this.gameswitch.GameSwitchRouter.InitRouter()
|
||||||
this.vip.InitRouter()
|
|
||||||
|
|
||||||
f5.GetSysLog().Info("routerMgr.init")
|
f5.GetSysLog().Info("routerMgr.init")
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package vip
|
|
||||||
|
|
||||||
type RouterGroup struct {
|
|
||||||
VIPRouter
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package vip
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
v1 "main/api/v1"
|
|
||||||
"main/middleware"
|
|
||||||
)
|
|
||||||
|
|
||||||
type VIPRouter struct{}
|
|
||||||
|
|
||||||
func (this *VIPRouter) InitRouter() {
|
|
||||||
api := v1.ApiGroupApp.VIPApiGroup
|
|
||||||
f5.GetApp().GetGinEngine().GET("/api/vip/info",
|
|
||||||
middleware.JwtAuth,
|
|
||||||
api.VIPApi.Info)
|
|
||||||
f5.GetApp().GetGinEngine().POST("/api/vip/bind",
|
|
||||||
middleware.JwtAuth,
|
|
||||||
api.VIPApi.Bind)
|
|
||||||
f5.GetApp().GetGinEngine().GET("/api/vip/details",
|
|
||||||
middleware.JwtAuth,
|
|
||||||
api.VIPApi.Details)
|
|
||||||
}
|
|
@ -19,12 +19,11 @@ type accountContribution struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ac *accountContribution) sum() float64 {
|
func (ac *accountContribution) sum() float64 {
|
||||||
return ac.history + ac.stakingContri + ac.gamecontribution + ac.rechargeContri
|
return ac.history + ac.stakingContri + ac.gamecontribution + ac.rechargeContri
|
||||||
}
|
}
|
||||||
|
|
||||||
type contribution struct {
|
type contribution struct {
|
||||||
historyContribution float64
|
historyContribution float64
|
||||||
stakingContribution float64
|
|
||||||
rechargeContribution float64
|
rechargeContribution float64
|
||||||
gameContribution float64
|
gameContribution float64
|
||||||
gcTime int64
|
gcTime int64
|
||||||
@ -45,7 +44,7 @@ func (this *contribution) unInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *contribution) sum() float64 {
|
func (c *contribution) sum() float64 {
|
||||||
return c.historyContribution + c.stakingContribution + c.rechargeContribution + c.gameContribution
|
return c.historyContribution + c.rechargeContribution + c.gameContribution
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) {
|
func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) {
|
||||||
@ -253,10 +252,8 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
|
|||||||
this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant {
|
sql = `SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE idx > 0`
|
||||||
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,
|
||||||
@ -267,11 +264,14 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ds.Next() {
|
if ds.Next() {
|
||||||
this.stakingContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
|
tmp, _ := q5.ToFloat64Ex(ds.GetByIndex(0))
|
||||||
|
this.historyContribution += tmp
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
sql = `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
|
if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant {
|
||||||
|
sql := `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
|
||||||
f5.GetGoStyleDb().RawQuery(
|
f5.GetGoStyleDb().RawQuery(
|
||||||
constant.GAME_DB,
|
constant.GAME_DB,
|
||||||
sql,
|
sql,
|
||||||
|
@ -9,7 +9,6 @@ var Contribution = new(contribution)
|
|||||||
var _serviceMgr = new(serviceMgr)
|
var _serviceMgr = new(serviceMgr)
|
||||||
var GameSwitches = new(gameSwitch)
|
var GameSwitches = new(gameSwitch)
|
||||||
var User = new(user)
|
var User = new(user)
|
||||||
var JwtAuth = new(jwtauth)
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
global.RegModule(constant.SERVICE_MGR_MODULE_IDX, _serviceMgr)
|
global.RegModule(constant.SERVICE_MGR_MODULE_IDX, _serviceMgr)
|
||||||
|
@ -1,149 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"fmt"
|
|
||||||
"jccommon"
|
|
||||||
"main/mt"
|
|
||||||
"marketserver/constant"
|
|
||||||
"q5"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
type jwtauth struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *jwtauth) init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *jwtauth) unInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *jwtauth) JwtAuthHandle(srcToken string, rspinfo *map[string]interface{}, jwtType int32) {
|
|
||||||
jwtToken := ""
|
|
||||||
if len(srcToken) > 8 {
|
|
||||||
jwtToken = srcToken[7:]
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpStrings := q5.StrSplit(jwtToken, ".")
|
|
||||||
if len(tmpStrings) > 3 {
|
|
||||||
if jwtType == constant.JWT_METAMAST {
|
|
||||||
this.internalMetaMaskJwtAuth(jwtToken, rspinfo)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if jwtType == constant.JWT_PASSPORT {
|
|
||||||
this.internalImmutJwtAuth(jwtToken, rspinfo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *jwtauth) internalImmutJwtAuth(jwtToken string, rspinfo *map[string]interface{}) {
|
|
||||||
params := map[string]string{
|
|
||||||
"c": "Jwt",
|
|
||||||
"a": "verify",
|
|
||||||
}
|
|
||||||
jsonReqObj := &struct {
|
|
||||||
JwksUri string `json:"jwksUri"`
|
|
||||||
Data string `json:"data"`
|
|
||||||
}{
|
|
||||||
JwksUri: mt.Table.Config.GetJwksUri(),
|
|
||||||
Data: jwtToken,
|
|
||||||
}
|
|
||||||
jsonRspObj := &struct {
|
|
||||||
ErrCode interface{} `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
Decoded struct {
|
|
||||||
Sub string `json:"sub"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
EmailVerified bool `json:"email_verified"`
|
|
||||||
Sid string `json:"sid"`
|
|
||||||
Passport struct {
|
|
||||||
ZkevmEthAddress string `json:"zkevm_eth_address"`
|
|
||||||
} `json:"passport"`
|
|
||||||
} `json:"decoded"`
|
|
||||||
}{}
|
|
||||||
rspObj := &struct {
|
|
||||||
ErrCode interface{} `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
}{}
|
|
||||||
paramsStr := q5.EncodeJson(jsonReqObj)
|
|
||||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3ServiceCluster.RandElement().GetUrl())
|
|
||||||
f5.GetHttpCliMgr().SendGoStyleJsonRspPost(
|
|
||||||
url,
|
|
||||||
params,
|
|
||||||
jsonRspObj,
|
|
||||||
q5.HTTP_HEADER_JSON,
|
|
||||||
paramsStr,
|
|
||||||
func(rsp f5.HttpCliResponse) {
|
|
||||||
if rsp.GetErr() != nil ||
|
|
||||||
!rsp.JsonParseOk() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
|
|
||||||
rspObj.ErrMsg = jsonRspObj.ErrMsg
|
|
||||||
if q5.SafeToInt32(rspObj.ErrCode) != 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
openId := fmt.Sprintf("%d_2006_%s", jccommon.IMTBL_CHANNEL, jsonRspObj.Decoded.Sub)
|
|
||||||
(*rspinfo)["open_id"] = openId
|
|
||||||
(*rspinfo)["account_address"] = jsonRspObj.Decoded.Passport.ZkevmEthAddress
|
|
||||||
(*rspinfo)["email"] = jsonRspObj.Decoded.Email
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *jwtauth) internalMetaMaskJwtAuth(jwtToken string, rspinfo *map[string]interface{}) {
|
|
||||||
params := map[string]string{
|
|
||||||
"c": "MetaMaskJwt",
|
|
||||||
"a": "verify",
|
|
||||||
}
|
|
||||||
jsonReqObj := &struct {
|
|
||||||
Data string `json:"data"`
|
|
||||||
}{
|
|
||||||
Data: jwtToken,
|
|
||||||
}
|
|
||||||
jsonRspObj := &struct {
|
|
||||||
ErrCode interface{} `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
Decoded struct {
|
|
||||||
Id string `json:"id"`
|
|
||||||
OpenId string `json:"openid"`
|
|
||||||
Plat int32 `json:"plat"`
|
|
||||||
Version int32 `json:"version"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
} `json:"decoded"`
|
|
||||||
}{}
|
|
||||||
rspObj := &struct {
|
|
||||||
ErrCode interface{} `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
}{}
|
|
||||||
paramsStr := q5.EncodeJson(jsonReqObj)
|
|
||||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3ServiceCluster.RandElement().GetUrl())
|
|
||||||
f5.GetHttpCliMgr().SendGoStyleJsonRspPost(
|
|
||||||
url,
|
|
||||||
params,
|
|
||||||
jsonRspObj,
|
|
||||||
q5.HTTP_HEADER_JSON,
|
|
||||||
paramsStr,
|
|
||||||
func(rsp f5.HttpCliResponse) {
|
|
||||||
if rsp.GetErr() != nil ||
|
|
||||||
!rsp.JsonParseOk() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
|
|
||||||
rspObj.ErrMsg = jsonRspObj.ErrMsg
|
|
||||||
if q5.SafeToInt32(rspObj.ErrCode) != 0 {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if jsonRspObj.Decoded.Plat != jccommon.BC_POLY_POLY_METAKASK {
|
|
||||||
f5.GetSysLog().Info("not support this platform:%s", rsp.GetRawData())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
openId := fmt.Sprintf("%d_2006_%s",
|
|
||||||
jccommon.BC_CHANNEL,
|
|
||||||
strings.ToLower(jsonRspObj.Decoded.OpenId))
|
|
||||||
(*rspinfo)["open_id"] = openId
|
|
||||||
(*rspinfo)["account_address"] = strings.ToLower(jsonRspObj.Decoded.OpenId)
|
|
||||||
(*rspinfo)["email"] = strings.ToLower(jsonRspObj.Decoded.Email)
|
|
||||||
})
|
|
||||||
}
|
|
@ -10,48 +10,33 @@ import (
|
|||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BattleItem struct {
|
|
||||||
ItemId int32 `json:"item_id"`
|
|
||||||
ItemNum int32 `json:"item_num"`
|
|
||||||
ItemType int32 `json:"item_type"`
|
|
||||||
ItemSubType int32 `json:"item_sub_type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserInfo struct {
|
|
||||||
//Activated string `json:"activated"`
|
|
||||||
//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"`
|
|
||||||
VipLv interface{} `json:"vip_lv"`
|
|
||||||
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"`
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type LoginRsp struct {
|
type LoginRsp struct {
|
||||||
Errcode int `json:"errcode"`
|
Errcode int `json:"errcode"`
|
||||||
Errmsg string `json:"errmsg"`
|
Errmsg string `json:"errmsg"`
|
||||||
Info struct {
|
Info struct {
|
||||||
UserInfo UserInfo `json:"user_info"`
|
UserInfo struct {
|
||||||
HeroInfo HeroInfo `json:"hero_info"`
|
Activated string `json:"activated"`
|
||||||
|
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"`
|
||||||
MapInfo *MapInfoRsp `json:"map_info"`
|
MapInfo *MapInfoRsp `json:"map_info"`
|
||||||
} `json:"info"`
|
} `json:"info"`
|
||||||
}
|
}
|
||||||
@ -60,8 +45,29 @@ type UserRsp struct {
|
|||||||
Errcode int `json:"errcode"`
|
Errcode int `json:"errcode"`
|
||||||
Errmsg string `json:"errmsg"`
|
Errmsg string `json:"errmsg"`
|
||||||
Info struct {
|
Info struct {
|
||||||
UserInfo UserInfo `json:"user_info"`
|
UserInfo struct {
|
||||||
HeroInfo HeroInfo `json:"hero_info"`
|
Activated string `json:"activated"`
|
||||||
|
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +93,30 @@ type UpdateBattleInfoRsp struct {
|
|||||||
Errcode int `json:"errcode"`
|
Errcode int `json:"errcode"`
|
||||||
Errmsg string `json:"errmsg"`
|
Errmsg string `json:"errmsg"`
|
||||||
Info struct {
|
Info struct {
|
||||||
UserInfo UserInfo `json:"user_info"`
|
UserInfo struct {
|
||||||
HeroInfo HeroInfo `json:"hero_info"`
|
Activated string `json:"activated"`
|
||||||
|
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +178,6 @@ type Player interface {
|
|||||||
IsBattling() bool
|
IsBattling() bool
|
||||||
SetBattling(bool)
|
SetBattling(bool)
|
||||||
GenNextCopy() Player
|
GenNextCopy() Player
|
||||||
GetBattleItems() []*BattleItem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -41,13 +41,3 @@ 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,7 +49,6 @@ 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,9 +94,6 @@ 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) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,14 +213,6 @@ 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)
|
||||||
}
|
}
|
||||||
@ -325,12 +313,6 @@ 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)
|
||||||
@ -507,18 +489,6 @@ 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,7 +30,6 @@ 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,7 +6,6 @@ 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"
|
||||||
@ -45,11 +44,6 @@ 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) {
|
||||||
@ -58,39 +52,29 @@ 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.parseUserInfo(&rsp.Info.UserInfo)
|
this.name = rsp.Info.UserInfo.Name
|
||||||
this.parseHeroInfo(&rsp.Info.HeroInfo)
|
this.avatarUrl = rsp.Info.UserInfo.HeadId
|
||||||
|
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){
|
||||||
@ -99,8 +83,23 @@ 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.parseUserInfo(&rsp.Info.UserInfo)
|
this.name = rsp.Info.UserInfo.Name
|
||||||
this.parseHeroInfo(&rsp.Info.HeroInfo)
|
this.avatarUrl = rsp.Info.UserInfo.HeadId
|
||||||
|
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 {
|
||||||
@ -208,19 +207,6 @@ 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)
|
||||||
@ -252,22 +238,6 @@ 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) {
|
||||||
@ -462,8 +432,23 @@ 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.parseUserInfo(&rspObj.Info.UserInfo)
|
this.name = rspObj.Info.UserInfo.Name
|
||||||
this.parseHeroInfo(&rspObj.Info.HeroInfo)
|
this.avatarUrl = rspObj.Info.UserInfo.HeadId
|
||||||
|
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()
|
||||||
}
|
}
|
||||||
@ -501,9 +486,25 @@ func (this *player) updateChoose(skillId int32, heroUniId string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
this.parseUserInfo(&rspObj.Info.UserInfo)
|
this.name = rspObj.Info.UserInfo.Name
|
||||||
this.parseHeroInfo(&rspObj.Info.HeroInfo)
|
this.avatarUrl = rspObj.Info.UserInfo.HeadId
|
||||||
|
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, "")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -569,88 +570,6 @@ 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
|
||||||
}
|
}
|
||||||
@ -659,12 +578,7 @@ 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,7 +21,6 @@ enum CMMessageId_e
|
|||||||
_CMChooseHero = 116;
|
_CMChooseHero = 116;
|
||||||
_CMChooseMap = 117;
|
_CMChooseMap = 117;
|
||||||
_CMRefreshUser = 118;
|
_CMRefreshUser = 118;
|
||||||
_CMChooseBattleItem = 119;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SMMessageId_e
|
enum SMMessageId_e
|
||||||
@ -42,7 +41,6 @@ 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,13 +122,6 @@ 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
|
||||||
{
|
{
|
||||||
@ -148,10 +141,6 @@ 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; //带入战斗的道具
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//队伍信息
|
//队伍信息
|
||||||
@ -343,18 +332,6 @@ 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 q5.SafeToInt32(this.mapInfo.ModeId)
|
return this.mapInfo.MapId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) GetZnKey() int64 {
|
func (this *team) GetZnKey() int64 {
|
||||||
@ -385,8 +385,6 @@ 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 {
|
||||||
@ -438,7 +436,6 @@ 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