github.com/bububa/oceanengine/marketing-api@v0.0.0-20210315120513-0b953137f7a6/model/advertiser/fund_transaction_get.go (about)

     1  package advertiser
     2  
     3  import (
     4  	"net/url"
     5  	"strconv"
     6  	"time"
     7  
     8  	"github.com/bububa/oceanengine/marketing-api/enum"
     9  	"github.com/bububa/oceanengine/marketing-api/model"
    10  )
    11  
    12  type FundTransactionGetRequest struct {
    13  	AdvertiserID    uint64               `json:"advertiser_id,omitempty"`
    14  	StartDate       time.Time            `json:"start_date,omitempty"`       // 开始时间,格式YYYY-MM-DD,默认当前年份的1月1日
    15  	EndDate         time.Time            `json:"end_date,omitempty"`         // 结束时间,格式YYYY-MM-DD,默认为今天
    16  	TransactionType enum.TransactionType `json:"transaction_type,omitempty"` // 流水类型
    17  	Page            int                  `json:"page,omitempty"`             // 页码. 默认值: 1
    18  	PageSize        int                  `json:"page_size,omitempty"`        // 页面数据量. 默认值: 10
    19  }
    20  
    21  func (r FundTransactionGetRequest) Encode() string {
    22  	values := &url.Values{}
    23  	values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
    24  	values.Set("start_date", r.StartDate.Format("2006-01-02"))
    25  	values.Set("end_date", r.EndDate.Format("2006-01-02"))
    26  	values.Set("transaction_type", string(r.TransactionType))
    27  	if r.Page > 0 {
    28  		values.Set("page", strconv.Itoa(r.Page))
    29  	}
    30  	if r.PageSize > 0 {
    31  		values.Set("page_size", strconv.Itoa(r.PageSize))
    32  	}
    33  	return values.Encode()
    34  }
    35  
    36  type FundTransactionGetResponse struct {
    37  	model.BaseResponse
    38  	Data *FundTransactionGetResponseData `json:"data,omitempty"`
    39  }
    40  
    41  type FundTransactionGetResponseData struct {
    42  	List []FundTransactionGetResponseList `json:"list,omitempty"`
    43  }
    44  
    45  type FundTransactionGetResponseList struct {
    46  	AdvertiserID    uint64               `json:"advertiser_id,omitempty"`    // 广告主ID
    47  	TransactionType enum.TransactionType `json:"transaction_type,omitempty"` // 流水类型
    48  	CreateTime      string               `json:"create_time,omitempty"`      // 流水产生时间
    49  	Amount          float64              `json:"amount,omitempty"`           // 交易总金额(单位元)
    50  	Cash            float64              `json:"cash,omitempty"`             // 现金总金额(单位元)
    51  	Frozen          float64              `json:"frozen,omitempty"`           // 冻结(单位元)
    52  	Grant           float64              `json:"grant,omitempty"`            // 赠款总金额(单位元)
    53  	ReturnGoods     float64              `json:"return_goods,omitempty"`     // 返货总金额(单位元)
    54  	TransactionSeq  uint64               `json:"transaction_seq,omitempty"`  // 交易流水号
    55  	Remitter        uint64               `json:"remitter,omitempty"`         // 付款方,即广告主id。
    56  	Payee           uint64               `json:"payee,omitempty"`            // 收款方,即广告主id。
    57  	Dealbase        float64              `json:"dealbase,omitempty"`         // 返点
    58  }