Merge branch 'dev' of git.kingsome.cn:server/game2006go into dev
This commit is contained in:
commit
b943c60cdd
@ -71,7 +71,7 @@ CREATE TABLE `t_login_annc` (
|
|||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `t_ingame_switch`
|
-- Table structure for table `t_game_switch`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `t_game_switch`;
|
DROP TABLE IF EXISTS `t_game_switch`;
|
||||||
@ -109,7 +109,29 @@ CREATE TABLE `t_game_annc` (
|
|||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
UNIQUE KEY `uniid` (`uniid`)
|
UNIQUE KEY `uniid` (`uniid`),
|
||||||
|
KEY `idx_begin_date` (`begin_date`),
|
||||||
|
KEY `idx_end_date` (`end_date`),
|
||||||
|
KEY `idx_begin_time` (`begin_time`),
|
||||||
|
KEY `idx_end_time` (`end_time`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `t_super_whitelist`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_super_whitelist`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_super_whitelist` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`user_identity` varchar(60) NOT NULL COMMENT 'account_id or account_address or email',
|
||||||
|
`enable` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
UNIQUE KEY `user_identity` (`user_identity`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
@ -318,6 +318,7 @@ func (this *MailApi) DelMail(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) bool {
|
func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) bool {
|
||||||
|
return true
|
||||||
if data, err := json.Marshal(list); err != nil || len(data) > 0xFF {
|
if data, err := json.Marshal(list); err != nil || len(data) > 0xFF {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 2,
|
"code": 2,
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"jccommon"
|
"jccommon"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,11 +30,13 @@ func GetAccountIdByAddress(accountAddress string) string {
|
|||||||
|
|
||||||
func GetAccountIdByEmail(email string) string {
|
func GetAccountIdByEmail(email string) string {
|
||||||
accountId := ""
|
accountId := ""
|
||||||
|
email = strings.ToLower(email)
|
||||||
|
if email != "" {
|
||||||
f5.GetGoStyleDb().OrmSelectOne(
|
f5.GetGoStyleDb().OrmSelectOne(
|
||||||
constant.ACCOUNT_DB,
|
constant.ACCOUNT_DB,
|
||||||
"t_immutable_account",
|
"t_immutable_account",
|
||||||
[][]string {
|
[][]string {
|
||||||
{"email", email},
|
{"lower_case_email", email},
|
||||||
},
|
},
|
||||||
func (err error, ds *f5.DataSet) {
|
func (err error, ds *f5.DataSet) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -43,6 +46,7 @@ func GetAccountIdByEmail(email string) string {
|
|||||||
accountId = ds.GetByName("account_id")
|
accountId = ds.GetByName("account_id")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
return accountId
|
return accountId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
|||||||
}{}
|
}{}
|
||||||
|
|
||||||
currencysMeta := mt.Table.Currency.GetByNetId(netId)
|
currencysMeta := mt.Table.Currency.GetByNetId(netId)
|
||||||
if len(currencysMeta) <= 0 {
|
if currencysMeta == nil {
|
||||||
f5.RspErr(c, 2, "server internal error")
|
f5.RspErr(c, 2, "server internal error")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -57,11 +57,14 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
}{}
|
}{}
|
||||||
for _, currency := range currencysMeta {
|
currencysMeta.Range(
|
||||||
|
func (key string, val *mt.Currency) bool {
|
||||||
|
currency := val
|
||||||
p := q5.NewSliceElement(¤cyList)
|
p := q5.NewSliceElement(¤cyList)
|
||||||
p.Name = currency.GetCurrencyName()
|
p.Name = currency.GetCurrencyName()
|
||||||
p.Address = currency.GetContract().GetAddress()
|
p.Address = currency.GetContract().GetAddress()
|
||||||
}
|
return true
|
||||||
|
})
|
||||||
tmpmap["currency_list"] = currencyList
|
tmpmap["currency_list"] = currencyList
|
||||||
|
|
||||||
rspObj.Rows = append(rspObj.Rows, tmpmap)
|
rspObj.Rows = append(rspObj.Rows, tmpmap)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"q5"
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ type Currency struct {
|
|||||||
|
|
||||||
type CurrencyTable struct {
|
type CurrencyTable struct {
|
||||||
f5.CustomMetaTable
|
f5.CustomMetaTable
|
||||||
netIdHash *q5.ConcurrentMap[int32, *Currency]
|
netIdHash *q5.ConcurrentMap[int32, *q5.ConcurrentMap[string, *Currency]]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Currency) init(currencyName string, exchangeRate int64, currencyDecimal int64) {
|
func (this *Currency) init(currencyName string, exchangeRate int64, currencyDecimal int64) {
|
||||||
@ -60,20 +61,34 @@ func (this *Currency) check() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CurrencyTable) GetByNetId(netId int32) []*Currency {
|
func (this *CurrencyTable) GetByNetId(netId int32) *q5.ConcurrentMap[string, *Currency] {
|
||||||
if v, ok := this.netIdHash.Load(netId); ok {
|
if v, ok := this.netIdHash.Load(netId); ok {
|
||||||
return []*Currency{*v}
|
return *v
|
||||||
} else {
|
} else {
|
||||||
return []*Currency{}
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CurrencyTable) GetByNetIdAddress(netId int32, currencyAddress string) *Currency {
|
func (this *CurrencyTable) GetByNetIdAddress(netId int32, currencyAddress string) *Currency {
|
||||||
|
currencysMeta := this.GetByNetId(netId)
|
||||||
|
if currencysMeta == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
var result *Currency
|
||||||
|
currencyAddress = strings.ToLower(currencyAddress)
|
||||||
|
currencysMeta.Range(
|
||||||
|
func (key string, meta *Currency) bool {
|
||||||
|
if meta.GetContract().GetAddress() == currencyAddress {
|
||||||
|
result = meta
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func (this *CurrencyTable) Load() {
|
func (this *CurrencyTable) Load() {
|
||||||
this.netIdHash = new(q5.ConcurrentMap[int32, *Currency])
|
this.netIdHash = new(q5.ConcurrentMap[int32, *q5.ConcurrentMap[string, *Currency]])
|
||||||
nets := []int32{}
|
nets := []int32{}
|
||||||
{
|
{
|
||||||
if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
|
if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
|
||||||
@ -101,7 +116,12 @@ func (this *CurrencyTable) Load() {
|
|||||||
p := new(Currency)
|
p := new(Currency)
|
||||||
p.init(currencyCfg.CurrencyName, currencyCfg.ExchangeRate, currencyCfg.CurrencyDecimal)
|
p.init(currencyCfg.CurrencyName, currencyCfg.ExchangeRate, currencyCfg.CurrencyDecimal)
|
||||||
p.check()
|
p.check()
|
||||||
this.netIdHash.Store(netId, p)
|
currencysMeta := this.GetByNetId(netId)
|
||||||
|
if currencysMeta == nil {
|
||||||
|
currencysMeta := new(q5.ConcurrentMap[string, *Currency])
|
||||||
|
this.netIdHash.Store(netId, currencysMeta)
|
||||||
|
}
|
||||||
|
currencysMeta.Store(p.GetCurrencyName(), p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,9 +129,11 @@ func (this *CurrencyTable) Load() {
|
|||||||
|
|
||||||
func (this *CurrencyTable) PostInit1() {
|
func (this *CurrencyTable) PostInit1() {
|
||||||
this.netIdHash.Range(
|
this.netIdHash.Range(
|
||||||
func (key int32, val *Currency) bool {
|
func (key int32, val *q5.ConcurrentMap[string, *Currency]) bool {
|
||||||
netId := key
|
netId := key
|
||||||
currencyMeta := val
|
val.Range(
|
||||||
|
func (key2 string, val2 *Currency) bool {
|
||||||
|
currencyMeta := val2
|
||||||
Table.Recharge.Traverse(func(ele *Recharge) bool {
|
Table.Recharge.Traverse(func(ele *Recharge) bool {
|
||||||
if int64(ele.GetPrice()) * currencyMeta.GetExchangeRate() != int64(ele.GetDiamond()) {
|
if int64(ele.GetPrice()) * currencyMeta.GetExchangeRate() != int64(ele.GetDiamond()) {
|
||||||
panic(fmt.Sprintf("Currency verifyerror net_id:%d id:%d", netId, ele.GetId()))
|
panic(fmt.Sprintf("Currency verifyerror net_id:%d id:%d", netId, ele.GetId()))
|
||||||
@ -124,5 +146,7 @@ func (this *CurrencyTable) PostInit1() {
|
|||||||
}
|
}
|
||||||
currencyMeta.contract = contractMeta
|
currencyMeta.contract = contractMeta
|
||||||
return true
|
return true
|
||||||
|
});
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user