根据地址修复质押接口
This commit is contained in:
29
internal/handler/admin/stake_by_address_handler.go
Normal file
29
internal/handler/admin/stake_by_address_handler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"nova_task/internal/logic/admin"
|
||||
"nova_task/internal/svc"
|
||||
"nova_task/internal/types"
|
||||
)
|
||||
|
||||
// 根据地址修复质押
|
||||
func StakeByAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.StakeByAddressReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := admin.NewStakeByAddressLogic(r.Context(), svcCtx)
|
||||
err := l.StakeByAddress(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/nft_holder_update",
|
||||
Handler: admin.NftHolderUpdateHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 根据地址修复质押
|
||||
Method: http.MethodPost,
|
||||
Path: "/stake_by_address",
|
||||
Handler: admin.StakeByAddressHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 软质压手动结算
|
||||
Method: http.MethodGet,
|
||||
|
||||
Reference in New Issue
Block a user