54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
package response
|
|
|
|
import (
|
|
"encoding/json"
|
|
"psi/models"
|
|
)
|
|
|
|
// SplitAccountDeductionLogListResponse 分账扣钱日志列表响应
|
|
type SplitAccountDeductionLogListResponse struct {
|
|
List []SplitAccountDeductionLogItem `json:"list"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
}
|
|
|
|
// SplitAccountDeductionLogItem 分账扣钱日志列表项
|
|
type SplitAccountDeductionLogItem struct {
|
|
ID int64 `json:"id"`
|
|
BusinessNo string `json:"business_no"`
|
|
ConfigID int64 `json:"config_id"`
|
|
ConfigName string `json:"config_name"`
|
|
DeductionDetails interface{} `json:"deduction_details"`
|
|
TotalAmount float64 `json:"total_amount"`
|
|
DeductionAmount float64 `json:"deduction_amount"`
|
|
RemainingAmount float64 `json:"remaining_amount"`
|
|
CreatedBy string `json:"created_by"`
|
|
UpdatedBy string `json:"updated_by"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
// ConvertSplitAccountDeductionLogToItem 将模型转换为响应项
|
|
func ConvertSplitAccountDeductionLogToItem(log models.SplitAccountDeductionLog) SplitAccountDeductionLogItem {
|
|
var deductionDetails interface{}
|
|
if log.DeductionDetails != nil {
|
|
json.Unmarshal(log.DeductionDetails, &deductionDetails)
|
|
}
|
|
|
|
return SplitAccountDeductionLogItem{
|
|
ID: log.ID,
|
|
BusinessNo: log.BusinessNo,
|
|
ConfigID: log.ConfigID,
|
|
ConfigName: log.ConfigName,
|
|
DeductionDetails: deductionDetails,
|
|
TotalAmount: log.TotalAmount,
|
|
DeductionAmount: log.DeductionAmount,
|
|
RemainingAmount: log.RemainingAmount,
|
|
CreatedBy: log.CreatedBy,
|
|
UpdatedBy: log.UpdatedBy,
|
|
CreatedAt: log.CreatedAt,
|
|
UpdatedAt: log.UpdatedAt,
|
|
}
|
|
}
|