trendit
This commit is contained in:
@@ -987,6 +987,22 @@ func TranslateSoundSize(vendorID, soundPercentage int) (soundSize string) {
|
|||||||
if soundPercentage > 66 && soundPercentage <= 100 {
|
if soundPercentage > 66 && soundPercentage <= 100 {
|
||||||
soundSize = "0"
|
soundSize = "0"
|
||||||
}
|
}
|
||||||
|
} else if vendorID == model.VendorIDTrendIT {
|
||||||
|
if soundPercentage >= 0 && soundPercentage <= 20 {
|
||||||
|
soundSize = "1"
|
||||||
|
}
|
||||||
|
if soundPercentage >= 21 && soundPercentage <= 40 {
|
||||||
|
soundSize = "2"
|
||||||
|
}
|
||||||
|
if soundPercentage >= 41 && soundPercentage <= 60 {
|
||||||
|
soundSize = "3"
|
||||||
|
}
|
||||||
|
if soundPercentage >= 61 && soundPercentage <= 80 {
|
||||||
|
soundSize = "4"
|
||||||
|
}
|
||||||
|
if soundPercentage >= 81 && soundPercentage <= 100 {
|
||||||
|
soundSize = "5"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return soundSize
|
return soundSize
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ const (
|
|||||||
VendorIDZhongWu = 204 // 中午云打印
|
VendorIDZhongWu = 204 // 中午云打印
|
||||||
VendorIDJxprint = 205 // 京西打印
|
VendorIDJxprint = 205 // 京西打印
|
||||||
VendorIDXpYun = 206 // 芯烨云打印机
|
VendorIDXpYun = 206 // 芯烨云打印机
|
||||||
|
VendorIDTrendIT = 207 //大趋智能
|
||||||
VendorIDPrinterEnd = 300
|
VendorIDPrinterEnd = 300
|
||||||
|
|
||||||
VendorIDOthersBegin = 301
|
VendorIDOthersBegin = 301
|
||||||
@@ -112,6 +113,7 @@ var (
|
|||||||
VendorIDZhongWu: "ZhongWu",
|
VendorIDZhongWu: "ZhongWu",
|
||||||
VendorIDJxprint: "Jx",
|
VendorIDJxprint: "Jx",
|
||||||
VendorIDXpYun: "Xpyun",
|
VendorIDXpYun: "Xpyun",
|
||||||
|
VendorIDTrendIT: "TrendIT",
|
||||||
|
|
||||||
VendorIDQiNiuCloud: "Qiniu",
|
VendorIDQiNiuCloud: "Qiniu",
|
||||||
VendorIDJDWL: "Jdwl",
|
VendorIDJDWL: "Jdwl",
|
||||||
@@ -147,6 +149,7 @@ var (
|
|||||||
VendorIDZhongWu: "中午云",
|
VendorIDZhongWu: "中午云",
|
||||||
VendorIDJxprint: "京西云",
|
VendorIDJxprint: "京西云",
|
||||||
VendorIDXpYun: "芯烨云",
|
VendorIDXpYun: "芯烨云",
|
||||||
|
VendorIDTrendIT: "大趋智能",
|
||||||
|
|
||||||
VendorIDWXMP: "微信公众号",
|
VendorIDWXMP: "微信公众号",
|
||||||
VendorIDWXQRCode: "微信扫码",
|
VendorIDWXQRCode: "微信扫码",
|
||||||
|
|||||||
@@ -196,6 +196,11 @@ var (
|
|||||||
"打印机编号",
|
"打印机编号",
|
||||||
"不填",
|
"不填",
|
||||||
},
|
},
|
||||||
|
VendorIDTrendIT: []string{
|
||||||
|
VendorChineseNames[VendorIDTrendIT],
|
||||||
|
"打印机编号",
|
||||||
|
"打印机密钥",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
AfsReasonTypeName = map[int]string{
|
AfsReasonTypeName = map[int]string{
|
||||||
AfsReasonTypeGoodsQuality: "商品质量",
|
AfsReasonTypeGoodsQuality: "商品质量",
|
||||||
|
|||||||
@@ -1 +1,385 @@
|
|||||||
package trendit
|
package trendit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/xpyunapi"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/trenditapi"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
|
"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/globals"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
CurPrinterHandler *PrinterHandler
|
||||||
|
)
|
||||||
|
|
||||||
|
type PrinterHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) GetVendorID() int {
|
||||||
|
return model.VendorIDTrendIT
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
CurPrinterHandler = new(PrinterHandler)
|
||||||
|
partner.RegisterPrinterPlatform(CurPrinterHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) PrintMsg(ctx *jxcontext.Context, sn, copies, voice, msgContent string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
if sn != "" {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
printOrderID, err1 := api.TrendITAPI.Print(sn, msgContent, voice)
|
||||||
|
if err1 == nil && printOrderID != "" {
|
||||||
|
printerStatus, err = p.GetPrinterStatus(ctx, sn, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printerStatus = &partner.PrinterStatus{
|
||||||
|
PrintResult: partner.PrintResultNoPrinter,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return printerStatus, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, sn, id2 string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
if onlineStatus, workStatus, err := api.TrendITAPI.GetDeviceStatus(sn); err == nil {
|
||||||
|
printerStatus = &partner.PrinterStatus{
|
||||||
|
PrintResult: partner.PrintResultSuccess,
|
||||||
|
}
|
||||||
|
tempOnline := utils.Float64TwoInt(onlineStatus)
|
||||||
|
tempWork := utils.Float64TwoInt(workStatus)
|
||||||
|
if tempOnline == trenditapi.OnlineStatus && tempWork == trenditapi.WorkStatusReady {
|
||||||
|
printerStatus.PrinterStatus = partner.PrinterStatusOnlineOK
|
||||||
|
} else if tempOnline == trenditapi.OfflineStatus {
|
||||||
|
printerStatus.PrinterStatus = partner.PrinterStatusOffline
|
||||||
|
} else if tempWork == trenditapi.WorkStatusPaperLack || tempWork == trenditapi.WorkStatusOverTemperature || tempWork == trenditapi.WorkStatusPrintFail {
|
||||||
|
printerStatus.PrinterStatus = partner.PrinterStatusOnlineAbnormal
|
||||||
|
} else {
|
||||||
|
printerStatus.PrinterStatus = partner.PrinterStatusUnknown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return printerStatus, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) RegisterPrinter(ctx *jxcontext.Context, sn, key, printerName string, soreId int64) (newID1, newID2 string, err error) {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
err = api.TrendITAPI.AddPrinter(sn, key, printerName)
|
||||||
|
}
|
||||||
|
//if strings.Contains(err.Error(), "设备已绑定") {
|
||||||
|
// return "", "", errors.New("")
|
||||||
|
//}
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) UnregisterPrinter(ctx *jxcontext.Context, sn, id2 string) (err error) {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
err = api.TrendITAPI.DelPrinter([]string{sn})
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) BindPrinter(ctx *jxcontext.Context, mapData map[string]interface{}) (bindResult *partner.BindPrinterResult, err error) {
|
||||||
|
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDTrendIT])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
||||||
|
return nil, fmt.Errorf("%s打印机当前不支持扫码解绑", model.VendorChineseNames[model.VendorIDTrendIT])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder, printType string, asfOrder *model.AfsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
if len(order.Skus) == 0 {
|
||||||
|
globals.SugarLogger.Debugf("order.sku为空")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
content := ""
|
||||||
|
if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 {
|
||||||
|
content = p.getOrderContentBig(order, store.Tel1, storeDetail)
|
||||||
|
} else {
|
||||||
|
content = p.getOrderContent(order, store.Tel1, storeDetail)
|
||||||
|
}
|
||||||
|
count := 0
|
||||||
|
for {
|
||||||
|
printerStatus, err := p.PrintMsg(ctx, store.PrinterSN, "", trenditapi.VoiceNewShort, content)
|
||||||
|
if (store.PrinterFontSize == partner.PrinterFontSizeBig2 || store.PrinterFontSize == partner.PrinterFontSizeNormal2) && count < 1 {
|
||||||
|
count += 1
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
return printerStatus, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) PrintStore(ctx *jxcontext.Context, store *model.Store, storeDetail *dao.StoreDetail, vendorId int) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printType int, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
if len(order.Skus) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
content := ""
|
||||||
|
voiceType := ""
|
||||||
|
if printType == model.YES { // 取消订单
|
||||||
|
voiceType = trenditapi.VoiceCancel
|
||||||
|
} else { // 售后订单
|
||||||
|
voiceType = trenditapi.VoiceRefund
|
||||||
|
}
|
||||||
|
if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 {
|
||||||
|
content = p.getCancelOrRefundOrderContent(order, printType, storeDetail)
|
||||||
|
} else {
|
||||||
|
content = p.getCancelOrRefundOrderContentBig(order, printType, storeDetail)
|
||||||
|
}
|
||||||
|
if content == "" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.PrintMsg(ctx, store.PrinterSN, "", voiceType, content)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, sn, id2 string) (err error) {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
err = api.TrendITAPI.CleanWaitingQueue(sn)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrinterHandler) SetSound(ctx *jxcontext.Context, sn, id2, sound string) (err error) {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
err = api.TrendITAPI.SetVolume(sn, utils.Str2Int(sound))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
//正常尺寸打印模板
|
||||||
|
func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
|
||||||
|
expectedDeliveryTime := order.ExpectedDeliveredTime
|
||||||
|
if utils.IsTimeZero(expectedDeliveryTime) {
|
||||||
|
expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
|
||||||
|
}
|
||||||
|
getCode := ""
|
||||||
|
if order.VendorID == model.VendorIDEBAI {
|
||||||
|
getCode = fmt.Sprintf("<C>饿百取货码:%s</C>", jxutils.GetEbaiOrderGetCode(order))
|
||||||
|
}
|
||||||
|
order.BuyerComment = ""
|
||||||
|
if order.BuyerComment == "" {
|
||||||
|
order.BuyerComment = "客户电话: " + order.ConsigneeMobile + ",配送遇到问题,可联系18048531223取消配送单,禁止未配送直接完成订单!"
|
||||||
|
}
|
||||||
|
orderParams := []interface{}{}
|
||||||
|
orderFmt := ``
|
||||||
|
if storeDetail != nil {
|
||||||
|
if storeDetail.BrandIsPrint == model.NO {
|
||||||
|
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||||
|
if order.VendorOrgCode == "34665" {
|
||||||
|
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||||
|
} else {
|
||||||
|
orderParams = append(orderParams, storeDetail.BrandName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderFmt += `
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT>下单时间: %s</LEFT>
|
||||||
|
<LEFT>期望送达: %s</LEFT>
|
||||||
|
<LEFT>客户姓名: %s</LEFT>
|
||||||
|
<LEFT>客户电话: %s</LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>订单编号: %s</font#></LEFT><BR>
|
||||||
|
<C><font# bolder=0 height=2 width=2>%s#%d</font#>
|
||||||
|
<QR>%s</QR></C>
|
||||||
|
` + getCode + `<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>客户地址: %s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=1 width=1>客户备注:%s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=1 width=1>商品列表</font#></LEFT>
|
||||||
|
商品名` + trenditapi.StrRepeat(" ", 2) + `数量` + trenditapi.StrRepeat(" ", 3) + `单价` + trenditapi.StrRepeat(" ", 5) + `小计
|
||||||
|
` + trenditapi.StrRepeat("-", 32) + `
|
||||||
|
`
|
||||||
|
orderParams = append(orderParams,
|
||||||
|
utils.Time2Str(order.OrderCreatedAt),
|
||||||
|
utils.Time2Str(expectedDeliveryTime),
|
||||||
|
order.ConsigneeName,
|
||||||
|
order.ConsigneeMobile,
|
||||||
|
order.VendorOrderID,
|
||||||
|
jxutils.GetVendorName(order.VendorID),
|
||||||
|
order.OrderSeq,
|
||||||
|
order.VendorOrderID,
|
||||||
|
order.ConsigneeAddress,
|
||||||
|
order.BuyerComment,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, sku := range order.Skus {
|
||||||
|
orderFmt += trenditapi.FormatPrintOrderItem(sku.SkuName, sku.Count, utils.Int64ToFloat64(sku.SalePrice))
|
||||||
|
}
|
||||||
|
orderFmt += `
|
||||||
|
<LEFT>共%d种%d件商品
|
||||||
|
实付金额: %s</LEFT><BR>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
|
||||||
|
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
|
||||||
|
return fmt.Sprintf(orderFmt, orderParams...)
|
||||||
|
}
|
||||||
|
|
||||||
|
//大尺寸打印模板
|
||||||
|
func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
|
||||||
|
expectedDeliveryTime := order.ExpectedDeliveredTime
|
||||||
|
if utils.IsTimeZero(expectedDeliveryTime) {
|
||||||
|
expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
|
||||||
|
}
|
||||||
|
getCode := ""
|
||||||
|
if order.VendorID == model.VendorIDEBAI {
|
||||||
|
getCode = fmt.Sprintf("<C>饿百取货码:%s</C>", jxutils.GetEbaiOrderGetCode(order))
|
||||||
|
}
|
||||||
|
order.BuyerComment = ""
|
||||||
|
if order.BuyerComment == "" {
|
||||||
|
order.BuyerComment = "客户电话: " + order.ConsigneeMobile + ",配送遇到问题,可联系18048531223取消配送单,禁止未配送直接完成订单!"
|
||||||
|
}
|
||||||
|
orderParams := []interface{}{}
|
||||||
|
orderFmt := ``
|
||||||
|
if storeDetail != nil {
|
||||||
|
if storeDetail.BrandIsPrint == model.NO {
|
||||||
|
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||||
|
if order.VendorOrgCode == "34665" {
|
||||||
|
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||||
|
} else {
|
||||||
|
orderParams = append(orderParams, storeDetail.BrandName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderFmt += `
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>下单时间: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>期望送达: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>客户姓名: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>客户电话: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=3 width=1>订单编号: %s</font#></LEFT><BR>
|
||||||
|
<C><font# bolder=1 height=2 width=2>%s#%d</font#>
|
||||||
|
<QR>%s</QR></C>
|
||||||
|
` + getCode + `<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=1 height=2 width=1>客户地址: %s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>客户备注:%s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>商品列表</font#>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>商品名 数量 单价 小计</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||||
|
`
|
||||||
|
orderParams = append(orderParams,
|
||||||
|
utils.Time2Str(order.OrderCreatedAt),
|
||||||
|
utils.Time2Str(expectedDeliveryTime),
|
||||||
|
order.ConsigneeName,
|
||||||
|
order.ConsigneeMobile,
|
||||||
|
order.VendorOrderID,
|
||||||
|
jxutils.GetVendorName(order.VendorID),
|
||||||
|
order.OrderSeq,
|
||||||
|
order.VendorOrderID,
|
||||||
|
order.ConsigneeAddress,
|
||||||
|
order.BuyerComment,
|
||||||
|
)
|
||||||
|
|
||||||
|
for k, sku := range order.Skus {
|
||||||
|
orderFmt += trenditapi.FormatPrintOrderItemBig(sku.SkuName, sku.Count, utils.Int64ToFloat64(sku.SalePrice))
|
||||||
|
if k != len(order.Skus) {
|
||||||
|
orderFmt += `<BR>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderFmt += `
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>共%d种%d件商品</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>实付金额: %s</font#></LEFT><BR>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
|
||||||
|
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
|
||||||
|
return fmt.Sprintf(orderFmt, orderParams...)
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消/退货 正常尺寸模板
|
||||||
|
func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder, printType int, storeDetail *dao.StoreDetail) (content string) {
|
||||||
|
var orderParams []interface{}
|
||||||
|
orderFmt := ``
|
||||||
|
if storeDetail != nil {
|
||||||
|
if storeDetail.BrandIsPrint == model.NO {
|
||||||
|
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||||
|
if order.VendorOrgCode == "34665" {
|
||||||
|
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||||
|
} else {
|
||||||
|
orderParams = append(orderParams, storeDetail.BrandName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title := ``
|
||||||
|
if printType == model.YES { // 取消订单
|
||||||
|
title = `<font# bolder=1 height=2 width=2>取消订单详情</font#>`
|
||||||
|
} else { // 售后订单
|
||||||
|
title = `<font# bolder=1 height=2 width=2>退款订单详情</font#>`
|
||||||
|
}
|
||||||
|
|
||||||
|
orderFmt +=
|
||||||
|
xpyunapi.StrRepeat("-", 32) + `
|
||||||
|
<LEFT><font# bolder=1 height=1 width=1>下单时间: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>订单编号: %s</font#></LEFT><BR>
|
||||||
|
<font# bolder=1 height=2 width=2>%s#%d</font#>
|
||||||
|
` + title
|
||||||
|
orderParams = append(orderParams,
|
||||||
|
utils.Time2Str(order.OrderCreatedAt),
|
||||||
|
order.VendorOrderID,
|
||||||
|
jxutils.GetVendorName(order.VendorID),
|
||||||
|
order.OrderSeq,
|
||||||
|
)
|
||||||
|
orderFmt += xpyunapi.StrRepeat("-", 32)
|
||||||
|
orderFmt += `<LEFT><font# bolder=1 height=2 width=1>共%d种%d件商品</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
|
||||||
|
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
|
||||||
|
return fmt.Sprintf(orderFmt, orderParams...)
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消/退货 大尺寸模板
|
||||||
|
func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrder, printType int, storeDetail *dao.StoreDetail) (content string) {
|
||||||
|
var orderParams []interface{}
|
||||||
|
orderFmt := ``
|
||||||
|
if storeDetail != nil {
|
||||||
|
if storeDetail.BrandIsPrint == model.NO {
|
||||||
|
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||||
|
if order.VendorOrgCode == "34665" {
|
||||||
|
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||||
|
} else {
|
||||||
|
orderParams = append(orderParams, storeDetail.BrandName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title := ``
|
||||||
|
if printType == model.YES { // 取消订单
|
||||||
|
title = `<font# bolder=1 height=2 width=2>取消订单详情</font#>`
|
||||||
|
} else { // 售后订单
|
||||||
|
title = `<font# bolder=1 height=2 width=2>退款订单详情</font#>`
|
||||||
|
}
|
||||||
|
|
||||||
|
orderFmt +=
|
||||||
|
xpyunapi.StrRepeat("-", 32) + `
|
||||||
|
<LEFT><font# bolder=1 height=1 width=1>下单时间: %s</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=0 height=2 width=1>订单编号: %s</font#></LEFT><BR>
|
||||||
|
<font# bolder=1 height=2 width=2>%s#%d</font#>
|
||||||
|
` + title
|
||||||
|
orderParams = append(orderParams,
|
||||||
|
utils.Time2Str(order.OrderCreatedAt),
|
||||||
|
order.VendorOrderID,
|
||||||
|
jxutils.GetVendorName(order.VendorID),
|
||||||
|
order.OrderSeq,
|
||||||
|
)
|
||||||
|
orderFmt += xpyunapi.StrRepeat("-", 32)
|
||||||
|
orderFmt += `<LEFT><font# bolder=1 height=2 width=1>共%d种%d件商品</font#></LEFT>
|
||||||
|
<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>
|
||||||
|
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
|
||||||
|
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
|
||||||
|
return fmt.Sprintf(orderFmt, orderParams...)
|
||||||
|
}
|
||||||
|
|||||||
@@ -137,7 +137,8 @@ yilianyunClientSecret2 = "d5eedb40c99e6691b1ca2ba82a363d6a"
|
|||||||
xpyunUserName="feng.shi@rosy.net.cn"
|
xpyunUserName="feng.shi@rosy.net.cn"
|
||||||
xpyunUserKey="20a24d4332954993b05876e7b3db2a96"
|
xpyunUserKey="20a24d4332954993b05876e7b3db2a96"
|
||||||
|
|
||||||
|
trendIDAppID="1088834319474253824"
|
||||||
|
trendIDAppSecret="79e3b918aeca427bbbf9d0503f9f9106"
|
||||||
|
|
||||||
zhongwuAppID = 8000192
|
zhongwuAppID = 8000192
|
||||||
zhongwuAppSecret = "29435497822f52f3cf659c65da548a79"
|
zhongwuAppSecret = "29435497822f52f3cf659c65da548a79"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
|
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok"
|
"git.rosy.net.cn/baseapi/platformapi/tiktok"
|
||||||
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/trenditapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/uinapp"
|
"git.rosy.net.cn/baseapi/platformapi/uinapp"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/uuptapi"
|
"git.rosy.net.cn/baseapi/platformapi/uuptapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/xpyunapi"
|
"git.rosy.net.cn/baseapi/platformapi/xpyunapi"
|
||||||
@@ -110,6 +111,7 @@ var (
|
|||||||
YilianyunAPI *yilianyunapi.API
|
YilianyunAPI *yilianyunapi.API
|
||||||
YilianyunAPI2 *yilianyunapi.API
|
YilianyunAPI2 *yilianyunapi.API
|
||||||
XpyunAPI *xpyunapi.API
|
XpyunAPI *xpyunapi.API
|
||||||
|
TrendITAPI *trenditapi.API
|
||||||
ZhongwuAPI *zhongwuapi.API
|
ZhongwuAPI *zhongwuapi.API
|
||||||
JxPrintAPI *jxprintapi.API
|
JxPrintAPI *jxprintapi.API
|
||||||
|
|
||||||
@@ -308,6 +310,7 @@ func Init() {
|
|||||||
YilianyunAPI = yilianyunapi.New(beego.AppConfig.DefaultString("yilianyunClientID", ""), beego.AppConfig.DefaultString("yilianyunClientSecret", ""))
|
YilianyunAPI = yilianyunapi.New(beego.AppConfig.DefaultString("yilianyunClientID", ""), beego.AppConfig.DefaultString("yilianyunClientSecret", ""))
|
||||||
YilianyunAPI2 = yilianyunapi.New(beego.AppConfig.DefaultString("yilianyunClientID2", ""), beego.AppConfig.DefaultString("yilianyunClientSecret2", ""))
|
YilianyunAPI2 = yilianyunapi.New(beego.AppConfig.DefaultString("yilianyunClientID2", ""), beego.AppConfig.DefaultString("yilianyunClientSecret2", ""))
|
||||||
XpyunAPI = xpyunapi.New(beego.AppConfig.DefaultString("xpyunUserName", ""), beego.AppConfig.DefaultString("xpyunUserKey", ""))
|
XpyunAPI = xpyunapi.New(beego.AppConfig.DefaultString("xpyunUserName", ""), beego.AppConfig.DefaultString("xpyunUserKey", ""))
|
||||||
|
TrendITAPI = trenditapi.New(beego.AppConfig.DefaultString("trendIDAppID", ""), beego.AppConfig.DefaultString("trendIDAppSecret", ""))
|
||||||
ZhongwuAPI = zhongwuapi.New(beego.AppConfig.DefaultInt("zhongwuAppID", 0), beego.AppConfig.DefaultString("zhongwuAppSecret", ""))
|
ZhongwuAPI = zhongwuapi.New(beego.AppConfig.DefaultInt("zhongwuAppID", 0), beego.AppConfig.DefaultString("zhongwuAppSecret", ""))
|
||||||
JxPrintAPI = jxprintapi.New(beego.AppConfig.DefaultString("jxPrintAppID", ""), beego.AppConfig.DefaultString("jxPrintAppKey", ""))
|
JxPrintAPI = jxprintapi.New(beego.AppConfig.DefaultString("jxPrintAppID", ""), beego.AppConfig.DefaultString("jxPrintAppKey", ""))
|
||||||
|
|
||||||
|
|||||||
1
main.go
1
main.go
@@ -36,6 +36,7 @@ import (
|
|||||||
|
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/printer/feie"
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/feie"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/printer/jxprint"
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/jxprint"
|
||||||
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/trendit"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/printer/xiaowm"
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/xiaowm"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/printer/xpyun"
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/xpyun"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/printer/yilianyun"
|
_ "git.rosy.net.cn/jx-callback/business/partner/printer/yilianyun"
|
||||||
|
|||||||
Reference in New Issue
Block a user