From cef54e63427bd67a41a72e27fb6f18d7bd60e236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 9 Mar 2020 14:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E4=B8=8B=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 81 ++++++++++--------- conf/app.conf | 3 +- globals/api/api.go | 2 +- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index c9fd16797..3c5d7d284 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -10,6 +10,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxstore/event" "git.rosy.net.cn/jx-callback/globals" + "git.rosy.net.cn/baseapi/platformapi/jdeclpapi" "git.rosy.net.cn/baseapi/platformapi/wxpayapi" "git.rosy.net.cn/jx-callback/globals/api" @@ -594,47 +595,47 @@ func PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string) func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) { if order.FromStoreID != 0 { - // var ( - // goodsNos []string - // prices []int - // quantities []int - // db = dao.GetDB() - // ) + var ( + goodsNos []string + prices []int + quantities []int + db = dao.GetDB() + ) err = changeOrderStatus(order.VendorOrderID, model.OrderStatusDelivering, "") - // goods, err := dao.QueryOrders(db, order.VendorOrderID, -1, []int{model.VendorIDJX}, -1, utils.ZeroTimeValue, utils.ZeroTimeValue) - // if err != nil || len(goods) == 0 { - // return err - // } - // for _, v := range goods[0].Skus { - // skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil) - // if err != nil || len(skus) == 0 { - // continue - // } - // goodsNos = append(goodsNos, skus[0].EclpID) - // prices = append(prices, 0) - // quantities = append(quantities, v.Count) - // } - // result, err := api.JdEclpAPI.AddOrder(&jdeclpapi.AddOrderParam{ - // IsvUUID: order.VendorOrderID, - // IsvSource: jdeclpapi.IsvSource, - // ShopNo: jdeclpapi.ShopNo, - // DepartmentNo: jdeclpapi.DepartmentNo, - // WarehouseNo: jdeclpapi.WarehouseNo, - // SalesPlatformOrderNo: order.VendorOrderID, - // SalePlatformSource: "", - // ConsigneeName: order.ConsigneeName, - // ConsigneeMobile: order.ConsigneeMobile, - // ConsigneeAddress: order.ConsigneeAddress, - // OrderMark: jdeclpapi.OrderMark, - // GoodsNo: goodsNos, - // Price: prices, - // Quantity: quantities, - // }) - // if err != nil { - // return err - // } - // order.EclpOutID = result.EclpSoNo - // dao.UpdateEntity(db, order, "EclpOutID") + goods, err := dao.QueryOrders(db, order.VendorOrderID, -1, []int{model.VendorIDJX}, -1, utils.ZeroTimeValue, utils.ZeroTimeValue) + if err != nil || len(goods) == 0 { + return err + } + for _, v := range goods[0].Skus { + skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil) + if err != nil || len(skus) == 0 { + continue + } + goodsNos = append(goodsNos, skus[0].EclpID) + prices = append(prices, 0) + quantities = append(quantities, v.Count) + } + result, err := api.JdEclpAPI.AddOrder(&jdeclpapi.AddOrderParam{ + IsvUUID: order.VendorOrderID, + IsvSource: jdeclpapi.IsvSource, + ShopNo: jdeclpapi.ShopNo, + DepartmentNo: jdeclpapi.DepartmentNo, + WarehouseNo: jdeclpapi.WarehouseNo, + SalesPlatformOrderNo: order.VendorOrderID, + SalePlatformSource: jdeclpapi.SalePlatformSource, + ConsigneeName: order.ConsigneeName, + ConsigneeMobile: order.ConsigneeMobile, + ConsigneeAddress: order.ConsigneeAddress, + OrderMark: jdeclpapi.OrderMark, + GoodsNo: goodsNos, + Price: prices, + Quantity: quantities, + }) + if err != nil { + return err + } + order.EclpOutID = result + dao.UpdateEntity(db, order, "EclpOutID") } return err } diff --git a/conf/app.conf b/conf/app.conf index 64ba82034..04905bd68 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -170,10 +170,9 @@ jd2Token = "29e0e567-c475-433a-aff0-37176ee8d8a7" jd2AppKey = "7fb947624ff847ae94ff2f068cc99652" jd2Secret = "1097abd7ef09427099b4922784af123a" -jdEclpAccessToken = "" +jdEclpAccessToken = "7e9c1a5fe4ac4ea48c3c572d488e60b8hnwz" jdEclpAppKey = "0D397F05CF11C51BCDCC81744680EBC3" jdEclpAppSecret = "f16a5e57ff4f4f428b702c40d2d4b933" -jdEclpRedirectUri = "" elmIsProd = true elmToken = "" diff --git a/globals/api/api.go b/globals/api/api.go index f506af452..1e1fa6cbd 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -108,7 +108,7 @@ func Init() { JdAPI = nil } if !beego.AppConfig.DefaultBool("disableJdEclp", false) { - JdEclpAPI = jdeclpapi.New(beego.AppConfig.String("jdEclpAccessToken"), beego.AppConfig.String("jdEclpAppKey"), beego.AppConfig.String("jdEclpAppSecret"), beego.AppConfig.String("jdEclpRedirectUri")) + JdEclpAPI = jdeclpapi.New(beego.AppConfig.String("jdEclpAccessToken"), beego.AppConfig.String("jdEclpAppKey"), beego.AppConfig.String("jdEclpAppSecret")) } else { JdEclpAPI = nil }