shan
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"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/globals"
|
||||
@@ -156,69 +155,69 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
}
|
||||
|
||||
func onTLpayRefund(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
orderPayRefund := &model.OrderPayRefund{
|
||||
RefundID: call.CusorderID,
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
orderPayRefund.Status = model.RefundStatusYes
|
||||
} else {
|
||||
orderPayRefund.Status = model.RefundStatusFailed
|
||||
}
|
||||
orderPayRefund.OriginalData = utils.Format4Output(call, true)
|
||||
dao.UpdateEntity(db, orderPayRefund)
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
globals.SugarLogger.Warnf("收到异常的退款事件, call:%s", utils.Format4Output(call, true))
|
||||
}
|
||||
// orderPayRefund := &model.OrderPayRefund{
|
||||
// RefundID: call.CusorderID,
|
||||
// }
|
||||
// db := dao.GetDB()
|
||||
// if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
// if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
// orderPayRefund.Status = model.RefundStatusYes
|
||||
// } else {
|
||||
// orderPayRefund.Status = model.RefundStatusFailed
|
||||
// }
|
||||
// orderPayRefund.OriginalData = utils.Format4Output(call, true)
|
||||
// dao.UpdateEntity(db, orderPayRefund)
|
||||
// } else if dao.IsNoRowsError(err) {
|
||||
// globals.SugarLogger.Warnf("收到异常的退款事件, call:%s", utils.Format4Output(call, true))
|
||||
// }
|
||||
|
||||
orderPay := &model.OrderPay{
|
||||
VendorOrderID: orderPayRefund.VendorOrderID,
|
||||
VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||
PayType: model.PayTypeWX,
|
||||
Status: model.PayStatusYes,
|
||||
}
|
||||
orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||
orderPay.Status = model.PayStatusRefund
|
||||
dao.UpdateEntity(db, orderPay)
|
||||
}
|
||||
// orderPay := &model.OrderPay{
|
||||
// VendorOrderID: orderPayRefund.VendorOrderID,
|
||||
// VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||
// PayType: model.PayTypeWX,
|
||||
// Status: model.PayStatusYes,
|
||||
// }
|
||||
// orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
// if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||
// orderPay.Status = model.PayStatusRefund
|
||||
// dao.UpdateEntity(db, orderPay)
|
||||
// }
|
||||
return err
|
||||
}
|
||||
|
||||
func RefundOrderByTL(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
|
||||
result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
|
||||
Trxamt: refundFee,
|
||||
Reqsn: utils.GetUUID(),
|
||||
Remark: refundDesc,
|
||||
OldTrxID: orderPay.TransactionID,
|
||||
})
|
||||
if err == nil {
|
||||
orderPayRefund = &model.OrderPayRefund{
|
||||
RefundID: refundID,
|
||||
VendorRefundID: result.TrxID,
|
||||
VendorOrderID: orderPay.VendorOrderID,
|
||||
VendorID: orderPay.VendorID,
|
||||
Status: model.RefundStatusNo,
|
||||
TransactionID: orderPay.TransactionID,
|
||||
RefundFee: refundFee,
|
||||
RefundCreatedAt: time.Now(),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||
db := dao.GetDB()
|
||||
if result.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
orderPayRefund.Status = model.RefundStatusYes
|
||||
} else {
|
||||
orderPayRefund.Status = model.RefundStatusFailed
|
||||
}
|
||||
orderPayRefund.OriginalData = utils.Format4Output(result, true)
|
||||
dao.CreateEntity(db, orderPayRefund)
|
||||
// func RefundOrderByTL(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
|
||||
// result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
|
||||
// Trxamt: refundFee,
|
||||
// Reqsn: utils.GetUUID(),
|
||||
// Remark: refundDesc,
|
||||
// OldTrxID: orderPay.TransactionID,
|
||||
// })
|
||||
// if err == nil {
|
||||
// orderPayRefund = &model.OrderPayRefund{
|
||||
// RefundID: refundID,
|
||||
// VendorRefundID: result.TrxID,
|
||||
// VendorOrderID: orderPay.VendorOrderID,
|
||||
// VendorID: orderPay.VendorID,
|
||||
// Status: model.RefundStatusNo,
|
||||
// TransactionID: orderPay.TransactionID,
|
||||
// RefundFee: refundFee,
|
||||
// RefundCreatedAt: time.Now(),
|
||||
// }
|
||||
// dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||
// db := dao.GetDB()
|
||||
// if result.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
// orderPayRefund.Status = model.RefundStatusYes
|
||||
// } else {
|
||||
// orderPayRefund.Status = model.RefundStatusFailed
|
||||
// }
|
||||
// orderPayRefund.OriginalData = utils.Format4Output(result, true)
|
||||
// dao.CreateEntity(db, orderPayRefund)
|
||||
|
||||
orderPay.Status = model.PayStatusRefund
|
||||
dao.UpdateEntity(db, orderPay)
|
||||
}
|
||||
return orderPayRefund, err
|
||||
}
|
||||
// orderPay.Status = model.PayStatusRefund
|
||||
// dao.UpdateEntity(db, orderPay)
|
||||
// }
|
||||
// return orderPayRefund, err
|
||||
// }
|
||||
|
||||
func OnWxPayCallback(msg *wxpayapi.CallbackMsg) (err error) {
|
||||
globals.SugarLogger.Debugf("OnWxPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||
@@ -226,7 +225,7 @@ func OnWxPayCallback(msg *wxpayapi.CallbackMsg) (err error) {
|
||||
case wxpayapi.MsgTypePay:
|
||||
err = onWxpayFinished(msg.Data.(*wxpayapi.PayResultMsg))
|
||||
case wxpayapi.MsgTypeRefund:
|
||||
err = onWxpayRefund(msg.Data.(*wxpayapi.RefundResultMsg))
|
||||
// err = onWxpayRefund(msg.Data.(*wxpayapi.RefundResultMsg))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -255,33 +254,33 @@ func onWxpayFinished(msg *wxpayapi.PayResultMsg) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func onWxpayRefund(msg *wxpayapi.RefundResultMsg) (err error) {
|
||||
orderPayRefund := &model.OrderPayRefund{
|
||||
RefundID: msg.ReqInfoObj.OutRefundNo,
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
if msg.ResultCode == wxpayapi.ResponseCodeSuccess {
|
||||
orderPayRefund.Status = model.RefundStatusYes
|
||||
} else {
|
||||
orderPayRefund.Status = model.RefundStatusFailed
|
||||
}
|
||||
orderPayRefund.OriginalData = utils.Format4Output(msg, true)
|
||||
dao.UpdateEntity(db, orderPayRefund)
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
globals.SugarLogger.Warnf("收到异常的退款事件, msg:%s", utils.Format4Output(msg, true))
|
||||
}
|
||||
// func onWxpayRefund(msg *wxpayapi.RefundResultMsg) (err error) {
|
||||
// orderPayRefund := &model.OrderPayRefund{
|
||||
// RefundID: msg.ReqInfoObj.OutRefundNo,
|
||||
// }
|
||||
// db := dao.GetDB()
|
||||
// if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
// if msg.ResultCode == wxpayapi.ResponseCodeSuccess {
|
||||
// orderPayRefund.Status = model.RefundStatusYes
|
||||
// } else {
|
||||
// orderPayRefund.Status = model.RefundStatusFailed
|
||||
// }
|
||||
// orderPayRefund.OriginalData = utils.Format4Output(msg, true)
|
||||
// dao.UpdateEntity(db, orderPayRefund)
|
||||
// } else if dao.IsNoRowsError(err) {
|
||||
// globals.SugarLogger.Warnf("收到异常的退款事件, msg:%s", utils.Format4Output(msg, true))
|
||||
// }
|
||||
|
||||
orderPay := &model.OrderPay{
|
||||
VendorOrderID: orderPayRefund.VendorOrderID,
|
||||
VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||
PayType: model.PayTypeWX,
|
||||
Status: model.PayStatusYes,
|
||||
}
|
||||
orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||
orderPay.Status = model.PayStatusRefund
|
||||
dao.UpdateEntity(db, orderPay)
|
||||
}
|
||||
return err
|
||||
}
|
||||
// orderPay := &model.OrderPay{
|
||||
// VendorOrderID: orderPayRefund.VendorOrderID,
|
||||
// VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||
// PayType: model.PayTypeWX,
|
||||
// Status: model.PayStatusYes,
|
||||
// }
|
||||
// orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
// if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||
// orderPay.Status = model.PayStatusRefund
|
||||
// dao.UpdateEntity(db, orderPay)
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"math"
|
||||
"math/rand"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -50,25 +49,6 @@ var (
|
||||
|
||||
const fileExt = ".xlsx"
|
||||
|
||||
type OrderSkuList []*model.OrderSku
|
||||
|
||||
func (l OrderSkuList) Len() int {
|
||||
return len(l)
|
||||
}
|
||||
|
||||
// Less reports whether the element with
|
||||
// index i should sort before the element with index j.
|
||||
func (l OrderSkuList) Less(i, j int) bool {
|
||||
return l[i].SalePrice < l[j].SalePrice
|
||||
}
|
||||
|
||||
// Swap swaps the elements with indexes i and j.
|
||||
func (l OrderSkuList) Swap(i, j int) {
|
||||
tmp := l[i]
|
||||
l[i] = l[j]
|
||||
l[j] = tmp
|
||||
}
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().Unix())
|
||||
routinePool = routinepool.New(1000, 1000)
|
||||
@@ -80,30 +60,6 @@ func init() {
|
||||
orderNoBeginTimestamp = utils.Str2Time("2010-01-01 00:00:00").Unix()
|
||||
}
|
||||
|
||||
func getJxStoreIDFromOrder(order *model.GoodsOrder) (retVal int) {
|
||||
if order.JxStoreID != 0 {
|
||||
return order.JxStoreID
|
||||
}
|
||||
return order.StoreID
|
||||
}
|
||||
|
||||
// 此函数得到的是order的销售门店京西ID,与GetJxStoreIDFromOrder的区别是order.StoreID的解释不同,参考其它相关资料
|
||||
func GetSaleStoreIDFromOrder(order *model.GoodsOrder) (retVal int) {
|
||||
return getJxStoreIDFromOrder(order)
|
||||
}
|
||||
|
||||
// 此函数得到的是order的商品的展示门店京西ID,与GetJxStoreIDFromOrder的区别是order.StoreID的解释不同,参考其它相关资料
|
||||
func GetShowStoreIDFromOrder(order *model.GoodsOrder) (retVal int) {
|
||||
return getJxStoreIDFromOrder(order)
|
||||
}
|
||||
|
||||
func GetSkuIDFromOrderSku(sku *model.OrderSku) (skuID int) {
|
||||
if sku.JxSkuID > 0 {
|
||||
return sku.JxSkuID
|
||||
}
|
||||
return sku.SkuID
|
||||
}
|
||||
|
||||
func GetSaleStoreIDFromAfsOrder(order *model.AfsOrder) (retVal int) {
|
||||
if order.JxStoreID > 0 {
|
||||
return order.JxStoreID
|
||||
@@ -269,18 +225,6 @@ func ComposeUniversalOrderID(orderID string, vendorID int) string {
|
||||
return orderID // 当前用长度就能区分,先不加上vendorID
|
||||
}
|
||||
|
||||
func GetUniversalOrderIDFromWaybill(bill *model.Waybill) string {
|
||||
return ComposeUniversalOrderID(bill.VendorOrderID, bill.OrderVendorID)
|
||||
}
|
||||
|
||||
func GetUniversalOrderIDFromOrder(order *model.GoodsOrder) string {
|
||||
return ComposeUniversalOrderID(order.VendorOrderID, order.VendorID)
|
||||
}
|
||||
|
||||
func GetUniversalOrderIDFromOrderStatus(status *model.OrderStatus) string {
|
||||
return ComposeUniversalOrderID(status.VendorOrderID, status.VendorID)
|
||||
}
|
||||
|
||||
// distance单位为米
|
||||
func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat float64) {
|
||||
oneDu := 111319.55 // 单位为米
|
||||
@@ -643,58 +587,6 @@ func Strings2Objs(strAndObjAddPairs ...interface{}) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder {
|
||||
order.SkuCount = 0
|
||||
order.GoodsCount = 0
|
||||
order.SalePrice = 0
|
||||
order.VendorPrice = 0
|
||||
order.ShopPrice = 0
|
||||
order.Weight = 0
|
||||
order.EarningPrice = 0
|
||||
for _, sku := range order.Skus {
|
||||
if sku.SkuID > math.MaxInt32 {
|
||||
sku.SkuID = sku.JxSkuID
|
||||
}
|
||||
sku.OrderCreatedAt = order.OrderCreatedAt
|
||||
sku.VendorID = order.VendorID
|
||||
sku.VendorOrderID = order.VendorOrderID
|
||||
order.SkuCount++
|
||||
order.GoodsCount += sku.Count
|
||||
order.SalePrice += sku.SalePrice * int64(sku.Count)
|
||||
order.VendorPrice += sku.VendorPrice * int64(sku.Count)
|
||||
order.ShopPrice += sku.ShopPrice * int64(sku.Count)
|
||||
order.EarningPrice += sku.EarningPrice * int64(sku.Count)
|
||||
order.Weight += sku.Weight * sku.Count
|
||||
}
|
||||
return order
|
||||
}
|
||||
|
||||
func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *model.GoodsOrder {
|
||||
if order.EarningType == model.EarningTypePoints {
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100
|
||||
// } else {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100
|
||||
// }
|
||||
} else {
|
||||
order.NewEarningPrice = order.EarningPrice
|
||||
}
|
||||
return order
|
||||
}
|
||||
|
||||
func RefreshOrderEarningPrice3(order *model.GoodsOrder, payPercentage int, bill *model.Waybill) *model.GoodsOrder {
|
||||
if order.EarningType == model.EarningTypePoints {
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100
|
||||
// } else {
|
||||
order.NewEarningPrice = order.TotalShopMoney*int64((100-payPercentage/2))/100 - bill.DesiredFee
|
||||
// }
|
||||
} else {
|
||||
order.NewEarningPrice = order.EarningPrice
|
||||
}
|
||||
return order
|
||||
}
|
||||
|
||||
func RefreshAfsOrderSkuRelated(afsOrder *model.AfsOrder) *model.AfsOrder {
|
||||
afsOrder.SkuUserMoney = 0
|
||||
afsOrder.PmSkuSubsidyMoney = 0
|
||||
@@ -708,56 +600,6 @@ func RefreshAfsOrderSkuRelated(afsOrder *model.AfsOrder) *model.AfsOrder {
|
||||
return afsOrder
|
||||
}
|
||||
|
||||
func RemoveSkuFromOrder(order *model.GoodsOrder, removedSkuList []*model.OrderSku) *model.GoodsOrder {
|
||||
removedSkuMap := make(map[int]*model.OrderSku)
|
||||
removedSkuMap2 := make(map[string]*model.OrderSku)
|
||||
for _, sku := range removedSkuList {
|
||||
if skuID := GetSkuIDFromOrderSku(sku); skuID > 0 {
|
||||
if removedSkuMap[skuID] == nil {
|
||||
removedSkuMap[skuID] = sku
|
||||
} else {
|
||||
removedSkuMap[skuID].Count += sku.Count
|
||||
}
|
||||
}
|
||||
if vendorSkuID := sku.VendorSkuID; vendorSkuID != "" {
|
||||
if removedSkuMap2[vendorSkuID] == nil {
|
||||
removedSkuMap2[vendorSkuID] = sku
|
||||
} else {
|
||||
removedSkuMap2[vendorSkuID].Count += sku.Count
|
||||
}
|
||||
}
|
||||
}
|
||||
var skuList []*model.OrderSku
|
||||
sort.Sort(sort.Reverse(OrderSkuList(order.Skus)))
|
||||
for _, sku := range order.Skus {
|
||||
var removedSku *model.OrderSku
|
||||
if skuID := GetSkuIDFromOrderSku(sku); skuID > 0 {
|
||||
removedSku = removedSkuMap[skuID]
|
||||
}
|
||||
if removedSku == nil {
|
||||
if vendorSkuID := sku.VendorSkuID; vendorSkuID != "" {
|
||||
removedSku = removedSkuMap2[vendorSkuID]
|
||||
}
|
||||
}
|
||||
copiedSku := *sku
|
||||
tmp := &copiedSku
|
||||
if removedSku != nil {
|
||||
if removedSku.Count >= sku.Count {
|
||||
tmp = nil
|
||||
removedSku.Count -= sku.Count
|
||||
} else {
|
||||
tmp.Count -= removedSku.Count
|
||||
removedSku.Count = 0
|
||||
}
|
||||
}
|
||||
if tmp != nil {
|
||||
skuList = append(skuList, tmp)
|
||||
}
|
||||
}
|
||||
order.Skus = skuList
|
||||
return RefreshOrderSkuRelated(order)
|
||||
}
|
||||
|
||||
func UploadExportContent(content []byte, key string) (downloadURL string, err error) {
|
||||
putPolicy := storage.PutPolicy{
|
||||
Scope: globals.QiniuBucket,
|
||||
@@ -849,30 +691,11 @@ func OperationTime2HourMinuteFormat(time time.Time) (i int16) {
|
||||
return int16(time.Hour()*100 + time.Minute())
|
||||
}
|
||||
|
||||
// 得到饿百订单的取货码
|
||||
func GetEbaiOrderGetCode(order *model.GoodsOrder) (getCode string) {
|
||||
if order.VendorID == model.VendorIDEBAI && len(order.VendorOrderID2) >= 4 {
|
||||
getCode = order.VendorOrderID2[len(order.VendorOrderID2)-4:]
|
||||
}
|
||||
return getCode
|
||||
}
|
||||
|
||||
func WriteFile(fileName string, binData []byte) error {
|
||||
err := ioutil.WriteFile(fileName, binData, 0666)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetRealMobile4Order(order *model.GoodsOrder) (mobileNumber string) {
|
||||
mobileNumber = order.ConsigneeMobile2
|
||||
if mobileNumber == "" {
|
||||
mobileNumber = order.ConsigneeMobile
|
||||
}
|
||||
if !IsStringLikeMobile(mobileNumber) {
|
||||
mobileNumber = ""
|
||||
}
|
||||
return mobileNumber
|
||||
}
|
||||
|
||||
func GuessDataResourceVendor(resourceURL string) (vendorID int) {
|
||||
vendorID = -1
|
||||
for tmpVendorID, urlList := range resourceTypeMap {
|
||||
|
||||
@@ -19,48 +19,6 @@ type ShortSkuInfo struct {
|
||||
SkuName string `orm:"size(255)" json:"skuName"`
|
||||
}
|
||||
|
||||
type GoodsOrderExt struct {
|
||||
GoodsOrder
|
||||
EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱
|
||||
|
||||
WaybillStatus int `json:"waybillStatus"`
|
||||
CourierName string `orm:"size(32)" json:"courierName"`
|
||||
CourierMobile string `orm:"size(32)" json:"courierMobile"`
|
||||
CurrentConsigneeMobile string `orm:"-" json:"currentConsigneeMobile"`
|
||||
CourierVendorName string `json:"courierVendorName"`
|
||||
|
||||
Status2 string `json:"status2"`
|
||||
ActualFee int64 `json:"actualFee"` // 实际要支付给快递公司的费用
|
||||
DesiredFee int64 `json:"desiredFee"` // 运单总费用
|
||||
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"`
|
||||
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"`
|
||||
|
||||
DistrictName string `json:"districtName"`
|
||||
CityName string `json:"cityName"`
|
||||
PayPercentage int `json:"payPercentage"`
|
||||
OldPayPercentage int `json:"oldPayPercentage"`
|
||||
|
||||
SkuInfo string `json:"skuInfo,omitempty"`
|
||||
SkuInfo2 string `json:"skuInfo2,omitempty"`
|
||||
ShortSkuInfo `json:"-"`
|
||||
SkuList []*ShortSkuInfo `json:"skuList,omitempty"`
|
||||
Count int `json:"count"`
|
||||
ShopSumPrice int64 `json:"shopSumPrice"`
|
||||
AvgPrice int64 `json:"avgPrice"`
|
||||
BadCommentCount int `json:"badCommentCount"`
|
||||
|
||||
FloatLng float64 `json:"floatLng"`
|
||||
FloatLat float64 `json:"floatLat"`
|
||||
}
|
||||
|
||||
type OrderSkuExt struct {
|
||||
OrderSku
|
||||
NameID int `orm:"column(name_id)" json:"nameID"`
|
||||
FullSkuName string `json:"fullSkuName"`
|
||||
Image string `json:"image"`
|
||||
// RealEarningPrice int64 `json:"realEarningPrice"` // 实际单品结算给门店老板钱
|
||||
}
|
||||
|
||||
type GoodsOrderCountInfo struct {
|
||||
LockStatus int `json:"lockStatus"`
|
||||
Status int `json:"status"`
|
||||
|
||||
@@ -54,398 +54,6 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
type ModelTimeInfo struct {
|
||||
CreatedAt time.Time `orm:"auto_now_add;type(datetime)"`
|
||||
UpdatedAt time.Time `orm:"auto_now;type(datetime)"`
|
||||
}
|
||||
|
||||
type GoodsOrder struct {
|
||||
ID int64 `orm:"column(id)" json:"id"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorOrderID2 string `orm:"column(vendor_order_id2);size(200);index" json:"vendorOrderID2"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
||||
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
|
||||
StoreName string `orm:"size(64)" json:"storeName"`
|
||||
ShopPrice int64 `json:"shopPrice"` // 京西价
|
||||
VendorPrice int64 `json:"vendorPrice"` // 平台价
|
||||
SalePrice int64 `json:"salePrice"` // 售卖价
|
||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
|
||||
DiscountMoney int64 `json:"discountMoney"` // 订单总优惠金额
|
||||
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+
|
||||
BaseFreightMoney int64 `json:"baseFreightMoney"` // 商户承担的配送费(不包括DistanceFreightMoney)
|
||||
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
|
||||
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
|
||||
EarningPrice int64 `json:"earningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)
|
||||
NewEarningPrice int64 `json:"newEarningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)(新规则)
|
||||
Weight int `json:"weight"` // 单位为克
|
||||
VendorUserID string `orm:"column(vendor_user_id);size(48)" json:"vendorUserID"`
|
||||
UserID string `orm:"column(user_id);size(48);index" json:"userID"`
|
||||
ConsigneeName string `orm:"size(32)" json:"consigneeName"`
|
||||
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"` // 订单中的收货手机号
|
||||
ConsigneeMobile2 string `orm:"size(32)" json:"consigneeMobile2"` // 收货人真实手机号
|
||||
ConsigneeAddress string `orm:"size(255)" json:"consigneeAddress"`
|
||||
CoordinateType int `json:"coordinateType"`
|
||||
ConsigneeLng int `json:"consigneeLng"` // 坐标 * (10的六次方)
|
||||
ConsigneeLat int `json:"consigneeLat"` // 坐标 * (10的六次方)
|
||||
SkuCount int `json:"skuCount"` // 商品类别数量,即有多少种商品(注意在某些情况下,相同SKU的商品由于售价不同,也会当成不同商品在这个值里)
|
||||
GoodsCount int `json:"goodsCount"` // 商品个数
|
||||
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
|
||||
VendorStatus string `orm:"size(255)" json:"vendorStatus"`
|
||||
LockStatus int `json:"lockStatus"` // 当前只支持单一锁定
|
||||
LockStatusTime time.Time `orm:"type(datetime);null" json:"lockStatusTime"` // last lock status time
|
||||
OrderSeq int `json:"orderSeq"` // 门店订单序号
|
||||
BuyerComment string `orm:"size(255)" json:"buyerComment"`
|
||||
BusinessType int `json:"businessType"`
|
||||
ExpectedDeliveredTime time.Time `orm:"type(datetime)" json:"expectedDeliveredTime"` // 预期送达时间
|
||||
CancelApplyReason string `orm:"size(255)" json:"-"` // ""表示没有申请,不为null表示用户正在取消申请
|
||||
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
||||
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
||||
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
||||
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
|
||||
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
||||
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"`
|
||||
StatusTime time.Time `orm:"type(datetime)" json:"statusTime"` // last status time
|
||||
PickDeadline time.Time `orm:"type(datetime);null" json:"pickDeadline"`
|
||||
DeliveryFeeFrom *time.Time `orm:"type(datetime);null" json:"deliveryFeeFrom,omitempty"` // 三方配置费计算的开始基准时间
|
||||
ModelTimeInfo `json:"-"`
|
||||
Flag int `json:"flag"` //非运单调整相关的其它状态
|
||||
|
||||
InvoiceTitle string `orm:"size(64)" json:"invoiceTitle"` // 发票抬头
|
||||
InvoiceTaxerID string `orm:"size(32);column(invoice_taxer_id)" json:"invoiceTaxerID"` // 发票纳税人识别码
|
||||
InvoiceEmail string `orm:"size(64)" json:"invoiceEmail"` // 发票邮箱
|
||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
FromStoreID int `orm:"column(from_store_id)" json:"fromStoreID"` //物料配送门店
|
||||
EclpOutID string `orm:"column(eclp_out_id)" json:"eclpOutID"` //物料配送的出库单号
|
||||
AddressID int64 `orm:"column(address_id)" json:"addressID"` //配送地址ID
|
||||
EarningType int `json:"earningType"` //订单结算方式,2为扣点,1为报价
|
||||
OrderType int `json:"orderType"` //订单类型,0为普通订单,1为物料订单,2为进货订单
|
||||
OrderPayPercentage int `json:"orderPayPercentage"`
|
||||
|
||||
// 以下只是用于传递数据
|
||||
OriginalData string `orm:"-" json:"-"`
|
||||
Skus []*OrderSku `orm:"-" json:"-"`
|
||||
}
|
||||
|
||||
func (o *GoodsOrder) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorOrderID", "VendorID"},
|
||||
}
|
||||
}
|
||||
|
||||
type GoodsOrderOriginal struct {
|
||||
ID int64 `orm:"column(id)" json:"-"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
AccountNo string `orm:"size(32)" json:"accountNo"`
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
||||
CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
}
|
||||
|
||||
func (o *GoodsOrderOriginal) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorOrderID", "VendorID"},
|
||||
}
|
||||
}
|
||||
|
||||
type OrderSku struct {
|
||||
ID int64 `orm:"column(id)" json:"-"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
StoreSubID int `orm:"column(store_sub_id)" json:"storeSubID"` // EarningActID,当前这个字段被当成结算活动ID用
|
||||
StoreSubName string `orm:"size(64)" json:"storeSubName"` // 当前这个字段被用作vendorActType
|
||||
Count int `json:"count"`
|
||||
VendorSkuID string `orm:"column(vendor_sku_id);size(48)" json:"vendorSkuID"`
|
||||
SkuID int `orm:"column(sku_id)" json:"skuID"` // 外部系统里记录的 jxskuid
|
||||
JxSkuID int `orm:"column(jx_sku_id)" json:"jxSkuID"` // 根据VendorSkuID在本地系统里查询出来的 jxskuid
|
||||
SkuName string `orm:"size(255)" json:"skuName"`
|
||||
ShopPrice int64 `json:"shopPrice"` // 京西价
|
||||
VendorPrice int64 `json:"vendorPrice"` // 平台价
|
||||
SalePrice int64 `json:"salePrice"` // 售卖价
|
||||
EarningPrice int64 `json:"earningPrice"` // 活动商品设置,结算给门店老板的钱,如果结算活动ID为0,是按结算比例算的,否则就是结算表中的值
|
||||
Weight int `json:"weight"` // 单位为克
|
||||
SkuType int `json:"skuType"` // 当前如果为gift就为1,否则缺省为0
|
||||
PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑
|
||||
IsVendorAct int `json:"isVendorAct"`
|
||||
}
|
||||
|
||||
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)
|
||||
// 所以这里不能用唯一索引
|
||||
func (o *OrderSku) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorOrderID", "SkuID"},
|
||||
[]string{"JxSkuID", "VendorOrderID"},
|
||||
}
|
||||
}
|
||||
|
||||
type Waybill struct {
|
||||
ID int64 `orm:"column(id)" json:"-"`
|
||||
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
||||
VendorWaybillID2 string `orm:"column(vendor_waybill_id2);size(48)" json:"vendorWaybillID2"` // 某些平台有多个ID,比如美团配送,当前美团配送的 delivery_id存这里
|
||||
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
OrderVendorID int `orm:"column(order_vendor_id)" json:"orderVendorID"`
|
||||
CourierName string `orm:"size(32)" json:"courierName"`
|
||||
CourierMobile string `orm:"size(32)" json:"courierMobile"`
|
||||
Status int `json:"status"` // 参见WaybillStatus*相关的常量定义
|
||||
VendorStatus string `orm:"size(255)" json:"-"`
|
||||
ActualFee int64 `json:"actualFee"` // 实际要支付给快递公司的费用
|
||||
DesiredFee int64 `json:"desiredFee"` // 运单总费用
|
||||
TipFee int64 `json:"tipFee"` // 运单小费,不含在上两项中
|
||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
DeliveryFlag int8 `json:"deliveryFlag"`
|
||||
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"`
|
||||
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"`
|
||||
StatusTime time.Time `orm:"type(datetime)" json:"-"` // last status time
|
||||
ModelTimeInfo `json:"-"`
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
Remark string `orm:"-" json:"-"` // 用于传递remark
|
||||
|
||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
}
|
||||
|
||||
func (w *Waybill) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorWaybillID", "WaybillVendorID"},
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Waybill) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorOrderID"},
|
||||
}
|
||||
}
|
||||
|
||||
type WaybillExt struct {
|
||||
Waybill
|
||||
Lng float64 `json:"lng"`
|
||||
Lat float64 `json:"lat"`
|
||||
}
|
||||
|
||||
// 包含订单与运单的状态及事件vendor status
|
||||
type OrderStatus struct {
|
||||
ID int64 `orm:"column(id)" json:"id"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
OrderType int `json:"orderType"` // 0:订单,1:运单
|
||||
RefVendorOrderID string `orm:"column(ref_vendor_order_id);size(48)" json:"refVendorOrderID"`
|
||||
RefVendorID int `orm:"column(ref_vendor_id)" json:"refVendorID"`
|
||||
Status int `json:"status"` // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化
|
||||
VendorStatus string `orm:"size(255)" json:"vendorStatus"`
|
||||
StatusTime time.Time `orm:"type(datetime);index" json:"statusTime"`
|
||||
DuplicatedCount int `json:"-"` // 收到的重复状态转换(或消息)数,一般是由于重发造成的
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
ModelTimeInfo `json:"-"`
|
||||
// LockStatus int `orm:"-" json:"-"` // todo 只是用于传递状态,应该可以优化掉
|
||||
}
|
||||
|
||||
func (v *OrderStatus) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorOrderID", "Status", "VendorStatus"},
|
||||
[]string{"RefVendorOrderID", "Status", "VendorStatus"},
|
||||
}
|
||||
}
|
||||
|
||||
func Order2Status(order *GoodsOrder) (retVal *OrderStatus) {
|
||||
retVal = &OrderStatus{
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: order.VendorID,
|
||||
OrderType: OrderTypeOrder,
|
||||
RefVendorOrderID: order.VendorOrderID,
|
||||
RefVendorID: order.VendorID,
|
||||
Status: order.Status,
|
||||
VendorStatus: order.VendorStatus,
|
||||
StatusTime: order.StatusTime,
|
||||
// LockStatus: order.LockStatus,
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func Waybill2Status(bill *Waybill) (retVal *OrderStatus) {
|
||||
retVal = &OrderStatus{
|
||||
VendorOrderID: bill.VendorWaybillID,
|
||||
VendorID: bill.WaybillVendorID,
|
||||
OrderType: OrderTypeWaybill,
|
||||
RefVendorOrderID: bill.VendorOrderID,
|
||||
RefVendorID: bill.OrderVendorID,
|
||||
Status: bill.Status,
|
||||
VendorStatus: bill.VendorStatus,
|
||||
StatusTime: bill.StatusTime,
|
||||
Remark: bill.Remark,
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
// 判断订单是否是临时的,不是真实收到了new order消息后的订单
|
||||
func IsOrderSolid(order *GoodsOrder) bool {
|
||||
return order != nil && !(order.ConsigneeName == "" && order.ID == 0)
|
||||
}
|
||||
|
||||
func (o *GoodsOrder) GetStatusTime() time.Time {
|
||||
return o.StatusTime
|
||||
}
|
||||
|
||||
func (o *Waybill) GetStatusTime() time.Time {
|
||||
return o.StatusTime
|
||||
}
|
||||
|
||||
func (o *OrderStatus) GetStatusTime() time.Time {
|
||||
return o.StatusTime
|
||||
}
|
||||
|
||||
type OrderComment struct {
|
||||
ModelIDCUL
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48);unique" json:"vendorOrderID"`
|
||||
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);unique" json:"vendorOrderID2"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
||||
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"`
|
||||
UserCommentID string `orm:"column(user_comment_id);size(48)" json:"userCommentID"`
|
||||
IsReplied int8
|
||||
Status int8
|
||||
ModifyDuration int16 // 改评价的小时数
|
||||
|
||||
TagList string
|
||||
Score int8
|
||||
Content string
|
||||
CommentCreatedAt time.Time
|
||||
OriginalMsg string `orm:"type(text)" json:"-"`
|
||||
|
||||
UpdatedTagList string
|
||||
UpdatedScore int8
|
||||
UpdatedContent string
|
||||
CommentUpdatedAt time.Time
|
||||
UpdatedOriginalMsg string `orm:"type(text)" json:"-"`
|
||||
}
|
||||
|
||||
type OrderPay struct {
|
||||
ModelIDCULD
|
||||
|
||||
PayOrderID string `orm:"column(pay_order_id);size(48)" json:"payOrderID"` // 京西支付定单号
|
||||
PayType int `json:"payType"`
|
||||
|
||||
VendorPayType string `orm:"size(48)" json:"vendorPayType"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48);index" json:"vendorOrderID"` // 支付对应的购物订单号
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 购物订单所属厂商代码(当前只有京西)
|
||||
Status int `json:"status"`
|
||||
PayCreatedAt time.Time `orm:"type(datetime);index" json:"payCreatedAt"`
|
||||
PayFinishedAt *time.Time `orm:"type(datetime);null" json:"payFinishedAt"`
|
||||
TotalFee int `json:"totalFee"`
|
||||
|
||||
PrepayID string `orm:"column(prepay_id);index;size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||
TransactionID string `orm:"column(transaction_id);index;size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||||
CodeURL string `orm:"column(code_url);size(3200)" json:"codeURL"`
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
}
|
||||
|
||||
func (v *OrderPay) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"PayOrderID", "PayType", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
type OrderPayRefund struct {
|
||||
ModelIDCULD
|
||||
|
||||
RefundID string `orm:"column(refund_id);unique;size(48)" json:"refundID"`
|
||||
VendorRefundID string `orm:"column(vendor_refund_id);unique;size(48)" json:"vendorRefundID"` // 支付方退款成功后生成的退款单号
|
||||
|
||||
VendorOrderID string `orm:"column(vendor_order_id);index;size(48)" json:"vendorOrderID"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
TransactionID string `orm:"column(transaction_id);index;size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||||
Status int `json:"status"`
|
||||
RefundCreatedAt time.Time `orm:"type(datetime);index" json:"payCreatedAt"`
|
||||
RefundFinishedAt *time.Time `orm:"type(datetime);null" json:"payFinishedAt"`
|
||||
RefundFee int `json:"refundFee"`
|
||||
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
}
|
||||
|
||||
type OrderSupplementFee struct {
|
||||
ModelIDCULD
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorID *int `orm:"column(vendor_id);null" json:"vendorID"`
|
||||
Status int `json:"status"` //账单状态,若已结账则不允许再修改 ,暂时 0为未结账,1为已结账,-1为作废
|
||||
LinkID int `orm:"column(link_id)" json:"linkID"` //作为冲账标志关联某条扣款记录
|
||||
SupplementTime *time.Time `orm:"type(datetime);null" json:"supplementTime"`
|
||||
Type int `json:"type"` //扣款类型,1为差评订单补贴,2为优惠券
|
||||
SupplementFee int `json:"supplementFee"` //扣款金额
|
||||
BillID string `orm:"column(bill_id);size(48)" json:"billID"` //账单ID
|
||||
Comment string `orm:"size(255)" json:"comment"`
|
||||
}
|
||||
|
||||
func (v *OrderSupplementFee) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "VendorOrderID", "SupplementTime"},
|
||||
}
|
||||
}
|
||||
|
||||
type PriceDefendOrder struct {
|
||||
ModelIDCULD
|
||||
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
||||
AddressID int64 `orm:"column(address_id)" json:"addressID"`
|
||||
Count int `json:"count"`
|
||||
DefendPrice int64 `json:"defendPrice"` //守的价格
|
||||
OriginPrice int64 `json:"originPrice"` //商品原价
|
||||
ActualPayPrice int64 `json:"actualPayPrice"` //单位为分 顾客实际支付
|
||||
RealPrice int64 `json:"realPrice"` //实际成交价
|
||||
IsBuyNowPrice int `json:"isBuyNowPrice"` //库存剩x(x=当前客户购买的数量)时以当时价抢购
|
||||
Issue int `json:"issue"` //期数,每晚22:00以后的守价单是归在第二天的期数中
|
||||
IsSuccess int `json:"isSuccess"` //是否抢购成功
|
||||
IsPay int `json:"isPay"` //是否支付
|
||||
}
|
||||
|
||||
func (v *PriceDefendOrder) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "VendorOrderID", "SkuID"},
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否是购买平台自有物流
|
||||
// 对于京东,饿百来说,就是其自有的物流,对于微商城来说,是达达
|
||||
func IsWaybillPlatformOwn(bill *Waybill) bool {
|
||||
return bill.OrderVendorID == bill.WaybillVendorID
|
||||
}
|
||||
|
||||
// 订单是否已经有了有效运单
|
||||
func IsOrderHaveWaybill(order *GoodsOrder) bool {
|
||||
return order.WaybillVendorID != VendorIDUnknown && order.VendorWaybillID != ""
|
||||
}
|
||||
|
||||
// 订单是否有自己平台的有效运单
|
||||
func IsOrderHaveOwnWaybill(order *GoodsOrder) bool {
|
||||
return order.VendorID == order.WaybillVendorID && order.VendorWaybillID != ""
|
||||
}
|
||||
|
||||
// 订单的初始配送方式是否是门店自配送
|
||||
func IsOrderDeliveryByStore(order *GoodsOrder) bool {
|
||||
return order.DeliveryType == OrderDeliveryTypeStoreSelf
|
||||
}
|
||||
|
||||
// 订单的初始配送方式是否是平台负责配送
|
||||
func IsOrderDeliveryByPlatform(order *GoodsOrder) bool {
|
||||
return order.DeliveryType == OrderDeliveryTypePlatform
|
||||
}
|
||||
|
||||
func IsOrderJXTemp(order *GoodsOrder) bool {
|
||||
return order.VendorID == VendorIDJX && order.Flag&OrderFlagMaskTempJX != 0
|
||||
}
|
||||
|
||||
func IsAfsOrderJXTemp(order *AfsOrder) bool {
|
||||
return order.VendorID == VendorIDJX && order.Flag&OrderFlagMaskTempJX != 0
|
||||
}
|
||||
|
||||
type Order struct {
|
||||
ModelIDCUL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user