京东page的cookie可能有问题
This commit is contained in:
@@ -83,9 +83,10 @@ type JxOrderInfo struct {
|
||||
OrderPrice int64 `json:"orderPrice"` // 单位为分 订单商品价格
|
||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||
|
||||
OrderID int64 `json:"orderID"`
|
||||
StoreName string `json:"storeName"`
|
||||
Weight int `json:"weight"`
|
||||
OrderID int64 `json:"orderID"`
|
||||
StoreName string `json:"storeName"`
|
||||
Weight int `json:"weight"`
|
||||
FromStoreID int `json:"fromStoreID"`
|
||||
}
|
||||
|
||||
type DeliveryTimeItem struct {
|
||||
@@ -99,6 +100,12 @@ type DeliveryDayTimeInfo struct {
|
||||
TimeList []*DeliveryTimeItem `json:"timeList"`
|
||||
}
|
||||
|
||||
type MatterOrderStatus struct {
|
||||
Time string `json:"time"`
|
||||
Status string `json:"status"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
var (
|
||||
orderNoBeginTimestamp int64
|
||||
|
||||
@@ -388,6 +395,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
return nil, nil, fmt.Errorf("fromStoreID有误,[%v]", fromStoreID)
|
||||
}
|
||||
deliveryAddress.ConsigneeName = storeDetail2.Name
|
||||
outJxOrder.FromStoreID = fromStoreID
|
||||
}
|
||||
|
||||
// 营业状态及时间检查
|
||||
@@ -579,15 +587,12 @@ func AdjustOrder(ctx *jxcontext.Context, order *model.GoodsOrder, removedSkuList
|
||||
}
|
||||
|
||||
func PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("orderSolutionForWuLiao1")
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusFinishedPickup, "")
|
||||
globals.SugarLogger.Debugf("orderSolutionForWuLiao2")
|
||||
err = orderSolutionForWuLiao(order)
|
||||
return err
|
||||
}
|
||||
|
||||
func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Debugf("orderSolutionForWuLiao3, [%v]", *order)
|
||||
if order.FromStoreID != 0 {
|
||||
// var (
|
||||
// goodsNos []string
|
||||
@@ -628,20 +633,8 @@ func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// wayBill := &model.Waybill{
|
||||
// VendorOrderID: order.VendorOrderID,
|
||||
// OrderVendorID: model.VendorIDJX,
|
||||
// VendorWaybillID: result.EclpSoNo,
|
||||
// WaybillVendorID: model.VendorIDJD,
|
||||
// CourierName: "京东物流",
|
||||
// CourierMobile: "",
|
||||
// Status: model.WaybillStatusNew,
|
||||
// VendorStatus: utils.Int2Str(model.WaybillStatusDelivering),
|
||||
// WaybillCreatedAt: utils.DefaultTimeValue,
|
||||
// WaybillFinishedAt: utils.DefaultTimeValue,
|
||||
// StatusTime: time.Now(),
|
||||
// }
|
||||
// dao.CreateEntity(db, wayBill)
|
||||
// order.EclpOutID = result.EclpSoNo
|
||||
// dao.UpdateEntity(db, order, "EclpOutID")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -661,7 +654,6 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
payList, err2 := dao.GetOrderPayList(db, order.VendorOrderID, jxutils.GetPossibleVendorIDFromVendorOrderID(order.VendorOrderID))
|
||||
if err = err2; err == nil {
|
||||
for _, orderPay := range payList {
|
||||
globals.SugarLogger.Debugf("CancelOrderTL2, [%v]", *orderPay)
|
||||
if orderPay.Status == model.PayStatusYes {
|
||||
// refundID := utils.Int64ToStr(GenRefundID(order))
|
||||
refundID := order.VendorOrderID
|
||||
@@ -672,6 +664,7 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||
errList.AddErr(dao.CreateEntity(dao.GetDB(), orderPayRefund))
|
||||
MarkArrears(db, order, orderPay)
|
||||
CancelMatterOrder(db, order)
|
||||
} else {
|
||||
errList.AddErr(err)
|
||||
}
|
||||
@@ -679,6 +672,7 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
orderPayRefund, err = refundOrderByTL(ctx, orderPay, refundID, orderPay.TotalFee, reason)
|
||||
if err == nil {
|
||||
MarkArrears(db, order, orderPay)
|
||||
CancelMatterOrder(db, order)
|
||||
} else {
|
||||
errList.AddErr(err)
|
||||
}
|
||||
@@ -704,6 +698,13 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
return err
|
||||
}
|
||||
|
||||
func CancelMatterOrder(db *dao.DaoDB, order *model.GoodsOrder) (err error) {
|
||||
if order.FromStoreID != 0 {
|
||||
_, err = api.JdEclpAPI.CancelOrder(order.EclpOutID)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func MarkArrears(db *dao.DaoDB, order *model.GoodsOrder, orderPay *model.OrderPay) {
|
||||
//退款后,若此订单下单用户有推广人,则需要将分给推广人的金额记录到该推广人的欠款中
|
||||
orders, _ := dao.QueryOrders(db, order.VendorOrderID, 0, []int{model.VendorIDJX}, 0, utils.DefaultTimeValue, utils.DefaultTimeValue)
|
||||
@@ -943,10 +944,26 @@ func GetHalfHoursList() (strs []string) {
|
||||
return strs
|
||||
}
|
||||
|
||||
func GetMatterOrderStatus(ctx *jxcontext.Context, vendorOrderID string) (err error) {
|
||||
// var (
|
||||
// db = dao.GetDB()
|
||||
// )
|
||||
|
||||
return err
|
||||
func GetMatterOrderStatus(ctx *jxcontext.Context, vendorOrderID string) (result []*MatterOrderStatus, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
waybills, err := dao.GetWayBillByOrderID(db, -1, model.VendorIDJX, -1, vendorOrderID)
|
||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJX)
|
||||
if len(waybills) > 0 {
|
||||
// queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(waybills[0].VendorWaybillID)
|
||||
}
|
||||
// getTrackMessagePlusByOrderResult, err := api.JdEclpAPI.GetTrackMessagePlusByOrder(vendorOrderID)
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
dao.UpdateEntity(db, order, "Status")
|
||||
waybills[0].StatusTime = time.Now()
|
||||
dao.UpdateEntity(db, waybills[0], "Status", "StatusTime")
|
||||
dao.Commit(db)
|
||||
return result, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user