This commit is contained in:
邹宗楠
2025-10-24 17:53:51 +08:00
parent 9601ee8139
commit 201dea5450
2 changed files with 15 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import (
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/im"
"git.rosy.net.cn/jx-callback/globals/api"
"time"
@@ -37,6 +38,7 @@ func (p *PurchaseHandler) InvoiceApply(msg *ebaiapi.CallbackMsg) (response *ebai
applyNo = ""
storeId = ""
vendorStoreId = ""
orderId = ""
)
switch msg.Cmd {
@@ -45,6 +47,7 @@ func (p *PurchaseHandler) InvoiceApply(msg *ebaiapi.CallbackMsg) (response *ebai
if err := utils.Map2StructByJson(msg.Body, invoice, false); err != nil {
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, msg.Cmd)
}
orderId = utils.Int64ToStr(invoice.OrderList[0].OrderId)
invoiceData, _ := dao.GetInvoiceInfo(db, utils.Int64ToStr(invoice.OrderList[0].OrderId))
applyNo = invoice.ApplicationNo
storeId = invoice.ShopId
@@ -95,12 +98,20 @@ func (p *PurchaseHandler) InvoiceApply(msg *ebaiapi.CallbackMsg) (response *ebai
invoiceData.UpdatedAt = time.Now()
invoiceData.Email = invoice.Email
dao.UpdateEntity(db, invoiceData, "UpdatedAt", "Email")
orderId = invoiceData.OrderId
}
}
content2 := fmt.Sprintf("发票单号:%s,用户申请发票,请老板提供发票信息!", applyNo)
if _, err := weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团用户申请发票", content2, []int{utils.Str2Int(storeId)}, nil, "", model.MessageTypeStore, true, true); err != nil {
im.PushMsgByCid(vendorStoreId, model.VendorIDEBAI, content2)
if orderId != "" {
localOrder, _ := partner.CurOrderManager.LoadOrder(orderId, model.VendorIDEBAI)
if localOrder != nil {
content2 := fmt.Sprintf("发票单号:%s,用户申请发票,请老板提供发票信息!", applyNo)
if _, err := weixinmsg.SendStoreMessage(jxcontext.AdminCtx, fmt.Sprintf("饿了么用户申请发票:%s", localOrder.StoreName), content2, []int{utils.Str2Int(storeId)}, nil, "", model.MessageTypeStore, true, true); err != nil {
im.PushMsgByCid(vendorStoreId, model.VendorIDEBAI, content2)
}
}
}
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, nil, msg.Cmd)
}

View File

@@ -214,7 +214,7 @@ func InvoiceCallback(invoice *mtwmapi.InvoiceCallback) (err error) {
}
content2 := fmt.Sprintf("订单:%s,用户申请发票,请老板提供发票信息!", localOrder.VendorOrderID)
if _, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团用户申请发票", content2, []int{localOrder.JxStoreID}, nil, "", model.MessageTypeStore, true, true); err != nil {
if _, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, fmt.Sprintf("美团用户申请发票:%s", localOrder.StoreName), content2, []int{localOrder.JxStoreID}, nil, "", model.MessageTypeStore, true, true); err != nil {
im.PushMsgByCid(localOrder.VendorStoreID, localOrder.VendorID, content2)
}
return err