From 4844f494c6afdf5e033bc83c0d2a4ffa70e40b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 24 Jun 2026 09:34:16 +0800 Subject: [PATCH] 1 --- platformapi/ebaiapi/im_test.go | 2 +- platformapi/ebaiapi/invoice.go | 40 ++++++++++++++++++++++++++++++++-- platformapi/platformapi.go | 1 + 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/platformapi/ebaiapi/im_test.go b/platformapi/ebaiapi/im_test.go index d49fef24..a534a863 100644 --- a/platformapi/ebaiapi/im_test.go +++ b/platformapi/ebaiapi/im_test.go @@ -45,7 +45,7 @@ func TestInvoice(t *testing.T) { } func TestQueryUnansweredInvoice(t *testing.T) { - api.QueryUnansweredInvoice("1306214718") + api.QueryUnansweredInvoice("32267184083") } func TestBathUpdateInvoiceSetting(t *testing.T) { diff --git a/platformapi/ebaiapi/invoice.go b/platformapi/ebaiapi/invoice.go index 0e2ef993..b21c51e4 100644 --- a/platformapi/ebaiapi/invoice.go +++ b/platformapi/ebaiapi/invoice.go @@ -200,7 +200,7 @@ type ResultList struct { } // QueryUnansweredInvoice 查询门店未回复发票信息 -func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoiceResult, error) { +func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoiceResult2, error) { data, err := a.AccessAPI("invoice.apply.list", map[string]interface{}{ "baidu_shop_id": baiDuStoreId, "status": "INIT", @@ -213,7 +213,7 @@ func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoi if data.ErrNo != 0 { return nil, fmt.Errorf(data.Error) } - result := &QueryUnansweredInvoiceResult{} + result := &QueryUnansweredInvoiceResult2{} if err = utils.UnmarshalUseNumber(utils.MustMarshal(data.Data), result); err != nil { return nil, err } @@ -230,6 +230,42 @@ type QueryUnansweredInvoiceResult struct { // InvoiceApplyBody 用户申请发票body 消息推送接口 type InvoiceApplyBody struct { + ApplicationNo string `json:"application_no"` // 申请单编号 + BaiduShopId string `json:"baidu_shop_id"` // 平台门店ID,与合作方门店ID至少有一个 + ShopId string `json:"shop_id"` // 合作方门店ID,与平台门店ID 至少有一个 + InvoiceMaterial string `json:"invoice_material"` // 发票材质 + InvoiceClass string `json:"invoice_class"` // 发票种类 + Status string `json:"status"` // 申请状态,目前仅支持 + BuyerTitle struct { + BankAccount string `json:"bank_account"` // 开户行账号 + BankName string `json:"bank_name"` // 开户行名称 + RegisterAddress string `json:"register_address"` // 注册地址 + RegisterPhone string `json:"register_phone"` // 注册地址 + TaxPayerNum string `json:"tax_payer_num"` // 纳税人识别号 + TitleName string `json:"title_name"` // 抬头名称 + TitleType string `json:"title_type"` // 抬头类型 + } `json:"buyer_title"` // 购方信息 + OrderList []struct { + CreateTime int64 `json:"create_time"` + InvoiceAmount float64 `json:"invoice_amount"` + OrderId string `json:"order_id"` + } `json:"order_list"` + BuyerContact struct { + Email string `json:"email"` // 邮箱 + } `json:"buyer_contact"` // 购方用户联系信息 + TotalInvoiceAmount float64 `json:"total_invoice_amount"` // 开票总金额,单位元 +} + +type QueryUnansweredInvoiceResult2 struct { + PageNo int `json:"page_no"` // 页码 + PageSize int `json:"page_size"` // 每页条数 + TotalCount int `json:"total_count"` // 总条数 + TotalPage int `json:"total_page"` // 总页数 + RecordList []*InvoiceApplyBody2 `json:"record_list"` // 申请单列表 +} + +// InvoiceApplyBody2 用户申请发票body 消息推送接口 +type InvoiceApplyBody2 struct { ApplicationNo string `json:"application_no"` // 申请单编号 BaiduShopId string `json:"baidu_shop_id"` // 平台门店ID,与合作方门店ID至少有一个 ShopId string `json:"shop_id"` // 合作方门店ID,与平台门店ID 至少有一个 diff --git a/platformapi/platformapi.go b/platformapi/platformapi.go index 44b2752f..61f636d7 100644 --- a/platformapi/platformapi.go +++ b/platformapi/platformapi.go @@ -193,6 +193,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http. bodyMap = map[string]interface{}{ KeyData: bodyGeneral, } + } errLevel, err = handleResponse(response, string(bodyData), bodyMap) if err != nil && errLevel == ErrLevelRecoverableErr && parseJSONErr != nil {