Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -73,13 +73,13 @@ func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, l
|
|||||||
lastHours = defLastHours
|
lastHours = defLastHours
|
||||||
}
|
}
|
||||||
//权限
|
//权限
|
||||||
if permission.IsRoled(ctx) {
|
//if permission.IsRoled(ctx) {
|
||||||
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
// if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||||
if storeIDsMap[storeID] == 0 {
|
// if storeIDsMap[storeID] == 0 {
|
||||||
storeID = -1
|
// storeID = -1
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.lock_status, t1.status, COUNT(*) count
|
SELECT t1.lock_status, t1.status, COUNT(*) count
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *
|
|||||||
excludeCourierVendorIDMap := jxutils.IntList2Map(excludeCourierVendorIDs)
|
excludeCourierVendorIDMap := jxutils.IntList2Map(excludeCourierVendorIDs)
|
||||||
errList := errlist.New()
|
errList := errlist.New()
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
for _, storeCourier := range storeCourierList {
|
for _, storeCourier := range storeCourierList {
|
||||||
switch storeCourier.Status {
|
switch storeCourier.Status {
|
||||||
case model.YES:
|
case model.YES:
|
||||||
@@ -45,8 +46,12 @@ func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *
|
|||||||
// 创建运单
|
// 创建运单
|
||||||
bill, err2 := c.CreateWaybill(courierVendorID, order, maxDeliveryFee)
|
bill, err2 := c.CreateWaybill(courierVendorID, order, maxDeliveryFee)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
bill.DesiredFee += model.WayBillDeliveryMarkUp
|
// 其实这个bill没啥用,运单的创建是通过回调产生的
|
||||||
bill.ActualFee += model.WayBillDeliveryMarkUp
|
bill.DesiredFee += int64(model.WayBillDeliveryMarkUp + store.FreightMarkup)
|
||||||
|
if bill.WaybillVendorID == model.VendorIDFengNiao {
|
||||||
|
bill.DesiredFee += model.WayBillDeliveryMarkUp
|
||||||
|
}
|
||||||
|
bill.DesiredFee += int64(store.FreightMarkup)
|
||||||
bills = append(bills, bill)
|
bills = append(bills, bill)
|
||||||
if createOnlyOne {
|
if createOnlyOne {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -884,7 +884,7 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf
|
|||||||
if err = s.canOrderCreateWaybillNormally(order, savedOrderInfo); err == nil {
|
if err = s.canOrderCreateWaybillNormally(order, savedOrderInfo); err == nil {
|
||||||
if (order.DeliveryFlag & model.OrderDeliveryFlagMaskScheduleDisabled) == 0 {
|
if (order.DeliveryFlag & model.OrderDeliveryFlagMaskScheduleDisabled) == 0 {
|
||||||
if savedOrderInfo.retryCount <= maxWaybillRetryCount {
|
if savedOrderInfo.retryCount <= maxWaybillRetryCount {
|
||||||
var waybillVendorIDs = []int{model.VendorIDMTPS, model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT}
|
var waybillVendorIDs = []int{model.VendorIDMTPS, model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS}
|
||||||
savedOrderInfo.isNeedCreate3rdWaybill = true
|
savedOrderInfo.isNeedCreate3rdWaybill = true
|
||||||
excludeVendorIDs := savedOrderInfo.GetWaybillVendorIDs()
|
excludeVendorIDs := savedOrderInfo.GetWaybillVendorIDs()
|
||||||
//TODO 取消京西不自动发美团 2020-06-02
|
//TODO 取消京西不自动发美团 2020-06-02
|
||||||
@@ -922,11 +922,7 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf
|
|||||||
|
|
||||||
//TODO 2020-07-21 发单时间要在门店的营业时间内
|
//TODO 2020-07-21 发单时间要在门店的营业时间内
|
||||||
var storeDetail *dao.StoreDetail
|
var storeDetail *dao.StoreDetail
|
||||||
//if savedOrderInfo.storeDetail != nil {
|
|
||||||
// storeDetail = savedOrderInfo.storeDetail
|
|
||||||
//} else {
|
|
||||||
storeDetail, err = dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
|
storeDetail, err = dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
|
||||||
//}
|
|
||||||
if storeDetail != nil {
|
if storeDetail != nil {
|
||||||
if storeDetail.OpenTime1 != 0 && storeDetail.CloseTime1 != 0 {
|
if storeDetail.OpenTime1 != 0 && storeDetail.CloseTime1 != 0 {
|
||||||
time1 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime1, time.Now())
|
time1 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime1, time.Now())
|
||||||
@@ -947,12 +943,47 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf
|
|||||||
|
|
||||||
//1表示为门店发单,需要验证门店账户余额情况
|
//1表示为门店发单,需要验证门店账户余额情况
|
||||||
_, err2 := s.CheckStoreBalance(jxcontext.AdminCtx, order, waybillVendorIDs)
|
_, err2 := s.CheckStoreBalance(jxcontext.AdminCtx, order, waybillVendorIDs)
|
||||||
//TODO 2021-02-19 增加品牌配送开关
|
|
||||||
//TODO 2021-08-31 修改为每个平台的开关
|
|
||||||
//if storeDetail.BrandIsOpen == model.YES {
|
|
||||||
// err = fmt.Errorf("此品牌已关闭配送! [%v]", storeDetail.BrandName)
|
|
||||||
//}
|
|
||||||
if err == nil && err2 == nil {
|
if err == nil && err2 == nil {
|
||||||
|
// 1.检查门店三方配送配置,达达>蜂鸟>美团>顺丰>uu
|
||||||
|
// excludeVendorIDs 包括上面已经发送的平台id
|
||||||
|
storeCourierList, err := dao.GetStoreCourierList2(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, []int{model.StoreAuditStatusOnline, model.StoreAuditStatusUpdated})
|
||||||
|
excludeVendorIDsMap := make(map[int]int, 0) // 被排除的配送
|
||||||
|
for _, v := range excludeVendorIDs {
|
||||||
|
excludeVendorIDsMap[v] = model.YES
|
||||||
|
}
|
||||||
|
|
||||||
|
vendorID := 0
|
||||||
|
for _, v := range storeCourierList {
|
||||||
|
if excludeVendorIDsMap[v.VendorID] == model.YES {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if v.VendorID == model.VendorIDDada {
|
||||||
|
excludeVendorIDs = []int{model.VendorIDFengNiao, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS}
|
||||||
|
vendorID = v.VendorID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.VendorID == model.VendorIDFengNiao {
|
||||||
|
excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS}
|
||||||
|
vendorID = v.VendorID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.VendorID == model.VendorIDMTPS {
|
||||||
|
excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS}
|
||||||
|
vendorID = v.VendorID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.VendorID == model.VendorIDUUPT {
|
||||||
|
excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDSFPS}
|
||||||
|
vendorID = v.VendorID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.VendorID == model.VendorIDSFPS {
|
||||||
|
excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDFengNiao}
|
||||||
|
vendorID = v.VendorID
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
partner.CurOrderManager.OnOrderMsg(order, fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],排除平台[%s]", jxutils.GetVendorName(vendorID), utils.Format4Output(excludeVendorIDs, false)), "")
|
||||||
if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil {
|
if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil {
|
||||||
savedOrderInfo.retryCount++
|
savedOrderInfo.retryCount++
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,6 +477,8 @@ func (s *DefScheduler) QueryOrderWaybillFeeInfoEx(ctx *jxcontext.Context, vendor
|
|||||||
if savedOrderInfo := s.loadSavedOrderByID(vendorOrderID, vendorID, false); savedOrderInfo != nil {
|
if savedOrderInfo := s.loadSavedOrderByID(vendorOrderID, vendorID, false); savedOrderInfo != nil {
|
||||||
timeoutSecond = savedOrderInfo.GetCreateWaybillTimeout()
|
timeoutSecond = savedOrderInfo.GetCreateWaybillTimeout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(db, order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
for _, storeCourier := range storeCourierList {
|
for _, storeCourier := range storeCourierList {
|
||||||
var feeInfo *partner.WaybillFeeInfo
|
var feeInfo *partner.WaybillFeeInfo
|
||||||
if waybillMap[storeCourier.VendorID] != nil {
|
if waybillMap[storeCourier.VendorID] != nil {
|
||||||
@@ -503,6 +505,7 @@ func (s *DefScheduler) QueryOrderWaybillFeeInfoEx(ctx *jxcontext.Context, vendor
|
|||||||
if storeCourier.VendorID == model.VendorIDFengNiao {
|
if storeCourier.VendorID == model.VendorIDFengNiao {
|
||||||
feeInfo.DeliveryFee += model.WayBillDeliveryMarkUp // 蜂鸟加
|
feeInfo.DeliveryFee += model.WayBillDeliveryMarkUp // 蜂鸟加
|
||||||
}
|
}
|
||||||
|
feeInfo.DeliveryFee += int64(store.FreightMarkup)
|
||||||
feeInfo.TimeoutSecond = timeoutSecond
|
feeInfo.TimeoutSecond = timeoutSecond
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -909,6 +909,16 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if payload["packageSetting"] != nil {
|
||||||
|
valid["packageSetting"], _ = payload["packageSetting"].(json.Number).Int64()
|
||||||
|
}
|
||||||
|
if payload["packageSwitch"] != nil {
|
||||||
|
valid["packageSwitch"], _ = payload["packageSwitch"].(json.Number).Int64()
|
||||||
|
}
|
||||||
|
if payload["freightMarkup"] != nil {
|
||||||
|
valid["freightMarkup"], _ = payload["freightMarkup"].(json.Number).Int64()
|
||||||
|
}
|
||||||
|
|
||||||
if valid["originalName"] != nil {
|
if valid["originalName"] != nil {
|
||||||
delete(valid, "originalName")
|
delete(valid, "originalName")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,77 +93,76 @@ type ModelTimeInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GoodsOrder struct {
|
type GoodsOrder struct {
|
||||||
ID int64 `orm:"column(id)" json:"id"`
|
ModelTimeInfo `json:"-"` // 1
|
||||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
ID int64 `orm:"column(id)" json:"id"`
|
||||||
VendorOrderID2 string `orm:"column(vendor_order_id2);size(200);index" json:"vendorOrderID2"`
|
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
VendorOrderID2 string `orm:"column(vendor_order_id2);size(200);index" json:"vendorOrderID2"`
|
||||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||||
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
|
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
||||||
StoreName string `orm:"size(64)" json:"storeName"`
|
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
|
||||||
ShopPrice int64 `json:"shopPrice"` // 京西价
|
StoreName string `orm:"size(64)" json:"storeName"`
|
||||||
VendorPrice int64 `json:"vendorPrice"` // 平台价
|
ShopPrice int64 `json:"shopPrice"` // 京西价
|
||||||
SalePrice int64 `json:"salePrice"` // 售卖价
|
VendorPrice int64 `json:"vendorPrice"` // 平台价
|
||||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
SalePrice int64 `json:"salePrice"` // 售卖价
|
||||||
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
|
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||||
DiscountMoney int64 `json:"discountMoney"` // 订单总优惠金额
|
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
|
||||||
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+
|
DiscountMoney int64 `json:"discountMoney"` // 订单总优惠金额
|
||||||
JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西我们自己填的订单补贴金额
|
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+
|
||||||
BaseFreightMoney int64 `json:"baseFreightMoney"` // 商户承担的配送费(不包括DistanceFreightMoney)
|
JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西我们自己填的订单补贴金额
|
||||||
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
|
BaseFreightMoney int64 `json:"baseFreightMoney"` // 商户承担的配送费(不包括DistanceFreightMoney)
|
||||||
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
|
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
|
||||||
EarningPrice int64 `json:"earningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)
|
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
|
||||||
NewEarningPrice int64 `json:"newEarningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)(新规则)
|
EarningPrice int64 `json:"earningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)
|
||||||
Weight int `json:"weight"` // 单位为克
|
NewEarningPrice int64 `json:"newEarningPrice"` // 结算给门店老板的钱(未扣除可能的三方配送费)(新规则)
|
||||||
VendorUserID string `orm:"column(vendor_user_id);size(48)" json:"vendorUserID"`
|
Weight int `json:"weight"` // 单位为克
|
||||||
UserID string `orm:"column(user_id);size(48);index" json:"userID"`
|
VendorUserID string `orm:"column(vendor_user_id);size(48)" json:"vendorUserID"` // 平台用户id
|
||||||
ConsigneeName string `orm:"size(32)" json:"consigneeName"`
|
UserID string `orm:"column(user_id);size(48);index" json:"userID"` // 用户id
|
||||||
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"` // 订单中的收货手机号
|
ConsigneeName string `orm:"size(32)" json:"consigneeName"` // 收货人名称
|
||||||
ConsigneeMobile2 string `orm:"size(32)" json:"consigneeMobile2"` // 收货人真实手机号
|
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"` // 订单中的收货手机号
|
||||||
ConsigneeAddress string `orm:"size(255)" json:"consigneeAddress"`
|
ConsigneeMobile2 string `orm:"size(32)" json:"consigneeMobile2"` // 收货人真实手机号
|
||||||
CoordinateType int `json:"coordinateType"`
|
ConsigneeAddress string `orm:"size(255)" json:"consigneeAddress"` // 收货地址
|
||||||
ConsigneeLng int `json:"consigneeLng"` // 坐标 * (10的六次方)
|
CoordinateType int `json:"coordinateType"` // 坐标类型
|
||||||
ConsigneeLat int `json:"consigneeLat"` // 坐标 * (10的六次方)
|
ConsigneeLng int `json:"consigneeLng"` // 坐标 * (10的六次方)
|
||||||
SkuCount int `json:"skuCount"` // 商品类别数量,即有多少种商品(注意在某些情况下,相同SKU的商品由于售价不同,也会当成不同商品在这个值里)
|
ConsigneeLat int `json:"consigneeLat"` // 坐标 * (10的六次方)
|
||||||
GoodsCount int `json:"goodsCount"` // 商品个数
|
SkuCount int `json:"skuCount"` // 商品类别数量,即有多少种商品(注意在某些情况下,相同SKU的商品由于售价不同,也会当成不同商品在这个值里)
|
||||||
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
|
GoodsCount int `json:"goodsCount"` // 商品个数
|
||||||
VendorStatus string `orm:"size(255)" json:"vendorStatus"`
|
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
|
||||||
LockStatus int `json:"lockStatus"` // 当前只支持单一锁定
|
VendorStatus string `orm:"size(255)" json:"vendorStatus"` // 平台状态
|
||||||
LockStatusTime time.Time `orm:"type(datetime);null" json:"lockStatusTime"` // last lock status time
|
LockStatus int `json:"lockStatus"` // 当前只支持单一锁定
|
||||||
OrderSeq int `json:"orderSeq"` // 门店订单序号
|
LockStatusTime time.Time `orm:"type(datetime);null" json:"lockStatusTime"` // last lock status time
|
||||||
BuyerComment string `orm:"size(255)" json:"buyerComment"`
|
OrderSeq int `json:"orderSeq"` // 门店订单序号
|
||||||
BusinessType int `json:"businessType"`
|
BuyerComment string `orm:"size(255)" json:"buyerComment"`
|
||||||
ExpectedDeliveredTime time.Time `orm:"type(datetime)" json:"expectedDeliveredTime"` // 预期送达时间
|
BusinessType int `json:"businessType"`
|
||||||
CancelApplyReason string `orm:"size(255)" json:"-"` // ""表示没有申请,不为null表示用户正在取消申请
|
ExpectedDeliveredTime time.Time `orm:"type(datetime)" json:"expectedDeliveredTime"` // 预期送达时间
|
||||||
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
CancelApplyReason string `orm:"size(255)" json:"-"` // ""表示没有申请,不为null表示用户正在取消申请
|
||||||
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统发单,1为门店发单
|
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
||||||
|
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统发单,1为门店发单
|
||||||
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"` // 运单id
|
||||||
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
||||||
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
|
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
|
||||||
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
||||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
||||||
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"`
|
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"`
|
||||||
StatusTime time.Time `orm:"type(datetime)" json:"statusTime"` // last status time
|
StatusTime time.Time `orm:"type(datetime)" json:"statusTime"` // last status time
|
||||||
PickDeadline time.Time `orm:"type(datetime);null" json:"pickDeadline"`
|
PickDeadline time.Time `orm:"type(datetime);null" json:"pickDeadline"`
|
||||||
DeliveryFeeFrom *time.Time `orm:"type(datetime);null" json:"deliveryFeeFrom,omitempty"` // 三方配置费计算的开始基准时间
|
DeliveryFeeFrom *time.Time `orm:"type(datetime);null" json:"deliveryFeeFrom,omitempty"` // 三方配置费计算的开始基准时间
|
||||||
ModelTimeInfo `json:"-"` // 1
|
Flag int `json:"flag"` // 非运单调整相关的其它状态
|
||||||
Flag int `json:"flag"` // 非运单调整相关的其它状态
|
InvoiceTitle string `orm:"size(64)" json:"invoiceTitle"` // 发票抬头
|
||||||
InvoiceTitle string `orm:"size(64)" json:"invoiceTitle"` // 发票抬头
|
InvoiceTaxerID string `orm:"size(32);column(invoice_taxer_id)" json:"invoiceTaxerID"` // 发票纳税人识别码
|
||||||
InvoiceTaxerID string `orm:"size(32);column(invoice_taxer_id)" json:"invoiceTaxerID"` // 发票纳税人识别码
|
InvoiceEmail string `orm:"size(64)" json:"invoiceEmail"` // 发票邮箱
|
||||||
InvoiceEmail string `orm:"size(64)" json:"invoiceEmail"` // 发票邮箱
|
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
FromStoreID int `orm:"column(from_store_id)" json:"fromStoreID"` // 物料配送门店
|
||||||
FromStoreID int `orm:"column(from_store_id)" json:"fromStoreID"` // 物料配送门店
|
EclpOutID string `orm:"column(eclp_out_id)" json:"eclpOutID"` // 物料配送的出库单号
|
||||||
EclpOutID string `orm:"column(eclp_out_id)" json:"eclpOutID"` // 物料配送的出库单号
|
AddressID int64 `orm:"column(address_id)" json:"addressID"` // 配送地址ID
|
||||||
AddressID int64 `orm:"column(address_id)" json:"addressID"` // 配送地址ID
|
EarningType int `json:"earningType"` // 订单结算方式,2为扣点,1为报价
|
||||||
EarningType int `json:"earningType"` // 订单结算方式,2为扣点,1为报价
|
OrderType int `json:"orderType"` // 订单类型,0为普通订单,1为物料订单,2为进货订单
|
||||||
OrderType int `json:"orderType"` // 订单类型,0为普通订单,1为物料订单,2为进货订单
|
OrderPayPercentage int `json:"orderPayPercentage"` // 调价包?
|
||||||
OrderPayPercentage int `json:"orderPayPercentage"` // 调价包?
|
CouponIDs string `orm:"column(coupon_ids)" json:"couponIDs"` // 优惠券IDs(京西商城)
|
||||||
CouponIDs string `orm:"column(coupon_ids)" json:"couponIDs"` // 优惠券IDs(京西商城)
|
NotifyType int `json:"notifyType"` // 0表示没有通知,1表示发的短信,2表示发的语音
|
||||||
NotifyType int `json:"notifyType"` // 0表示没有通知,1表示发的短信,2表示发的语音
|
PhoneAscription string `orm:"column(phone_ascription)" json:"phoneAscription"` // 电话号码归属地,{代表抖音号码归宿地[yes-四川成都]}
|
||||||
PhoneAscription string `orm:"column(phone_ascription)" json:"phoneAscription"` // 电话号码归属地,{代表抖音号码归宿地[yes-四川成都]}
|
PackagePrice int `orm:"size(8);column(package_price);default(0)" json:"packagePrice"` // 门店包装袋金额
|
||||||
|
|
||||||
// 以下只是用于传递数据
|
// 以下只是用于传递数据
|
||||||
OriginalData string `orm:"-" json:"-"`
|
OriginalData string `orm:"-" json:"-"`
|
||||||
Skus []*OrderSku `orm:"-" json:"-"`
|
Skus []*OrderSku `orm:"-" json:"-"`
|
||||||
|
|||||||
@@ -393,14 +393,17 @@ type Store struct {
|
|||||||
OperatorPhone3 string `orm:"size(16)" json:"operatorPhone3"` // 饿百运营人电话
|
OperatorPhone3 string `orm:"size(16)" json:"operatorPhone3"` // 饿百运营人电话
|
||||||
OperatorRole3 string `orm:"size(32)" json:"operatorRole3"` // 饿百运营人组(角色)
|
OperatorRole3 string `orm:"size(32)" json:"operatorRole3"` // 饿百运营人组(角色)
|
||||||
|
|
||||||
PromoteInfo string `orm:"size(255)" json:"promoteInfo"` //门店公告(所有平台统一的公告)
|
PromoteInfo string `orm:"size(255)" json:"promoteInfo"` //门店公告(所有平台统一的公告)
|
||||||
IsBoughtMatter int `json:"isBoughtMatter"` //这周是否申请过物料
|
IsBoughtMatter int `json:"isBoughtMatter"` //这周是否申请过物料
|
||||||
SoundPercentage int `json:"soundPercentage"` //打印机声音大小比例
|
SoundPercentage int `json:"soundPercentage"` //打印机声音大小比例
|
||||||
Banner string `orm:"size(9999)" json:"banner"` //门店商城bannar图
|
Banner string `orm:"size(9999)" json:"banner"` //门店商城bannar图
|
||||||
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
||||||
IsPrintCancelOrder int `orm:"column(is_print_cancel_order)" json:"isPrintCancelOrder"` //是否打印取消订单1是/-1否
|
IsPrintCancelOrder int `orm:"column(is_print_cancel_order)" json:"isPrintCancelOrder"` //是否打印取消订单1是/-1否
|
||||||
IsPrintRefundOrder int `orm:"column(is_print_refund_order)" json:"isPrintRefundOrder"` //是否打印退款订单1是/-1否
|
IsPrintRefundOrder int `orm:"column(is_print_refund_order)" json:"isPrintRefundOrder"` //是否打印退款订单1是/-1否
|
||||||
IDCardHandBack string `orm:"size(255);column(id_card_hand_back)" json:"idCardHandBack"` // 手持身份证背面
|
IDCardHandBack string `orm:"size(255);column(id_card_hand_back)" json:"idCardHandBack"` //手持身份证背面
|
||||||
|
PackageSetting int `orm:"size(8);column(package_setting);default(0)" json:"packageSetting"` //门店包装袋扣费设置
|
||||||
|
PackageSwitch int `orm:"size(8);column(package_switch);default(0)" json:"packageSwitch"` //物料购物单门店购买袋子开关[0打开/1关闭]
|
||||||
|
FreightMarkup int `orm:"size(8);column(freight_markup);default(0)" json:"freightMarkup"` //门店为三方运单时,设置的运营加价
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Store) TableUnique() [][]string {
|
func (*Store) TableUnique() [][]string {
|
||||||
|
|||||||
@@ -80,13 +80,14 @@ func (c *DeliveryHandler) OnWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaapi.CallbackResponse) {
|
func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaapi.CallbackResponse) {
|
||||||
order := c.callbackMsg2Waybill(msg)
|
order, goodsOrder := c.callbackMsg2Waybill(msg)
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), goodsOrder.JxStoreID, goodsOrder.VendorID, goodsOrder.VendorOrgCode)
|
||||||
switch msg.OrderStatus {
|
switch msg.OrderStatus {
|
||||||
case dadaapi.OrderStatusWaitingForAccept:
|
case dadaapi.OrderStatusWaitingForAccept:
|
||||||
dadaOrder, err := api.DadaAPI.QueryOrderInfo(msg.OrderID)
|
dadaOrder, err := api.DadaAPI.QueryOrderInfo(msg.OrderID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
order.ActualFee = jxutils.StandardPrice2Int(dadaOrder.ActualFee)
|
order.ActualFee = jxutils.StandardPrice2Int(dadaOrder.ActualFee)
|
||||||
order.DesiredFee = jxutils.StandardPrice2Int(dadaOrder.DeliveryFee)
|
order.DesiredFee = jxutils.StandardPrice2Int(dadaOrder.DeliveryFee) + int64(store.FreightMarkup)
|
||||||
}
|
}
|
||||||
order.Status = model.WaybillStatusNew
|
order.Status = model.WaybillStatusNew
|
||||||
case dadaapi.OrderStatusAccepted:
|
case dadaapi.OrderStatusAccepted:
|
||||||
@@ -94,7 +95,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
|
|||||||
order.Remark = order.CourierName + "," + order.CourierMobile
|
order.Remark = order.CourierName + "," + order.CourierMobile
|
||||||
if dadaOrder, err := api.DadaAPI.QueryOrderInfo(msg.OrderID); err == nil {
|
if dadaOrder, err := api.DadaAPI.QueryOrderInfo(msg.OrderID); err == nil {
|
||||||
order.ActualFee = jxutils.StandardPrice2Int(dadaOrder.ActualFee)
|
order.ActualFee = jxutils.StandardPrice2Int(dadaOrder.ActualFee)
|
||||||
order.DesiredFee = jxutils.StandardPrice2Int(dadaOrder.DeliveryFee)
|
order.DesiredFee = jxutils.StandardPrice2Int(dadaOrder.DeliveryFee) + int64(store.FreightMarkup)
|
||||||
}
|
}
|
||||||
case dadaapi.OrderStatusReturningInOrder:
|
case dadaapi.OrderStatusReturningInOrder:
|
||||||
order.Status = model.WaybillStatusCourierArrived
|
order.Status = model.WaybillStatusCourierArrived
|
||||||
@@ -161,7 +162,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVal *model.Waybill) {
|
func (c *DeliveryHandler) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVal *model.Waybill, goods *model.GoodsOrder) {
|
||||||
retVal = &model.Waybill{
|
retVal = &model.Waybill{
|
||||||
VendorWaybillID: msg.ClientID,
|
VendorWaybillID: msg.ClientID,
|
||||||
WaybillVendorID: model.VendorIDDada,
|
WaybillVendorID: model.VendorIDDada,
|
||||||
@@ -179,12 +180,11 @@ func (c *DeliveryHandler) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVal
|
|||||||
retVal.StatusTime = utils.Timestamp2Time(updateTime)
|
retVal.StatusTime = utils.Timestamp2Time(updateTime)
|
||||||
retVal.VendorOrderID, retVal.OrderVendorID = jxutils.SplitUniversalOrderID(msg.OrderID)
|
retVal.VendorOrderID, retVal.OrderVendorID = jxutils.SplitUniversalOrderID(msg.OrderID)
|
||||||
|
|
||||||
var good *model.GoodsOrder
|
|
||||||
sql := `SELECT * FROM goods_order WHERE vendor_order_id = ? ORDER BY order_created_at DESC LIMIT 1 OFFSET 0`
|
sql := `SELECT * FROM goods_order WHERE vendor_order_id = ? ORDER BY order_created_at DESC LIMIT 1 OFFSET 0`
|
||||||
sqlParams := []interface{}{msg.OrderID}
|
sqlParams := []interface{}{msg.OrderID}
|
||||||
dao.GetRow(dao.GetDB(), &good, sql, sqlParams)
|
dao.GetRow(dao.GetDB(), &goods, sql, sqlParams)
|
||||||
retVal.OrderVendorID = good.VendorID
|
retVal.OrderVendorID = goods.VendorID
|
||||||
return retVal
|
return retVal, goods
|
||||||
}
|
}
|
||||||
|
|
||||||
func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.ShopInfo) {
|
func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.ShopInfo) {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
|||||||
|
|
||||||
// 蜂鸟门店状态改变
|
// 蜂鸟门店状态改变
|
||||||
func OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify) (retVal *fnpsapi.CallbackResponse) {
|
func OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify) (retVal *fnpsapi.CallbackResponse) {
|
||||||
return curDeliveryHandler.OnStoreStatus(msg)
|
return CurDeliveryHandler.OnStoreStatus(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改本地门店审核状态
|
// 修改本地门店审核状态
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
curDeliveryHandler *DeliveryHandler
|
CurDeliveryHandler *DeliveryHandler
|
||||||
complaintReson2FnResonMap = map[int]int{
|
complaintReson2FnResonMap = map[int]int{
|
||||||
model.ComplaintReasons1: ComplaintReasonsFn160,
|
model.ComplaintReasons1: ComplaintReasonsFn160,
|
||||||
model.ComplaintReasons2: ComplaintReasonsFn130,
|
model.ComplaintReasons2: ComplaintReasonsFn130,
|
||||||
@@ -53,10 +54,8 @@ type DeliveryHandler struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if api.FnAPI != nil {
|
CurDeliveryHandler = new(DeliveryHandler)
|
||||||
curDeliveryHandler = new(DeliveryHandler)
|
partner.RegisterDeliveryPlatform(CurDeliveryHandler, true)
|
||||||
partner.RegisterDeliveryPlatform(curDeliveryHandler, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) GetVendorID() int {
|
func (c *DeliveryHandler) GetVendorID() int {
|
||||||
@@ -249,14 +248,17 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta
|
|||||||
}
|
}
|
||||||
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(cc.PartnerOrderCode)
|
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(cc.PartnerOrderCode)
|
||||||
order.OrderVendorID = good.VendorID
|
order.OrderVendorID = good.VendorID
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), good.JxStoreID, good.VendorID, good.VendorOrgCode)
|
||||||
|
|
||||||
orderStatus := utils.Str2Int64(order.VendorStatus)
|
orderStatus := utils.Str2Int64(order.VendorStatus)
|
||||||
switch orderStatus {
|
switch orderStatus {
|
||||||
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 0 创建订单
|
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 0 创建订单
|
||||||
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||||
order.Status = model.WaybillStatusNew //5 带调度
|
order.DesiredFee += int64(store.FreightMarkup) // 运营加价
|
||||||
|
order.Status = model.WaybillStatusNew //5 带调度
|
||||||
case fnpsapi.OrderStatusAssigned: //20分配骑手
|
case fnpsapi.OrderStatusAssigned: //20分配骑手
|
||||||
//order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||||
|
order.DesiredFee += int64(store.FreightMarkup)
|
||||||
order.Status = model.WaybillStatusCourierAssigned //12
|
order.Status = model.WaybillStatusCourierAssigned //12
|
||||||
order.Remark = order.CourierName + "," + order.CourierMobile
|
order.Remark = order.CourierName + "," + order.CourierMobile
|
||||||
case fnpsapi.OrderStatusArrived: // 80 到店
|
case fnpsapi.OrderStatusArrived: // 80 到店
|
||||||
@@ -323,7 +325,7 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta
|
|||||||
|
|
||||||
// 异常报备
|
// 异常报备
|
||||||
func OnWaybillExceptFn(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
|
func OnWaybillExceptFn(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
|
||||||
return curDeliveryHandler.OnWaybillExcept(msg)
|
return CurDeliveryHandler.OnWaybillExcept(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
|
func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
|
||||||
@@ -487,3 +489,31 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
|||||||
}
|
}
|
||||||
return vendorPrice, nil
|
return vendorPrice, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (lng, lat float64, err error) {
|
||||||
|
order, err := api.FnAPI.GetKnightInfo(&fnpsapi.GetOrderDetailReq{
|
||||||
|
PartnerOrderCode: vendorOrderID,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
lng = utils.Str2Float64WithDefault(order.CarrierDriverLongitude, 0)
|
||||||
|
lat = utils.Str2Float64WithDefault(order.CarrierDriverLatitude, 0)
|
||||||
|
}
|
||||||
|
return lng, lat, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DeliveryHandler) UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error) {
|
||||||
|
return api.FnAPI.AddTip(&fnpsapi.AddTipRes{
|
||||||
|
OrderId: "",
|
||||||
|
PartnerOrderCode: vendorOrderID,
|
||||||
|
AddTipAmountCent: tipFee,
|
||||||
|
ThirdIndexId: time.Now().Unix(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DeliveryHandler) GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error) {
|
||||||
|
order, err := api.FnAPI.QueryOrder(vendorOrderID)
|
||||||
|
if err == nil {
|
||||||
|
tipFee = order.OrderTipAmountCent
|
||||||
|
}
|
||||||
|
return tipFee, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *mtpsapi.CallbackOrderExceptionMsg
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) {
|
func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) {
|
||||||
order := c.callbackMsg2Waybill(msg)
|
order, goodsOrder := c.callbackMsg2Waybill(msg)
|
||||||
// 多次取消,只处理第一次
|
// 多次取消,只处理第一次
|
||||||
if msg.Status == mtpsapi.OrderStatusCanceled {
|
if msg.Status == mtpsapi.OrderStatusCanceled {
|
||||||
orderStatus, _ := orderman.FixedOrderManager.GetWayBillStatusList(msg.OrderID, msg.MtPeisongID, model.VendorIDMTPS)
|
orderStatus, _ := orderman.FixedOrderManager.GetWayBillStatusList(msg.OrderID, msg.MtPeisongID, model.VendorIDMTPS)
|
||||||
@@ -96,6 +96,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), goodsOrder.JxStoreID, goodsOrder.VendorID, goodsOrder.VendorOrgCode)
|
||||||
switch msg.Status {
|
switch msg.Status {
|
||||||
case mtpsapi.OrderStatusWaitingForSchedule:
|
case mtpsapi.OrderStatusWaitingForSchedule:
|
||||||
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
|
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
|
||||||
@@ -104,6 +105,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
|
|||||||
}
|
}
|
||||||
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
|
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
|
||||||
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
|
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
|
||||||
|
order.DesiredFee += int64(store.FreightMarkup)
|
||||||
order.Status = model.WaybillStatusNew
|
order.Status = model.WaybillStatusNew
|
||||||
case mtpsapi.OrderStatusAccepted: // 已接单
|
case mtpsapi.OrderStatusAccepted: // 已接单
|
||||||
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
|
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
|
||||||
@@ -112,6 +114,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
|
|||||||
}
|
}
|
||||||
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
|
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
|
||||||
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
|
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
|
||||||
|
order.DesiredFee += int64(store.FreightMarkup)
|
||||||
order.Status = model.WaybillStatusCourierAssigned
|
order.Status = model.WaybillStatusCourierAssigned
|
||||||
order.Remark = order.CourierName + "," + order.CourierMobile
|
order.Remark = order.CourierName + "," + order.CourierMobile
|
||||||
case mtpsapi.OrderStatusPickedUp: // 已取货
|
case mtpsapi.OrderStatusPickedUp: // 已取货
|
||||||
@@ -230,7 +233,7 @@ func signParams(params url.Values) string {
|
|||||||
return fmt.Sprintf("%x", sha1.Sum([]byte(finalStr)))
|
return fmt.Sprintf("%x", sha1.Sum([]byte(finalStr)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (retVal *model.Waybill) {
|
func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (retVal *model.Waybill, good2 *model.GoodsOrder) {
|
||||||
retVal = &model.Waybill{
|
retVal = &model.Waybill{
|
||||||
VendorWaybillID: msg.MtPeisongID,
|
VendorWaybillID: msg.MtPeisongID,
|
||||||
VendorWaybillID2: utils.Int64ToStr(msg.DeliveryID),
|
VendorWaybillID2: utils.Int64ToStr(msg.DeliveryID),
|
||||||
@@ -250,7 +253,7 @@ func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (re
|
|||||||
} else {
|
} else {
|
||||||
retVal.OrderVendorID = good.VendorID
|
retVal.OrderVendorID = good.VendorID
|
||||||
}
|
}
|
||||||
return retVal
|
return retVal, good
|
||||||
}
|
}
|
||||||
|
|
||||||
// 老方法是自己计算
|
// 老方法是自己计算
|
||||||
@@ -548,3 +551,13 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
|||||||
}
|
}
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *DeliveryHandler) UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error) {
|
||||||
|
// 无法获取已经添加的小费金额
|
||||||
|
return fmt.Errorf("美团暂不支持添加小费")
|
||||||
|
//return api.MtpsAPI.AddTip(vendorOrderID, vendorWaybillID, tipFee)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DeliveryHandler) GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error) {
|
||||||
|
return tipFee, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -140,9 +140,10 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//+0.2
|
// 系统加价
|
||||||
desiredFee := utils.Float64TwoInt(sfTotalPrice) + utils.WayBillDeliveryMarkUp
|
desiredFee := utils.Float64TwoInt(sfTotalPrice) + utils.WayBillDeliveryMarkUp
|
||||||
|
// 运营加价
|
||||||
|
desiredFee += store.FreightMarkup
|
||||||
bill = &model.Waybill{
|
bill = &model.Waybill{
|
||||||
VendorOrderID: order.VendorOrderID,
|
VendorOrderID: order.VendorOrderID,
|
||||||
OrderVendorID: order.VendorID,
|
OrderVendorID: order.VendorID,
|
||||||
@@ -222,8 +223,6 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo
|
|||||||
}
|
}
|
||||||
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
||||||
price, err := api.SfPsAPI.PreCreateOrder(param)
|
price, err := api.SfPsAPI.PreCreateOrder(param)
|
||||||
//+0.2
|
|
||||||
//deliveryFee := utils.Float64TwoInt(price) + utils.WayBillDeliveryMarkUp
|
|
||||||
deliveryFeeInfo.DeliveryFee = utils.Float64TwoInt64(price)
|
deliveryFeeInfo.DeliveryFee = utils.Float64TwoInt64(price)
|
||||||
globals.SugarLogger.Debugf("GetWaybillFee deliveryFeeInfo.DeliveryFee=%d", deliveryFeeInfo.DeliveryFee)
|
globals.SugarLogger.Debugf("GetWaybillFee deliveryFeeInfo.DeliveryFee=%d", deliveryFeeInfo.DeliveryFee)
|
||||||
return deliveryFeeInfo, err
|
return deliveryFeeInfo, err
|
||||||
@@ -343,8 +342,7 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
|
|||||||
order.CourierMobile = sfOrder.RiderPhone
|
order.CourierMobile = sfOrder.RiderPhone
|
||||||
}
|
}
|
||||||
|
|
||||||
//+0.2
|
sfTotalPrice := utils.Float64TwoInt(sfOrder.TotalPrice)
|
||||||
sfTotalPrice := utils.Float64TwoInt(sfOrder.TotalPrice) + utils.WayBillDeliveryMarkUp
|
|
||||||
sfActualPrice := utils.Float64TwoInt64(sfOrder.RealPayMoney)
|
sfActualPrice := utils.Float64TwoInt64(sfOrder.RealPayMoney)
|
||||||
globals.SugarLogger.Debugf("SFPS OnWaybillMsg,sfTotalPrice=%d,sfActualPrice=%d", sfTotalPrice, sfActualPrice)
|
globals.SugarLogger.Debugf("SFPS OnWaybillMsg,sfTotalPrice=%d,sfActualPrice=%d", sfTotalPrice, sfActualPrice)
|
||||||
|
|
||||||
@@ -354,6 +352,9 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
|
|||||||
dao.GetRow(dao.GetDB(), &good, sql, sqlParams)
|
dao.GetRow(dao.GetDB(), &good, sql, sqlParams)
|
||||||
order.OrderVendorID = good.VendorID
|
order.OrderVendorID = good.VendorID
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), good.JxStoreID, good.VendorID, good.VendorOrgCode)
|
||||||
|
sfTotalPrice += store.FreightMarkup
|
||||||
|
|
||||||
orderStatus := utils.Str2Int64(order.VendorStatus)
|
orderStatus := utils.Str2Int64(order.VendorStatus)
|
||||||
switch orderStatus {
|
switch orderStatus {
|
||||||
case sfps2.OrderStatusNewOrder: //1:订单创建
|
case sfps2.OrderStatusNewOrder: //1:订单创建
|
||||||
|
|||||||
@@ -341,6 +341,10 @@ func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResp
|
|||||||
} else {
|
} else {
|
||||||
reallyPrice = int64(utils.Str2Float64(uuPrice.OrderPrice) * 100)
|
reallyPrice = int64(utils.Str2Float64(uuPrice.OrderPrice) * 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), good.JxStoreID, good.VendorID, good.VendorOrgCode)
|
||||||
|
reallyPrice += int64(store.FreightMarkup)
|
||||||
|
|
||||||
actualFee := int64((utils.Str2Float64(uuPrice.OrderPrice)-utils.Str2Float64(uuPrice.PriceOff))*100) - int64(utils.WayBillDeliveryMarkUp)
|
actualFee := int64((utils.Str2Float64(uuPrice.OrderPrice)-utils.Str2Float64(uuPrice.PriceOff))*100) - int64(utils.WayBillDeliveryMarkUp)
|
||||||
switch req.State {
|
switch req.State {
|
||||||
case uuptapi.StateConfirmSuccess:
|
case uuptapi.StateConfirmSuccess:
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ type IPurchasePlatformOrderHandler interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IAddWaybillTip interface {
|
type IAddWaybillTip interface {
|
||||||
|
// GetWaybillTip 获取添加小费
|
||||||
GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error)
|
GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error)
|
||||||
|
// UpdateWaybillTip 添加小费
|
||||||
UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error)
|
UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee int64) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -310,6 +310,10 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
giftSkus, discountMoney := getZengSkus(vendorOrderID, orderData)
|
giftSkus, discountMoney := getZengSkus(vendorOrderID, orderData)
|
||||||
order.DiscountMoney = discountMoney
|
order.DiscountMoney = discountMoney
|
||||||
order.Skus = append(order.Skus, giftSkus...)
|
order.Skus = append(order.Skus, giftSkus...)
|
||||||
|
|
||||||
|
// 包装袋金额设置
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
|
order.PackagePrice = store.PackageSetting
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,6 +350,9 @@ func Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
|||||||
}
|
}
|
||||||
order.Skus = append(order.Skus, sku)
|
order.Skus = append(order.Skus, sku)
|
||||||
}
|
}
|
||||||
|
// 包装袋金额设置
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
|
order.PackagePrice = store.PackageSetting
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
|||||||
if order.ExpectedDeliveredTime.Sub(order.OrderCreatedAt) <= time.Hour+time.Minute {
|
if order.ExpectedDeliveredTime.Sub(order.OrderCreatedAt) <= time.Hour+time.Minute {
|
||||||
order.BusinessType = model.BusinessTypeImmediate
|
order.BusinessType = model.BusinessTypeImmediate
|
||||||
}
|
}
|
||||||
// buildOrderTo102919(order)
|
order.PackagePrice = store.PackageSetting
|
||||||
return order, err
|
return order, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func OnKSPayCallback(msg *kuaishou_mini.CallBackDetail, refund *kuaishou_mini.Re
|
|||||||
func onKSPayFinished(msg *kuaishou_mini.CallBackDetail) (err error) {
|
func onKSPayFinished(msg *kuaishou_mini.CallBackDetail) (err error) {
|
||||||
orderPay := &model.OrderPay{
|
orderPay := &model.OrderPay{
|
||||||
PayOrderID: msg.OutOrderNo,
|
PayOrderID: msg.OutOrderNo,
|
||||||
PayType: model.PayTypeTicTok,
|
PayType: model.PayTypeKuaiShou,
|
||||||
}
|
}
|
||||||
orderPay.DeletedAt = utils.DefaultTimeValue
|
orderPay.DeletedAt = utils.DefaultTimeValue
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
@@ -162,7 +162,7 @@ func RefundOrderByKS(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID
|
|||||||
OutRefundNo: refundID,
|
OutRefundNo: refundID,
|
||||||
Reason: refundDesc,
|
Reason: refundDesc,
|
||||||
Attach: "",
|
Attach: "",
|
||||||
NotifyUrl: "http://callback.jxc4.com/kuaishou/kuaiShouCallback",
|
NotifyUrl: "https://callback.jxc4.com/kuaishou/kuaiShouCallback",
|
||||||
RefundAmount: int64(orderPay.TotalFee),
|
RefundAmount: int64(orderPay.TotalFee),
|
||||||
Sign: "",
|
Sign: "",
|
||||||
MultiCopiesGoodsInfo: "",
|
MultiCopiesGoodsInfo: "",
|
||||||
|
|||||||
@@ -1228,6 +1228,9 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd
|
|||||||
if IsDeliverySelf {
|
if IsDeliverySelf {
|
||||||
order.DeliveryType = model.OrderDeliveryTypeSelfTake
|
order.DeliveryType = model.OrderDeliveryTypeSelfTake
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
|
order.PackagePrice = store.PackageSetting
|
||||||
return order, err
|
return order, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,10 +245,8 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ignoreSkuMap := make(map[int]int)
|
ignoreSkuMap := make(map[int]int)
|
||||||
// detail := result["detail"].([]interface{})
|
|
||||||
multiSkuMap := make(map[int]int)
|
multiSkuMap := make(map[int]int)
|
||||||
for _, product := range detail {
|
for _, product := range detail {
|
||||||
// product := product2.(map[string]interface{})
|
|
||||||
skuName := product["food_name"].(string)
|
skuName := product["food_name"].(string)
|
||||||
skuID := utils.Interface2String(product["sku_id"])
|
skuID := utils.Interface2String(product["sku_id"])
|
||||||
sku := &model.OrderSku{
|
sku := &model.OrderSku{
|
||||||
@@ -296,9 +294,6 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
if sku.SalePrice < 0 {
|
if sku.SalePrice < 0 {
|
||||||
sku.SalePrice = jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"]))
|
sku.SalePrice = jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"]))
|
||||||
}
|
}
|
||||||
// if product["isGift"].(bool) {
|
|
||||||
// sku.SkuType = 1
|
|
||||||
// }
|
|
||||||
order.Skus = append(order.Skus, sku)
|
order.Skus = append(order.Skus, sku)
|
||||||
multiSkuMap[sku.SkuID]++
|
multiSkuMap[sku.SkuID]++
|
||||||
}
|
}
|
||||||
@@ -308,6 +303,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 包装袋金额设置
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
|
order.PackagePrice = store.PackageSetting
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma
|
|||||||
for _, sku := range refundData.FoodList {
|
for _, sku := range refundData.FoodList {
|
||||||
orderSku := &model.OrderSkuFinancial{
|
orderSku := &model.OrderSkuFinancial{
|
||||||
// VendorID: model.VendorIDMTWM,
|
// VendorID: model.VendorIDMTWM,
|
||||||
// AfsOrderID: afsOrder.AfsOrderID,
|
AfsOrderID: afsOrder.AfsOrderID,
|
||||||
// VendorOrderID: afsOrder.VendorOrderID,
|
// VendorOrderID: afsOrder.VendorOrderID,
|
||||||
// VendorStoreID: afsOrder.VendorStoreID,
|
// VendorStoreID: afsOrder.VendorStoreID,
|
||||||
// StoreID: afsOrder.StoreID,
|
// StoreID: afsOrder.StoreID,
|
||||||
// IsAfsOrder: 1,
|
IsAfsOrder: 1,
|
||||||
|
|
||||||
Count: sku.Count,
|
Count: sku.Count,
|
||||||
// ConfirmTime: afsOrder.AfsCreateAt,
|
// ConfirmTime: afsOrder.AfsCreateAt,
|
||||||
@@ -120,6 +120,10 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma
|
|||||||
Name: sku.FoodName,
|
Name: sku.FoodName,
|
||||||
UserMoney: jxutils.StandardPrice2Int(sku.RefundPrice)*int64(sku.Count) + jxutils.StandardPrice2Int(sku.BoxPrice)*int64(sku.BoxNum),
|
UserMoney: jxutils.StandardPrice2Int(sku.RefundPrice)*int64(sku.Count) + jxutils.StandardPrice2Int(sku.BoxPrice)*int64(sku.BoxNum),
|
||||||
}
|
}
|
||||||
|
if orderSku.VendorSkuID == "" || orderSku.VendorSkuID == "0" {
|
||||||
|
orderSku.VendorSkuID = sku.AppFoodCode
|
||||||
|
}
|
||||||
|
|
||||||
afsOrder.SkuUserMoney += orderSku.UserMoney
|
afsOrder.SkuUserMoney += orderSku.UserMoney
|
||||||
afsOrder.Skus = append(afsOrder.Skus, orderSku)
|
afsOrder.Skus = append(afsOrder.Skus, orderSku)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
|
|||||||
salePrice += sku.SalePrice
|
salePrice += sku.SalePrice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//order.TotalShopMoney = utils.Float64TwoInt64(float64(salePrice) * 0.95) // 抖音平台扣点金额0.05
|
|
||||||
|
|
||||||
//order.DeliveryType = model.OrderDeliveryTypeStoreSelf
|
|
||||||
autoTransport, err := GetStoreAutoCallRiderInfo(vendorOrgCode, []int64{utils.Str2Int64(vendorStoreIdRelly)})
|
autoTransport, err := GetStoreAutoCallRiderInfo(vendorOrgCode, []int64{utils.Str2Int64(vendorStoreIdRelly)})
|
||||||
if err != nil || len(autoTransport) == 0 {
|
if err != nil || len(autoTransport) == 0 {
|
||||||
order.DeliveryType = model.OrderDeliveryTypePlatform
|
order.DeliveryType = model.OrderDeliveryTypePlatform
|
||||||
@@ -195,20 +193,6 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单不在门店营业时间来的订单,
|
|
||||||
//openTime := localStore.OpenTime1 // 门店开始营业时间
|
|
||||||
//closeTime := localStore.CloseTime1 // 门店结束营业时间
|
|
||||||
//if localStore.CloseTime2 != 0 {
|
|
||||||
// closeTime = localStore.CloseTime2
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//h, m, _ := order.ExpectedDeliveredTime.Clock()
|
|
||||||
//if order.ExpectedDeliveredTime.Day() == time.Now().Day() && utils.Str2Int16(fmt.Sprintf("%d%d", h, m)) >= openTime && utils.Str2Int16(fmt.Sprintf("%d%d", h, m)) < closeTime && localStore.Status == model.StoreStatusOpened {
|
|
||||||
// order.BusinessType = model.BusinessTypeImmediate
|
|
||||||
//} else {
|
|
||||||
// order.BusinessType = model.BusinessTypeDingshida
|
|
||||||
//}
|
|
||||||
|
|
||||||
if result.EarlyArrival { // 立即达
|
if result.EarlyArrival { // 立即达
|
||||||
order.BusinessType = model.BusinessTypeImmediate
|
order.BusinessType = model.BusinessTypeImmediate
|
||||||
order.ExpectedDeliveredTime = getTimeFromTimestamp(result.TargetArrivalTime + 30*60) // 预计最晚送达时间
|
order.ExpectedDeliveredTime = getTimeFromTimestamp(result.TargetArrivalTime + 30*60) // 预计最晚送达时间
|
||||||
@@ -239,7 +223,6 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
|
|||||||
|
|
||||||
// 抖音订单手机号和收货地址是否同城
|
// 抖音订单手机号和收货地址是否同城
|
||||||
order.PhoneAscription = ""
|
order.PhoneAscription = ""
|
||||||
//ascription, err := phonedata.Find(order.ConsigneeMobile)
|
|
||||||
ascription, err := ascription_place.Find(order.ConsigneeMobile)
|
ascription, err := ascription_place.Find(order.ConsigneeMobile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + err.Error()
|
order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + err.Error()
|
||||||
@@ -250,7 +233,8 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
|
|||||||
order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + "归属信息不匹配:" + ascription.Province + ascription.City
|
order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + "归属信息不匹配:" + ascription.Province + ascription.City
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
|
order.PackagePrice = store.PackageSetting
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
return order, orderMap, nil
|
return order, orderMap, nil
|
||||||
}
|
}
|
||||||
@@ -310,15 +294,6 @@ func (c *PurchaseHandler) onOrderMsg(msgId, orderId string, msg interface{}) (re
|
|||||||
return tiktokShop.Err2CallbackResponse(nil, "")
|
return tiktokShop.Err2CallbackResponse(nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消订单:可能未支付取消订单,不做处理
|
|
||||||
//if msgId == tiktokShop.CallbackCancelOrderMsgTagId {
|
|
||||||
// if _, err := partner.CurOrderManager.LoadOrder(orderId, model.VendorIDDD); err != nil && strings.Contains(err.Error(), "找不到相应订单") {
|
|
||||||
// return tiktokShop.Err2CallbackResponse(nil, "")
|
|
||||||
// } else {
|
|
||||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// 组装订单状态变化
|
// 组装订单状态变化
|
||||||
status, appOrgCode := c.callbackMsg2Status(msgId, orderId, msg)
|
status, appOrgCode := c.callbackMsg2Status(msgId, orderId, msg)
|
||||||
// 校验重复消息
|
// 校验重复消息
|
||||||
|
|||||||
@@ -110,9 +110,8 @@ func (c *DjswController) OrderCommentPush() {
|
|||||||
|
|
||||||
func (c *DjswController) Token() {
|
func (c *DjswController) Token() {
|
||||||
urlValues, err := utils.HTTPBody2Values(c.Ctx.Input.RequestBody, false)
|
urlValues, err := utils.HTTPBody2Values(c.Ctx.Input.RequestBody, false)
|
||||||
if err == nil {
|
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
|
||||||
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
|
globals.SugarLogger.Info(utils.Format4Output(utils.Format4Output(err, false), false))
|
||||||
}
|
|
||||||
jd.OnTokenChange(urlValues)
|
jd.OnTokenChange(urlValues)
|
||||||
c.Data["json"] = c.transferResponse("Token", nil)
|
c.Data["json"] = c.transferResponse("Token", nil)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/baseapi/platformapi/kuaishou_mini"
|
"git.rosy.net.cn/baseapi/platformapi/kuaishou_mini"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
)
|
)
|
||||||
@@ -16,10 +14,6 @@ type KuaiShouController struct {
|
|||||||
// KuaiShouCallBack 快手回调
|
// KuaiShouCallBack 快手回调
|
||||||
func (c *KuaiShouController) KuaiShouCallback() {
|
func (c *KuaiShouController) KuaiShouCallback() {
|
||||||
payOrder, refundOrder, payType, msgId, err := api.KuaiShouApi.KauiShouCallback(c.Ctx.Request)
|
payOrder, refundOrder, payType, msgId, err := api.KuaiShouApi.KauiShouCallback(c.Ctx.Request)
|
||||||
globals.SugarLogger.Debugf("KuaiShouCallBack payOrder =: %s", utils.Format4Output(payOrder, false))
|
|
||||||
globals.SugarLogger.Debugf("KuaiShouCallBack refundOrder=: %s", refundOrder)
|
|
||||||
globals.SugarLogger.Debugf("KuaiShouCallBack payType=: %s", payType)
|
|
||||||
globals.SugarLogger.Debugf("KuaiShouCallBack err=: %s", utils.Format4Output(err, false))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Data["json"] = CallBackFail(msgId)
|
c.Data["json"] = CallBackFail(msgId)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
|
|||||||
Reference in New Issue
Block a user