package model import ( "github.com/smbrave/goutil" "github.com/spf13/cast" "gitlab.batiao8.com/open/gosdk/qyweixin" "time" ) var ( ApprovalRefundStatusCreated = 1 ApprovalRefundStatusPayed = 2 ApprovalTypeRefund = "refund" ApprovalTypeCheckin = "checkin" ApprovalTypeVacation = "vacation" ApprovalTpIdCheckin = "C4UCJS891Afmu1rE1Ws6cvph7YHqebWtt7KRFqh8c" ApprovalTpIdRefund = "C4UE6NT3ZE7XzER9TBk2ynHEeqA11NE2GGCuBq5yH" ApprovalTpIdVacation = "3WLJF6naF5jhnXvwisuPmE85wVMYcy1S1ZvYibkw" ) type ApprovalRefund struct { Id int64 Username string Month string SpNo string RefundType string RefundDate string RefundAmount float64 RefundRemark string ApplyTime string Status int CreateTime int64 UpdateTime int64 } func (refund *ApprovalRefund) From(d *qyweixin.ApproveDetail) { refund.SpNo = d.SpNo refund.Username = d.GetUserid() refund.ApplyTime = goutil.TimeToDateTime(d.ApplyTime) refund.Status = ApprovalRefundStatusCreated refund.RefundType = d.GetValue("报销类型") refundTime := cast.ToInt64(d.GetValue("发生时间")) refund.Month = time.Unix(refundTime, 0).Format("200601") refund.RefundDate = goutil.TimeToDateTime(refundTime) refund.RefundAmount = cast.ToFloat64(d.GetValue("报销费用")) refund.RefundRemark = d.GetValue("报销说明") }