Files
waf-platform/EdgeAdmin/internal/web/actions/default/plans/userPlans/userAccount.go

36 lines
826 B
Go

// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build plus
package userPlans
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps"
)
type UserAccountAction struct {
actionutils.ParentAction
}
func (this *UserAccountAction) RunPost(params struct {
UserId int64
}) {
resp, err := this.RPC().UserAccountRPC().FindEnabledUserAccountWithUserId(this.AdminContext(), &pb.FindEnabledUserAccountWithUserIdRequest{UserId: params.UserId})
if err != nil {
this.ErrorPage(err)
return
}
var account = resp.UserAccount
if account == nil {
account = &pb.UserAccount{}
}
this.Data["account"] = maps.Map{
"total": account.Total,
"totalFrozen": account.TotalFrozen,
}
this.Success()
}