package model import ( "git.u8t.cn/open/gosdk/qyweixin" "github.com/smbrave/goutil" "github.com/spf13/cast" "strings" "time" ) type ApprovalPayment struct { Id int64 Username string Month string SpNo string ApplyTime string CreateTime int64 UpdateTime int64 PaymentType string PaymentDate string PaymentAmount float64 PaymentRemark string PaymentPayer string PaymentPayee string } func (a *ApprovalPayment) From(d *qyweixin.ApproveDetail) { a.SpNo = d.SpNo a.Username = d.GetUserid() a.ApplyTime = goutil.TimeToDateTime(d.ApplyTime) paymentTime := cast.ToInt64(d.GetValue("付款日期")) a.Month = time.Unix(paymentTime, 0).Format("200601") a.PaymentType = d.GetValue("付款类型") a.PaymentPayer = d.GetValue("付款主体") a.PaymentDate = goutil.TimeToDateTime(paymentTime) a.PaymentAmount = cast.ToFloat64(d.GetValue("付款金额")) a.PaymentRemark = d.GetValue("备注说明") account := d.GetValue("收款账户") accountFields := strings.Split(account, ",") if len(accountFields) >= 3 { a.PaymentPayee = accountFields[1] } }