This commit is contained in:
苏尹岚
2020-09-29 10:22:00 +08:00
parent 33f0c52038
commit e33dd48728
2 changed files with 39 additions and 1 deletions

View File

@@ -1876,6 +1876,16 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int,
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID)
valid := dao.StrictMakeMapByStructObject(payload, order, ctx.GetUserName())
if len(valid) > 0 {
if payload["consigneeLng"] != nil || payload["consigneeLat"] != nil {
intLng := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["consigneeLng"], 0.0))
intLat := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["consigneeLat"], 0.0))
if intLng != 0 && intLng != order.ConsigneeLng {
valid["consigneeLng"] = intLng
}
if intLat != 0 && intLat != order.ConsigneeLat {
valid["consigneeLat"] = intLat
}
}
dao.Begin(db)
defer func() {
if r := recover(); r != nil {

View File

@@ -1585,7 +1585,35 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// fmt.Println("deleteList2", deleteList)
// cms.DeletedDuplicateWaitAuditData(ctx, dao.GetDB())
// orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -2).Format("20060102"), time.Now().Format("20060102"))
var (
db = dao.GetDB()
goods []*model.GoodsOrder
)
sql := `SELECT * from goods_order where vendor_id = 0 and buyer_comment = '【JD】' and total_shop_money = 0 and status = 110
AND order_created_at > '2020-09-01'`
dao.GetRows(db, &goods, sql, nil)
for _, order2 := range goods {
results, err := api.JdAPI.GetJdShopOrders(order2.OrderCreatedAt.AddDate(0, 0, -1).Format("20060102"), order2.OrderCreatedAt.Format("20060102"), globals.JdOrgCode, globals.JdLoginName)
if err != nil {
return err
}
for _, v := range results.BillList.Result {
if v.DueAmount != 0 {
order, _ := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(v.OrderID), model.VendorIDJD)
stores, _ := dao.GetStoreList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, nil, nil, "")
if len(stores) > 0 {
store := stores[0]
if order.NewEarningPrice == 0 {
jxutils.RefreshOrderEarningPrice2(order, store.PayPercentage)
}
if order.TotalShopMoney == 0 {
order.TotalShopMoney = utils.Float64TwoInt64(v.DueAmount * 100)
}
dao.UpdateEntity(db, order, "TotalShopMoney", "NewEarningPrice")
}
}
}
}
return err
}