1
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
"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"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"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/business/partner/im"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"time"
|
"time"
|
||||||
@@ -37,6 +38,7 @@ func (p *PurchaseHandler) InvoiceApply(msg *ebaiapi.CallbackMsg) (response *ebai
|
|||||||
applyNo = ""
|
applyNo = ""
|
||||||
storeId = ""
|
storeId = ""
|
||||||
vendorStoreId = ""
|
vendorStoreId = ""
|
||||||
|
orderId = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
switch msg.Cmd {
|
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 {
|
if err := utils.Map2StructByJson(msg.Body, invoice, false); err != nil {
|
||||||
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, msg.Cmd)
|
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))
|
invoiceData, _ := dao.GetInvoiceInfo(db, utils.Int64ToStr(invoice.OrderList[0].OrderId))
|
||||||
applyNo = invoice.ApplicationNo
|
applyNo = invoice.ApplicationNo
|
||||||
storeId = invoice.ShopId
|
storeId = invoice.ShopId
|
||||||
@@ -95,12 +98,20 @@ func (p *PurchaseHandler) InvoiceApply(msg *ebaiapi.CallbackMsg) (response *ebai
|
|||||||
invoiceData.UpdatedAt = time.Now()
|
invoiceData.UpdatedAt = time.Now()
|
||||||
invoiceData.Email = invoice.Email
|
invoiceData.Email = invoice.Email
|
||||||
dao.UpdateEntity(db, invoiceData, "UpdatedAt", "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 {
|
if orderId != "" {
|
||||||
im.PushMsgByCid(vendorStoreId, model.VendorIDEBAI, content2)
|
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)
|
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, nil, msg.Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ func InvoiceCallback(invoice *mtwmapi.InvoiceCallback) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content2 := fmt.Sprintf("订单:%s,用户申请发票,请老板提供发票信息!", localOrder.VendorOrderID)
|
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)
|
im.PushMsgByCid(localOrder.VendorStoreID, localOrder.VendorID, content2)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user