diff --git a/database/confdb.sql b/database/confdb.sql index a3491dfa..f9941580 100644 --- a/database/confdb.sql +++ b/database/confdb.sql @@ -71,7 +71,7 @@ CREATE TABLE `t_login_annc` ( /*!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`; @@ -109,7 +109,29 @@ CREATE TABLE `t_game_annc` ( `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', 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; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/server/adminserver/api/v1/system/mail.go b/server/adminserver/api/v1/system/mail.go index 7b2c87e6..c9bd3add 100644 --- a/server/adminserver/api/v1/system/mail.go +++ b/server/adminserver/api/v1/system/mail.go @@ -318,6 +318,7 @@ func (this *MailApi) DelMail(c *gin.Context) { } func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) bool { + return true if data, err := json.Marshal(list); err != nil || len(data) > 0xFF { c.JSON(http.StatusOK, gin.H{ "code": 2, diff --git a/server/backtask/service/user.go b/server/backtask/service/user.go index ecf4ce09..ddd062bd 100644 --- a/server/backtask/service/user.go +++ b/server/backtask/service/user.go @@ -5,6 +5,7 @@ import ( "f5" "main/constant" "fmt" + "strings" "jccommon" ) @@ -29,20 +30,23 @@ func GetAccountIdByAddress(accountAddress string) string { func GetAccountIdByEmail(email string) string { accountId := "" - f5.GetGoStyleDb().OrmSelectOne( - constant.ACCOUNT_DB, - "t_immutable_account", - [][]string { - {"email", email}, - }, - func (err error, ds *f5.DataSet) { - if err != nil { - return - } - if ds.Next() { - accountId = ds.GetByName("account_id") - } - }) + email = strings.ToLower(email) + if email != "" { + f5.GetGoStyleDb().OrmSelectOne( + constant.ACCOUNT_DB, + "t_immutable_account", + [][]string { + {"lower_case_email", email}, + }, + func (err error, ds *f5.DataSet) { + if err != nil { + return + } + if ds.Next() { + accountId = ds.GetByName("account_id") + } + }) + } return accountId } diff --git a/server/marketserver/api/v1/recharge/recharge.go b/server/marketserver/api/v1/recharge/recharge.go index 3146be77..7f9881d9 100644 --- a/server/marketserver/api/v1/recharge/recharge.go +++ b/server/marketserver/api/v1/recharge/recharge.go @@ -30,7 +30,7 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) { }{} currencysMeta := mt.Table.Currency.GetByNetId(netId) - if len(currencysMeta) <= 0 { + if currencysMeta == nil { f5.RspErr(c, 2, "server internal error") return } @@ -57,11 +57,14 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) { Name string `json:"name"` Address string `json:"address"` }{} - for _, currency := range currencysMeta { - p := q5.NewSliceElement(¤cyList) - p.Name = currency.GetCurrencyName() - p.Address = currency.GetContract().GetAddress() - } + currencysMeta.Range( + func (key string, val *mt.Currency) bool { + currency := val + p := q5.NewSliceElement(¤cyList) + p.Name = currency.GetCurrencyName() + p.Address = currency.GetContract().GetAddress() + return true + }) tmpmap["currency_list"] = currencyList rspObj.Rows = append(rspObj.Rows, tmpmap) diff --git a/server/marketserver/mt/Currency.go b/server/marketserver/mt/Currency.go index 3bff6820..875e7918 100644 --- a/server/marketserver/mt/Currency.go +++ b/server/marketserver/mt/Currency.go @@ -4,6 +4,7 @@ import ( "q5" "f5" "fmt" + "strings" "main/constant" ) @@ -16,7 +17,7 @@ type Currency struct { type CurrencyTable struct { 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) { @@ -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 { - return []*Currency{*v} + return *v } else { - return []*Currency{} + return nil } } func (this *CurrencyTable) GetByNetIdAddress(netId int32, currencyAddress string) *Currency { - return nil + currencysMeta := this.GetByNetId(netId) + if currencysMeta == 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() { - this.netIdHash = new(q5.ConcurrentMap[int32, *Currency]) + this.netIdHash = new(q5.ConcurrentMap[int32, *q5.ConcurrentMap[string, *Currency]]) nets := []int32{} { if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil { @@ -101,7 +116,12 @@ func (this *CurrencyTable) Load() { p := new(Currency) p.init(currencyCfg.CurrencyName, currencyCfg.ExchangeRate, currencyCfg.CurrencyDecimal) 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,20 +129,24 @@ func (this *CurrencyTable) Load() { func (this *CurrencyTable) PostInit1() { this.netIdHash.Range( - func (key int32, val *Currency) bool { + func (key int32, val *q5.ConcurrentMap[string, *Currency]) bool { netId := key - currencyMeta := val - Table.Recharge.Traverse(func(ele *Recharge) bool { - if int64(ele.GetPrice()) * currencyMeta.GetExchangeRate() != int64(ele.GetDiamond()) { - panic(fmt.Sprintf("Currency verifyerror net_id:%d id:%d", netId, ele.GetId())) - } - return true - }) - contractMeta := Table.Contract.GetByNetIdName(netId, currencyMeta.GetCurrencyName()) - if contractMeta == nil { - panic(fmt.Sprintf("currency contract not found")) - } - currencyMeta.contract = contractMeta + val.Range( + func (key2 string, val2 *Currency) bool { + currencyMeta := val2 + Table.Recharge.Traverse(func(ele *Recharge) bool { + if int64(ele.GetPrice()) * currencyMeta.GetExchangeRate() != int64(ele.GetDiamond()) { + panic(fmt.Sprintf("Currency verifyerror net_id:%d id:%d", netId, ele.GetId())) + } + return true + }) + contractMeta := Table.Contract.GetByNetIdName(netId, currencyMeta.GetCurrencyName()) + if contractMeta == nil { + panic(fmt.Sprintf("currency contract not found")) + } + currencyMeta.contract = contractMeta + return true + }); return true }) }