diff --git a/bin/backtask/config/nets.json b/bin/backtask/config/nets.json index a7adca83..b24a077c 100644 --- a/bin/backtask/config/nets.json +++ b/bin/backtask/config/nets.json @@ -1,6 +1,6 @@ [ 97, - 42161, + 421614, 13473, 11155111 ] diff --git a/bin/backtask/config/nets/42161/contract.json b/bin/backtask/config/nets/421614/contract.json similarity index 100% rename from bin/backtask/config/nets/42161/contract.json rename to bin/backtask/config/nets/421614/contract.json diff --git a/bin/marketserver/config/currencys/42161/currency.json b/bin/marketserver/config/currencys/421614/currency.json similarity index 100% rename from bin/marketserver/config/currencys/42161/currency.json rename to bin/marketserver/config/currencys/421614/currency.json diff --git a/server/marketserver/api/v1/activity/bitget.go b/server/marketserver/api/v1/activity/bitget.go index c06363c7..b2b24ea4 100644 --- a/server/marketserver/api/v1/activity/bitget.go +++ b/server/marketserver/api/v1/activity/bitget.go @@ -19,5 +19,6 @@ func (this *BitGetApi) NewUserMission(c *gin.Context) { q5.NewSlice(&rspObj.Missions, 0, 10) p := q5.NewSliceElement(&rspObj.Missions) p.MissionId = 1 + p.Target = 5 c.JSON(200, rspObj) } diff --git a/server/marketserver/api/v1/activity/contribution.go b/server/marketserver/api/v1/activity/contribution.go index 2c81fc4c..8c7c7c37 100644 --- a/server/marketserver/api/v1/activity/contribution.go +++ b/server/marketserver/api/v1/activity/contribution.go @@ -37,7 +37,7 @@ func (cta *ContriApi) HistoryQuery(c *gin.Context) { Rows []*info `json:"rows"` }{} - mycp, _ := service.Contribution.GetAddressContribution(account) + mycp, _ := service.Contribution.GetAddressContribution(account, false) rspObj.CP = fmt.Sprintf("%.2f", mycp) q5.NewSlice(&rspObj.Rows, 0, 10) @@ -141,7 +141,7 @@ func (cta *ContriApi) CECQuery(c *gin.Context) { }{} totalgcp, _ := service.Contribution.GetGlobalContribution(false) - mycp, _ := service.Contribution.GetAddressContribution(account) + mycp, _ := service.Contribution.GetAddressContribution(account, false) rspObj.CP = fmt.Sprintf("%.2f", mycp) rspObj.Info.MyCP = rspObj.CP rspObj.Info.GCP = fmt.Sprintf("%.2f", totalgcp) diff --git a/server/marketserver/api/v1/recharge/recharge.go b/server/marketserver/api/v1/recharge/recharge.go index 9eaad0e7..43da1fd6 100644 --- a/server/marketserver/api/v1/recharge/recharge.go +++ b/server/marketserver/api/v1/recharge/recharge.go @@ -35,7 +35,7 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) { return } - if contribution, err := service.Contribution.GetAddressContribution(accountAddress); err != nil { + if contribution, err := service.Contribution.GetAddressContribution(accountAddress, true); err != nil { f5.RspErr(c, 2, "server internal error") return } else { @@ -50,8 +50,8 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) { tmpmap["price"] = tb.GetPrice() tmpmap["max_buy_times"] = tb.GetMaxBuyTimes() tmpmap["can_email_buy"] = tb.GetCanEmailBuy() - currencyList := []struct{ - Name string `json:"name"` + currencyList := []struct { + Name string `json:"name"` Address string `json:"address"` }{} currencysMeta.Range( @@ -114,6 +114,8 @@ func (this *RechargeApi) BuyWithEmail(c *gin.Context) { func (this *RechargeApi) internalBuy(c *gin.Context, netId int32, goodsId int32, goodsNum int32, accountAddress string, passportAddress string, email string, currencyAddress string) { + accountAddress = strings.ToLower(accountAddress) + passportAddress = strings.ToLower(passportAddress) currencyMeta := mt.Table.Currency.GetByNetIdAddress(netId, currencyAddress) if currencyMeta == nil { f5.RspErr(c, 2, "server internal error") diff --git a/server/marketserver/api/v1/user/user.go b/server/marketserver/api/v1/user/user.go index 360c30e2..c73085ae 100644 --- a/server/marketserver/api/v1/user/user.go +++ b/server/marketserver/api/v1/user/user.go @@ -26,7 +26,7 @@ func (this *UserApi) Info(c *gin.Context) { Diamond string `json:"diamond"` }{} rspObj.Email = c.MustGet("email").(string) - contributionPoint, _ := service.Contribution.GetAddressContribution(accountAddress) + contributionPoint, _ := service.Contribution.GetAddressContribution(accountAddress, false) var gold float64 var diamond float64 { diff --git a/server/marketserver/middleware/jwtauth.go b/server/marketserver/middleware/jwtauth.go index 9d5de398..1a739f25 100644 --- a/server/marketserver/middleware/jwtauth.go +++ b/server/marketserver/middleware/jwtauth.go @@ -160,9 +160,10 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) { } if jsonRspObj.Decoded.Plat != jccommon.BC_POLY_POLY_METAKASK { rspObj.ErrCode = 501 - rspObj.ErrMsg = "not summport platform" + rspObj.ErrMsg = "not support this platform" c.JSON(200, rspObj) c.Abort() + f5.GetSysLog().Info("not support this platform:%s", rsp.GetRawData()) return } openId := fmt.Sprintf("%d_2006_%s", diff --git a/server/marketserver/service/contribution.go b/server/marketserver/service/contribution.go index 40e41558..29eeacd4 100644 --- a/server/marketserver/service/contribution.go +++ b/server/marketserver/service/contribution.go @@ -2,17 +2,20 @@ package service import ( "f5" + "fmt" "main/constant" "q5" + "time" ) type accountContricution struct { - history float64 - loadhistory bool - contribution float64 - gcTime int64 - loweremail string - accountid string + history float64 + loadhistory bool + contribution float64 + rechargeContri float64 + gcTime int64 + loweremail string + accountid string } type contribution struct { @@ -25,6 +28,7 @@ type contribution struct { func (this *contribution) init() { this.accountContricutionlist = q5.ConcurrentMap[string, *accountContricution]{} + go this.checkContributionList() } func (this *contribution) unInit() { @@ -40,7 +44,7 @@ func (this *contribution) GetEmailAccountId(accountAddress string) (string, stri return "", "" } -func (this *contribution) GetAddressContribution(accountAddress string) (float64, error) { +func (this *contribution) GetAddressContribution(accountAddress string, onlyrecharge bool) (float64, error) { accinfo, exist := this.accountContricutionlist.Load(accountAddress) var beforcontribution float64 = 0 if nowseconds := f5.GetApp().GetRealSeconds(); !exist || (*accinfo).gcTime+60 < nowseconds { @@ -158,6 +162,7 @@ func (this *contribution) GetAddressContribution(accountAddress string) (float64 if ds.Next() { tmp, _ := q5.ToFloat64Ex(ds.GetByIndex(0)) (*accinfo).contribution += tmp + (*accinfo).rechargeContri = tmp } }) } @@ -170,6 +175,10 @@ func (this *contribution) GetAddressContribution(accountAddress string) (float64 this.GetGlobalContribution(true) } + if onlyrecharge { + return (*accinfo).rechargeContri, nil + } + return (*accinfo).contribution, nil } @@ -244,3 +253,24 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) { return this.globalContribution, nil } + +func (this *contribution) checkContributionList() { + fmt.Println("checkContributionList start") + for { + if time.Now().UTC().Hour() == 0 { + nowseconds := f5.GetApp().GetRealSeconds() + deletelist := []string{} + this.accountContricutionlist.Range(func(key string, value *accountContricution) bool { + if value.gcTime+86400 < nowseconds { + deletelist = append(deletelist, key) + } + return true + }) + + for _, account := range deletelist { + this.accountContricutionlist.Delete(account) + } + } + time.Sleep((time.Second * 1800)) + } +} diff --git a/server/marketserver/service/recharge.go b/server/marketserver/service/recharge.go index 0c6d4c2e..65043737 100644 --- a/server/marketserver/service/recharge.go +++ b/server/marketserver/service/recharge.go @@ -3,6 +3,7 @@ package service import ( "q5" "f5" + "strings" "main/constant" ) @@ -31,6 +32,7 @@ func AddRechargeOrder(orderId string, shortOrderId string, } if email != "" { q5.AppendSlice(&fields, []string{"email", email}) + q5.AppendSlice(&fields, []string{"lower_case_email", strings.ToLower(email)}) } f5.GetGoStyleDb().UpsertEx( constant.BCNFT_DB,