You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
61 lines
1.9 KiB
package finance
|
|
|
|
import (
|
|
"context"
|
|
"git.oa00.com/supply-chain/service/client"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type wallet struct {
|
|
}
|
|
|
|
type ArgsWalletDetail struct {
|
|
Year uint // 年份
|
|
Month uint // 月份
|
|
}
|
|
|
|
type WalletItem struct {
|
|
CustomerName string `json:"customerName"` // 客户名称
|
|
CreatedAt int64 `json:"createdAt"` // 交易时间
|
|
Type uint `json:"type"` // 交易类型
|
|
Amount decimal.Decimal `json:"amount"` // 交易金额
|
|
AfterAmount decimal.Decimal `json:"afterAmount"` // 交易后余额
|
|
TradeChannel string `json:"tradeChannel"` // 交易渠道
|
|
TradeSerialSn string `json:"tradeSerialSn"` // 交易流水号
|
|
Remark string `json:"remark"` // 交易备注
|
|
}
|
|
|
|
// WalletDetail @Title 余额统计
|
|
func (w *wallet) WalletDetail(ctx context.Context, args ArgsWalletDetail) (reply []WalletItem, err error) {
|
|
xClient, err := client.GetClient(w)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
err = xClient.Call(ctx, "WalletDetail", args, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsUserWallet struct {
|
|
Year uint // 年份
|
|
Month uint // 月份
|
|
}
|
|
|
|
type UserWalletItem struct {
|
|
CustomerName string `json:"customerName"`
|
|
BeforeAmount decimal.Decimal `json:"beforeAmount"` // 期初余额
|
|
AfterAmount decimal.Decimal `json:"afterAmount"` // 期末余额
|
|
ConsumeAmount decimal.Decimal `json:"consumeAmount"` // 消费金额
|
|
ReturnAmount decimal.Decimal `json:"returnAmount"` // 退款金额
|
|
RechargeAmount decimal.Decimal `json:"rechargeAmount"` // 充值金额
|
|
}
|
|
|
|
// UserWallet @Title 客户余额
|
|
func (w *wallet) UserWallet(ctx context.Context, args ArgsWalletDetail) (reply []UserWalletItem, err error) {
|
|
xClient, err := client.GetClient(w)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
err = xClient.Call(ctx, "UserWallet", args, &reply)
|
|
return
|
|
}
|