This commit is contained in:
邹宗楠
2025-08-12 17:52:30 +08:00
parent 5c14110da0
commit 14b6c34652
9 changed files with 236 additions and 26 deletions

View File

@@ -54,6 +54,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
orderFmt += `
<CB>%s#%d</CB><BR><BR>
<C><BOLD>%s:%s</BOLD><BR></C><BR>
--------------------------------<BR>
下单时间: %s<BR>
预计送达: %s<BR>
@@ -92,6 +93,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderParams = append(orderParams,
jxutils.GetVendorName(order.VendorID),
order.OrderSeq,
order.StoreName, storeTel,
utils.Time2Str(order.OrderCreatedAt),
utils.Time2Str(expectedDeliveryTime),
order.VendorOrderID,
@@ -130,14 +132,13 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
<BOLD>实付:%s</BOLD>
--------------------------------<BR>
<C><BOLD>商品质量问题请联系:</BOLD><BR></C>
<C><BOLD>%s:%s</BOLD><BR></C><BR>
更多信息请关注官方微信: %s<BR>
<BR>
--------------------------------<BR>
--------------------------------<BR>
`
// <QR>http://weixin.qq.com/r/tkkDGzTERmk5rXB49xyk</QR>
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.StoreName, storeTel, globals.StoreName)
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), globals.StoreName)
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
}
@@ -166,6 +167,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
orderFmt += `
<CB>%s#%d</CB><BR><BR>
<BOLD>%s:%s</BOLD><BR><BR>
--------------------------------<BR>
下单时间: %s<BR>
预计送达: %s<BR>
@@ -200,6 +202,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
orderParams = append(orderParams,
jxutils.GetVendorName(order.VendorID),
order.OrderSeq,
order.StoreName, storeTel,
utils.Time2Str(order.OrderCreatedAt),
utils.Time2Str(expectedDeliveryTime),
order.VendorOrderID,
@@ -236,14 +239,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
<BR>
--------------------------------<BR>
<C><BOLD>商品质量问题请联系:</BOLD><BR></C>
<BOLD>%s:%s</BOLD><BR><BR>
更多信息请关注官方微信: %s<BR>
<BR>
--------------------------------<BR>
--------------------------------<BR>
`
// <QR>http://weixin.qq.com/r/tkkDGzTERmk5rXB49xyk</QR>
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.StoreName, storeTel, globals.StoreName)
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), globals.StoreName)
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
}

View File

@@ -2,7 +2,10 @@ package mtwm
import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/im"
beego "github.com/astaxie/beego/server/web"
"net/http"
@@ -130,3 +133,42 @@ func pushIMToGyOrPet(msg *mtwmapi.ImCallbackMsg, serverType string) {
return
}
func InvoiceCallback(invoice *mtwmapi.InvoiceCallback) (err error) {
localOrder, _ := partner.CurOrderManager.LoadOrder(invoice.OrderId, model.VendorIDMTWM)
if localOrder == nil {
return fmt.Errorf("订单不存在:%s", invoice.OrderId)
}
invoiceData, _ := dao.GetInvoiceInfo(dao.GetDB(), invoice.OrderId)
if invoiceData == nil {
invoiceObj := model.InvoiceMsg{
ModelIDCUL: model.ModelIDCUL{},
OrderId: invoice.OrderId,
StoreID: localOrder.JxStoreID,
VendorID: model.VendorIDMTWM,
InvoiceTaskId: invoice.InvoiceTaskId,
PushType: invoice.PushType,
InvoiceTitle: invoice.InvoiceTitle,
TaxpayerId: invoice.TaxpayerId,
NeedInvoiceByCategory: invoice.NeedInvoiceByCategory,
CompanyAddress: invoice.CompanyAddress,
CompanyPhone: invoice.CompanyPhone,
AccountBank: invoice.AccountBank,
AccountNumber: invoice.AccountNumber,
Email: invoice.Email,
InvoiceAmount: invoice.ItemTotalInvoiceAmount,
InvoiceUrl: "",
InvoiceId: "",
}
dao.WrapAddIDCULEntity(invoiceObj, "system")
if err = dao.CreateEntity(dao.GetDB(), invoiceObj); err != nil {
return err
}
}
content2 := fmt.Sprintf("订单:%s,用户申请发票,请老板提供发票信息!", localOrder.VendorOrderID)
if _, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团用户申请发票", content2, []int{localOrder.JxStoreID}, nil, "", model.MessageTypeStore, true, true); err != nil {
im.PushMsgByCid(localOrder.VendorStoreID, localOrder.VendorID, content2)
}
return err
}

View File

@@ -1058,3 +1058,12 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
Amount: num,
})
}
func UploadInvoice(param *model.InvoiceMsg) error {
goodsOrder, err := partner.CurOrderManager.LoadOrder(param.OrderId, param.VendorID)
if err != nil {
return err
}
return getAPI(goodsOrder.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(goodsOrder), goodsOrder.VendorStoreID).UploadInvoice(param.OrderId, param.InvoiceUrl, param.InvoiceId, param.InvoiceTaskId)
}