Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -868,7 +868,7 @@ func updateSingleOrderEarningPrice(order *model.GoodsOrder, db *dao.DaoDB) {
|
||||
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||
v.EarningPrice = actStoreSku.EarningPrice
|
||||
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
|
||||
v.StoreSubID = actStoreSku.ActID
|
||||
v.StoreSubID = int64(actStoreSku.ActID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,8 +387,8 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
BusinessTypeImmediate = 1 // 立即达
|
||||
BusinessTypeDingshida = 2 // 定时达
|
||||
BusinessTypeImmediate = 1 // 定时单
|
||||
BusinessTypeDingshida = 2 // 预订单
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -144,7 +144,7 @@ func QueryOrders(db *DaoDB, vendorOrderID string, actID int, vendorIDs []int, st
|
||||
ID: v.OrderSkuID,
|
||||
VendorOrderID: v.VendorOrderID,
|
||||
VendorID: v.VendorID,
|
||||
StoreSubID: v.StoreSubID,
|
||||
StoreSubID: int64(v.StoreSubID),
|
||||
StoreSubName: v.StoreSubName,
|
||||
Count: v.Count,
|
||||
VendorSkuID: v.VendorSkuID,
|
||||
|
||||
@@ -196,7 +196,7 @@ type OrderSku struct {
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorSubOrderID string `orm:"column(vendor_sub_order_id);size(48)" json:"vendorSubOrderID"` // 子订单id
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
StoreSubID int `orm:"column(store_sub_id)" json:"storeSubID"` // EarningActID,当前这个字段被当成结算活动ID用
|
||||
StoreSubID int64 `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"`
|
||||
|
||||
@@ -89,6 +89,11 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *mtpsapi.CallbackOrderExceptionMsg
|
||||
|
||||
func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) {
|
||||
order, goodsOrder := c.callbackMsg2Waybill(msg)
|
||||
//查不到订单可能就是果园的订单
|
||||
if goodsOrder == nil && beego.BConfig.RunMode != "jxgy" {
|
||||
c.pushToGy(msg)
|
||||
return mtpsapi.SuccessResponse
|
||||
}
|
||||
// 多次取消,只处理第一次
|
||||
if msg.Status == mtpsapi.OrderStatusCanceled {
|
||||
orderStatus, _ := orderman.FixedOrderManager.GetWayBillStatusList(msg.OrderID, msg.MtPeisongID, model.VendorIDMTPS)
|
||||
@@ -133,13 +138,6 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
|
||||
return mtpsapi.SuccessResponse
|
||||
}
|
||||
|
||||
order2, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.OrderVendorID)
|
||||
//查不到订单可能就是果园的订单
|
||||
if order2 == nil && beego.BConfig.RunMode != "jxgy" {
|
||||
c.pushToGy(msg)
|
||||
return mtpsapi.SuccessResponse
|
||||
}
|
||||
|
||||
// 加入调度器
|
||||
err := mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus)
|
||||
switch order.OrderVendorID {
|
||||
|
||||
@@ -96,6 +96,10 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (v.WaybillVendorID == model.YES || v.WaybillVendorID == -1) && v.VendorID == model.VendorIDMTWM {
|
||||
continue
|
||||
}
|
||||
|
||||
if orderId == "" { // 订单id为空是,是定时轮询操作,不做此状态
|
||||
waybillList, _ := dao.GetWaybills(dao.GetDB(), v.VendorOrderID, nil)
|
||||
if len(waybillList) > 0 && waybillList[0].Status > model.WaybillStatusEndBegin {
|
||||
@@ -188,6 +192,12 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
riderInfo.CourierName = "石锋"
|
||||
riderInfo.CourierPhone = "18048531223"
|
||||
}
|
||||
|
||||
if riderInfo.OrderId == "" {
|
||||
riderInfo.OrderId = v.VendorOrderID
|
||||
riderInfo.LogisticsProviderCode = "10017"
|
||||
}
|
||||
|
||||
if riderInfo.ThirdCarrierOrderId == "" {
|
||||
riderInfo.ThirdCarrierOrderId = riderInfo.OrderId + "_fake"
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve
|
||||
}
|
||||
|
||||
if len(activityId) > 0 {
|
||||
sku.StoreSubID = int(activityId[0])
|
||||
sku.StoreSubID = activityId[0]
|
||||
sku.StoreSubName = strings.Join(activityName, ",")
|
||||
}
|
||||
if sku.Weight == 0 {
|
||||
@@ -171,10 +171,10 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve
|
||||
// 期望送达时间两小时内为立即达
|
||||
earliestTime := utils.Str2Time(strings.Split(*orderDetail.ReceiveInfo.ExpectArriveTime, "~")[0]).Unix()
|
||||
if earliestTime-time.Now().Unix() > 2*60*60 {
|
||||
order.BusinessType = model.BusinessTypeImmediate
|
||||
order.BusinessType = model.BusinessTypeDingshida
|
||||
order.ExpectedDeliveredTime = getTimeFromTimestamp(earliestTime + 30*60) // 预计最晚送达时间
|
||||
} else { // 定时达
|
||||
order.BusinessType = model.BusinessTypeDingshida
|
||||
order.BusinessType = model.BusinessTypeImmediate
|
||||
order.ExpectedDeliveredTime = getTimeFromTimestamp(earliestTime + 30*60) // 预计最晚送达时间
|
||||
}
|
||||
|
||||
@@ -206,13 +206,14 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve
|
||||
order.OrderSeq = orderSeq + 1
|
||||
|
||||
// 包装袋金额
|
||||
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||
store, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), order.VendorStoreID, model.VendorIDTaoVegetable, order.VendorOrgCode)
|
||||
if store != nil {
|
||||
order.StoreName = store.Name // 真实门店名称
|
||||
order.PackagePrice = int(*orderDetail.PackageFee) + store.PackageSetting
|
||||
} else {
|
||||
order.PackagePrice = int(*orderDetail.PackageFee)
|
||||
order.StoreName = "未获取到" // 真实门店名称
|
||||
}
|
||||
order.StoreName = store.Name // 真实门店名称
|
||||
|
||||
globals.SugarLogger.Debugf("=====order : %s", utils.Format4Output(order, false))
|
||||
return order, orderMap, err
|
||||
|
||||
@@ -162,7 +162,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
|
||||
activityName = append(activityName, utils.Int64ToStr(v.CampaignId)+":"+v.CampaignName)
|
||||
}
|
||||
if len(activityId) > 0 {
|
||||
sku.StoreSubID = int(activityId[0])
|
||||
sku.StoreSubID = activityId[0]
|
||||
sku.StoreSubName = strings.Join(activityName, ",")
|
||||
}
|
||||
if sku.Weight == 0 {
|
||||
|
||||
@@ -486,18 +486,18 @@ func (c *ActController) GetNotHaveSkuActList() {
|
||||
})
|
||||
}
|
||||
|
||||
//// @Title 查询美团平台活动
|
||||
//// @Description 查询美团平台活动
|
||||
//// @Param token header string true "认证token"
|
||||
//// @Success 200 {object} controllers.CallResult
|
||||
//// @Failure 200 {object} controllers.CallResult
|
||||
//// @router /RefreshMTActivityList [get]
|
||||
//func (c *ActController) RefreshMTActivityList() {
|
||||
// c.callRefreshMTActivityList(func(params *tActRefreshMTActivityListParams) (retVal interface{}, errCode string, err error) {
|
||||
// err = act.RrefreshMtwmVendorAct(params.Ctx)
|
||||
// return retVal, "", err
|
||||
// })
|
||||
//}
|
||||
// @Title 查询美团平台活动
|
||||
// @Description 查询美团平台活动
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RefreshMTActivityList [get]
|
||||
func (c *ActController) RefreshMTActivityList() {
|
||||
c.callRefreshMTActivityList(func(params *tActRefreshMTActivityListParams) (retVal interface{}, errCode string, err error) {
|
||||
err = act.RrefreshMtwmVendorAct(params.Ctx)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 查询美团平台活动sku
|
||||
// @Description 查询美团平台活动sku
|
||||
|
||||
@@ -571,7 +571,7 @@ func skuList2Map(skuList []*model.OrderSku) (skuCount int, skuMap map[int64]*mod
|
||||
skuCount += sku.Count
|
||||
skuID := jxutils.GetSkuIDFromOrderSku(sku)
|
||||
if sku.SkuID > 0 {
|
||||
index := jxutils.Combine2Int(skuID, sku.StoreSubID)
|
||||
index := jxutils.Combine2Int(skuID, int(sku.StoreSubID))
|
||||
if skuMap[index] == nil {
|
||||
tmpSku := *sku
|
||||
skuMap[index] = &tmpSku
|
||||
@@ -901,7 +901,7 @@ func fillSkuList(skuList, orderSkuList []*model.OrderSku) (isSame bool, err erro
|
||||
skuCount2 += sku.Count
|
||||
skuID := jxutils.GetSkuIDFromOrderSku(sku)
|
||||
actID := sku.StoreSubID
|
||||
sku2 := getSkuFromMap(orderSkuMap, skuID, actID)
|
||||
sku2 := getSkuFromMap(orderSkuMap, skuID, int(actID))
|
||||
if sku2 == nil {
|
||||
err = fmt.Errorf("找不到SKU:%d", skuID)
|
||||
} else if sku.Count > sku2.Count {
|
||||
|
||||
@@ -114,14 +114,14 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
//web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"],
|
||||
// web.ControllerComments{
|
||||
// Method: "/RefreshMTActivityList",
|
||||
// Router: `/RefreshMTActivityList`,
|
||||
// AllowHTTPMethods: []string{"get"},
|
||||
// MethodParams: param.Make(),
|
||||
// Filters: nil,
|
||||
// Params: nil})
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"],
|
||||
web.ControllerComments{
|
||||
Method: "RefreshMTActivityList",
|
||||
Router: `/RefreshMTActivityList`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ActController"],
|
||||
web.ControllerComments{
|
||||
|
||||
Reference in New Issue
Block a user