Skip to content

Commit

Permalink
Merge branch 'master' into feat/support-miningpool
Browse files Browse the repository at this point in the history
  • Loading branch information
Geapefurit committed Oct 25, 2024
2 parents 85d5627 + 167ed5f commit 9ccbc12
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cmd/account-gateway/k8s/04-traefik-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
http: *http_rules
- host: api.jh-testing.npool.top
http: *http_rules
- host: api.harbin-testing.npool.top
http: *http_rules
- host: api.japan-procyon-production.npool.top
http: *http_rules
- host: api.hk-cryptomore-production.npool.top
Expand Down Expand Up @@ -107,6 +109,8 @@ spec:
http: *http_rules
- host: api.jh-testing.npool.top
http: *http_rules
- host: api.harbin-testing.npool.top
http: *http_rules
- host: api.japan-procyon-production.npool.top
http: *http_rules
- host: api.hk-cryptomore-production.npool.top
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI=
github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q=
Expand Down
1 change: 1 addition & 0 deletions pkg/goodbenefit/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (h *queryHandler) formalize() {
ID: info.ID,
EntID: info.EntID,
GoodID: info.GoodID,
GoodType: good.GoodType,
GoodName: good.Name,
CoinTypeID: info.CoinTypeID,
CoinName: coin.Name,
Expand Down
30 changes: 30 additions & 0 deletions pkg/user/accountcreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import (
"context"
"fmt"

"github.com/NpoolPlatform/go-service-framework/pkg/logger"
"github.com/NpoolPlatform/go-service-framework/pkg/pubsub"
npool "github.com/NpoolPlatform/message/npool/account/gw/v1/user"
eventmwpb "github.com/NpoolPlatform/message/npool/inspire/mw/v1/event"

usermwcli "github.com/NpoolPlatform/appuser-middleware/pkg/client/user"
coininfocli "github.com/NpoolPlatform/chain-middleware/pkg/client/coin"
Expand All @@ -29,6 +32,31 @@ type createHandler struct {
checkAddressBalance bool
}

func (h *createHandler) rewardSetAddress() {
if err := pubsub.WithPublisher(func(publisher *pubsub.Publisher) error {
req := &eventmwpb.CalcluateEventRewardsRequest{
AppID: *h.AppID,
UserID: *h.UserID,
EventType: basetypes.UsedFor_SetAddress,
Consecutive: 1,
}
return publisher.Update(
basetypes.MsgID_CalculateEventRewardReq.String(),
nil,
nil,
nil,
req,
)
}); err != nil {
logger.Sugar().Errorw(
"rewardSetAddress",
"AppID", *h.AppID,
"UserID", h.UserID,
"Error", err,
)
}
}

func (h *createHandler) validate(ctx context.Context) error { //nolint
switch *h.AccountType {
case basetypes.SignMethod_Email:
Expand Down Expand Up @@ -169,5 +197,7 @@ func (h *Handler) CreateAccount(ctx context.Context) (*npool.Account, error) {
return nil, err
}

handler.rewardSetAddress()

return h.GetAccount(ctx)
}
3 changes: 0 additions & 3 deletions pkg/user/depositquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ func (h *queryDepositHandler) getCoins(ctx context.Context) error {
if err != nil {
return err
}
if len(coins) == 0 {
return fmt.Errorf("invalid coin")
}

for _, coin := range coins {
h.coins[coin.CoinTypeID] = coin
Expand Down

0 comments on commit 9ccbc12

Please sign in to comment.