From 9685b8a06ed503457bbd1b8a42c33f1d53902fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 12 Aug 2020 18:21:42 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=8F=96=E6=B6=88=E4=B8=8D=E5=8F=91?= =?UTF-8?q?=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 6df00277d..f968a207f 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -361,12 +361,16 @@ func ModifyOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool) (e for _, sku := range skus { storeSkus, _ := dao.GetStoresSkusInfo(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, []int{sku.SkuID}) if len(storeSkus) == 0 { - globals.SugarLogger.Warnf("此订单商品没得storsku,%v,%v", order.VendorOrderID, sku.SkuID) + if !isAdd { + globals.SugarLogger.Warnf("此订单商品没得storsku,%v,%v", order.VendorOrderID, sku.SkuID) + } continue } storeSku, stock := storeSkus[0], 0 if storeSku.Stock == 0 { - globals.SugarLogger.Warnf("此订单商品库存为0,%v,%v", order.VendorOrderID, sku.SkuID) + if !isAdd { + globals.SugarLogger.Warnf("此订单商品库存为0,%v,%v", order.VendorOrderID, sku.SkuID) + } continue } if isAdd { From 20abc54e364a84c00d551d8e96fde8085f80fcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 08:47:49 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=91=E9=85=8D?= =?UTF-8?q?=E9=80=81=E4=B8=8D=E5=9C=A8=E8=90=A5=E4=B8=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jxcallback/scheduler/defsch/defsch.go | 26 +++++++++++++++++-- .../jxcallback/scheduler/defsch/defsch_ext.go | 22 ---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index d67ec8997..cfe2d1d84 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -736,8 +736,30 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf // if order.VendorID == model.VendorIDJX { // excludeVendorIDs = append(excludeVendorIDs, model.VendorIDMTPS) // } - if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { - savedOrderInfo.retryCount++ + if savedOrderInfo != nil { + //TODO 2020-07-21 发单时间要在门店的营业时间内 + if savedOrderInfo.storeDetail != nil { + if savedOrderInfo.storeDetail.OpenTime1 != 0 && savedOrderInfo.storeDetail.CloseTime1 != 0 { + time1 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime1, time.Now()) + time2 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime1, time.Now()) + if time.Now().Sub(time1) < 0 || time.Now().Sub(time2) > 0 { + if savedOrderInfo.storeDetail.OpenTime2 != 0 && savedOrderInfo.storeDetail.CloseTime2 != 0 { + time3 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime2, time.Now()) + time4 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime2, time.Now()) + if time.Now().Sub(time3) < 0 || time.Now().Sub(time4) > 0 { + err = fmt.Errorf("不在门店营业时间范围内!") + } + } else { + err = fmt.Errorf("不在门店营业时间范围内!") + } + } + } + } + } + if err == nil { + if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { + savedOrderInfo.retryCount++ + } } } else { errMsg := fmt.Sprintf("订单:%s已经自动创建过了%d次运单,仍然无法配送,请关注!", order.VendorOrderID, savedOrderInfo.retryCount) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 3159be54c..d76f3e3fc 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -87,28 +87,6 @@ func (s *DefScheduler) canOrderCreateWaybillNormally(order *model.GoodsOrder, sa } else if model.IsOrderHaveWaybill(order) { err = fmt.Errorf("当前订单%s已经有了有效的承运人%s了", order.VendorOrderID, jxutils.GetVendorName(order.WaybillVendorID)) } - if savedOrderInfo != nil { - //TODO 2020-07-21 发单时间要在门店的营业时间内 - if savedOrderInfo.storeDetail != nil { - if savedOrderInfo.storeDetail.OpenTime1 != 0 && savedOrderInfo.storeDetail.CloseTime1 != 0 { - time1 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime1, time.Now()) - time2 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime1, time.Now()) - if time.Now().Sub(time1) < 0 || time.Now().Sub(time2) > 0 { - if savedOrderInfo.storeDetail.OpenTime2 != 0 && savedOrderInfo.storeDetail.CloseTime2 != 0 { - time3 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime2, time.Now()) - time4 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime2, time.Now()) - if time.Now().Sub(time3) < 0 || time.Now().Sub(time4) > 0 { - // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内1!", order.VendorOrderID) - err = fmt.Errorf("不在门店营业时间范围内!") - } - } else { - // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内2!", order.VendorOrderID) - err = fmt.Errorf("不在门店营业时间范围内!") - } - } - } - } - } return err } From c0ac0cd27778e5a3d5c9f1793738451dabddd37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 08:48:28 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=91=E9=85=8D?= =?UTF-8?q?=E9=80=81=E4=B8=8D=E5=9C=A8=E8=90=A5=E4=B8=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index cfe2d1d84..a324e3111 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -752,6 +752,7 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf } else { err = fmt.Errorf("不在门店营业时间范围内!") } + } } } From df70e159c1eecec3d5549e0916808b647a1f0a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 09:12:48 +0800 Subject: [PATCH 04/18] =?UTF-8?q?jdwl=20nil=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index f968a207f..41e665df1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1446,8 +1446,9 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro waybill = v } } - handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] - err = handler.Handler.CancelWaybill(waybill, 0, "订单已发送其他物流") + if handler := partner.GetDeliveryPlatformFromVendorID(model.VendorIDJDWL); handler != nil { + err = handler.Handler.CancelWaybill(waybill, 0, "订单已发送其他物流") + } if err != nil { return err } @@ -1503,12 +1504,13 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro dao.UpdateEntity(db, order, "EclpOutID") vendorWaybillID = eclpSoNo } else { - handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL] - waybill2, err := handler.Handler.CreateWaybill(order, 0) - if err != nil { - return err + if handler := partner.GetDeliveryPlatformFromVendorID(model.VendorIDJDWL); handler != nil { + waybill2, err := handler.Handler.CreateWaybill(order, 0) + if err != nil { + return err + } + vendorWaybillID = waybill2.VendorWaybillID } - vendorWaybillID = waybill2.VendorWaybillID } jdshop.CurPurchaseHandler.OrderExport(ctx, vendorOrderID, vendorWaybillID, false) return err From 82f43dbff9652553e911e3d23532c0b53f5f1b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 09:26:29 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E4=BA=AC=E9=85=8D=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 7b5e022ff..9f7b8736a 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -127,6 +127,13 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err return nil, err } + if msg.IDSopShipmenttype == jdshopapi.IdSopShipmenttypeTC { + if time, err := api.JdShopAPI.GetOrderExtInfoByOrderId(order.VendorOrderID2); err == nil { + order.BusinessType = model.BusinessTypeDingshida + order.ExpectedDeliveredTime = utils.Str2Time(time) + } + } + //结算类型 storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop) if storeDetail != nil { From 5263d9112a9ae214cfcb8c1ea0e4e9034d755715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 09:52:25 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 7 ++++--- business/model/model.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 9bab2db63..c7dde5e56 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1684,7 +1684,8 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co t1.status = IF(? = 0, t1.status, t0.status), t1.jd_sync_status = t1.jd_sync_status | ?, t1.mtwm_sync_status = t1.mtwm_sync_status | ?, - t1.ebai_sync_status = t1.ebai_sync_status | ? + t1.ebai_sync_status = t1.ebai_sync_status | ?, + t1.stock = t0.stock WHERE t1.store_id = ? AND t1.deleted_at = ? AND t0.id IS NOT NULL ` sqlParams := []interface{}{ @@ -1725,13 +1726,13 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co // 添加toStore中不存在,但fromStore存在的 sql = ` INSERT INTO store_sku_bind(created_at, updated_at, last_operator, deleted_at, store_id, sku_id, sub_store_id, price, jx_price, unit_price, status, - jd_sync_status, ebai_sync_status, mtwm_sync_status) + jd_sync_status, ebai_sync_status, mtwm_sync_status, stock) SELECT ?, ?, ?, ?, ?, t1.sku_id, 0, IF(t1.price * ? / 100 > 0, t1.price * ? / 100, 1) * ?, IF(t1.jx_price * ? / 100 > 0, t1.jx_price * ? / 100, 1) * ?, IF(t1.unit_price * ? / 100 > 0, t1.unit_price * ? / 100, 1) * ?, - IF(? = 0, ?, t1.status), ?, ?, ? + IF(? = 0, ?, t1.status), ?, ?, ?, t1.stock FROM store_sku_bind t1 JOIN sku t2 ON t1.sku_id = t2.id AND t2.deleted_at = ? JOIN sku_name t3 ON t2.name_id = t3.id AND t3.deleted_at = ? diff --git a/business/model/model.go b/business/model/model.go index ad4108335..de01880c6 100644 --- a/business/model/model.go +++ b/business/model/model.go @@ -92,7 +92,7 @@ const ( SyncFlagSeqMask = 64 // 门店商家分类下的排序顺序 // combine - SyncFlagStoreSkuOnlyMask = SyncFlagSaleMask | SyncFlagPriceMask + SyncFlagStoreSkuOnlyMask = SyncFlagSaleMask | SyncFlagPriceMask | SyncFlagStockMask SyncFlagStoreSkuModifiedMask = SyncFlagStoreSkuOnlyMask | SyncFlagModifiedMask SyncFlagChangedMask = SyncFlagSpecMask | SyncFlagNewMask | SyncFlagDeletedMask | SyncFlagStoreSkuModifiedMask ) From 10b1fc1e60c33437e226c8a9e27ba68f486c913f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 10:54:32 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E4=B8=80=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 3 +-- business/jxstore/cms/store.go | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 77a5b8c39..c881257cf 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -1059,7 +1059,7 @@ func RefreshPageActs(ctx *jxcontext.Context, vendorIDs []int, createdFrom time.T func DeleteStoresFromAct(ctx *jxcontext.Context, vendorID int, actTypes, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { db := dao.GetDB() - task := tasksch.NewParallelTask("将SKU从所有活动中删除", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, + task := tasksch.NewParallelTask("将门店从所有活动中删除", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { storeID := batchItemList[0].(int) acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", vendorID, []int{1}, actTypes, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, time.Now().AddDate(0, -3, 0), time.Now()) @@ -1083,7 +1083,6 @@ func DeleteStoresFromAct(ctx *jxcontext.Context, vendorID int, actTypes, storeID _, err = SyncAct(ctx, nil, v.ID, nil, true) } } - return retVal, err }, storeIDs) tasksch.HandleTask(task, nil, true).Run() diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 6d40dcffa..659d9e8d2 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1224,6 +1224,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend if globals.IsAddEvent { err = AddEventDetail(db, ctx, model.OperateAdd, vendorID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`) } + _, err = CurVendorSync.FullSyncStoresSkus(ctx, db, []int{vendorID}, []int{storeID}, true, nil, true, true) return outStoreMap, err } From 45aebae7edae7a647fee15efb86ae45e15c8e080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 11:09:09 +0800 Subject: [PATCH 08/18] =?UTF-8?q?app=E5=BE=AE=E4=BF=A1=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/authprovider/weixin/weixin.go | 12 ++++- .../auth2/authprovider/weixin/weixin_mini.go | 3 -- business/jxutils/tasks/configrefresh.go | 46 +++++++++---------- globals/api/api.go | 4 +- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/business/auth2/authprovider/weixin/weixin.go b/business/auth2/authprovider/weixin/weixin.go index ccb355a21..2f4b344a9 100644 --- a/business/auth2/authprovider/weixin/weixin.go +++ b/business/auth2/authprovider/weixin/weixin.go @@ -15,6 +15,7 @@ const ( AuthTypeWeixin = "wxqrcode" // 微信扫码 AuthTypeMP = "weixinsns" // 公众号 AuthTypeWXNative = "wxnative" // 微信APP + AuthTypeWxApp = "weixinapp" //app微信登录 ) type Auther struct { @@ -26,6 +27,7 @@ var ( AutherObjWX *Auther AutherObjMP *Auther AutherObjNative *Auther + AutherObjApp *Auther ) var ( @@ -47,6 +49,11 @@ func init() { authType: AuthTypeWXNative, } auth2.RegisterAuther(AuthTypeWXNative, AutherObjNative) + + AutherObjApp = &Auther{ + authType: AuthTypeWxApp, + } + auth2.RegisterAuther(AuthTypeWxApp, AutherObjApp) } func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx, err error) { @@ -71,7 +78,7 @@ func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx, if err == nil { wxUserinfo, err2 := a.getAPI().SNSGetUserInfo(accessToken, openID) if err = err2; err == nil { - if authBindEx, err = a.UnionFindAuthBind(a.authType, a.getAPI().GetAppID(), []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini, AuthTypeWXNative}, wxUserinfo.OpenID, wxUserinfo.UnionID, wxUserinfo); err == nil { + if authBindEx, err = a.UnionFindAuthBind(a.authType, a.getAPI().GetAppID(), []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini, AuthTypeWXNative, AuthTypeWxApp}, wxUserinfo.OpenID, wxUserinfo.UnionID, wxUserinfo); err == nil { authBindEx.UserHint = &auth2.UserBasic{ Name: wxUserinfo.NickName, Avatar: wxUserinfo.HeadImgURL, @@ -86,6 +93,9 @@ func (a *Auther) getAPI() *weixinapi.API { if a.authType == AuthTypeWeixin { return api.WeixinPageAPI } + if a.authType == AuthTypeWxApp { + return api.WeixinApp + } return api.WeixinAPI } diff --git a/business/auth2/authprovider/weixin/weixin_mini.go b/business/auth2/authprovider/weixin/weixin_mini.go index 56643e410..072ea9573 100644 --- a/business/auth2/authprovider/weixin/weixin_mini.go +++ b/business/auth2/authprovider/weixin/weixin_mini.go @@ -92,9 +92,6 @@ func getWxApp(appID string) (miniApi *weixinapi.API) { if len(appID) > 0 && appID == api.WeixinMiniAppID2 { miniApi = api.WeixinMiniAPI2 } - if len(appID) > 0 && appID == api.WeixinMiniAppID3 { - miniApi = api.WeixinMiniAPI3 - } return miniApi } diff --git a/business/jxutils/tasks/configrefresh.go b/business/jxutils/tasks/configrefresh.go index dc77418fa..9086c72a4 100644 --- a/business/jxutils/tasks/configrefresh.go +++ b/business/jxutils/tasks/configrefresh.go @@ -166,29 +166,29 @@ func RefreshWeixin2Token() (err error) { } func RefreshWeixin3Token() (err error) { - if api.WeixinMiniAPI3 != nil { - err = RefreshConfig("wechat3", weixinTokenExpires, func() (token string, expireTimeStr string) { - globals.SugarLogger.Debugf("RefreshWeixin3Token RunMode:%s", beego.BConfig.RunMode) - if globals.IsMainProductEnv() { - if tokenInfo, err := api.WeixinMiniAPI3.CBRetrieveToken(); err == nil { - globals.SugarLogger.Debugf("RefreshWeixin3Token tokenInfo:%s", utils.Format4Output(tokenInfo, true)) - token = tokenInfo.AccessToken - } else { - globals.SugarLogger.Errorf("RefreshWeixin3Token RefreshToken failed with error:%v", err) - } - } else { - if tokenInfo := getWX3TokenFromRemote(api.WeixinMiniAPI3.CBGetToken()); tokenInfo != nil { - expireTimeStr = utils.Time2Str(time.Now().Add(-weixinTokenExpires)) - token = tokenInfo.Token - } - } - return token, expireTimeStr - }, func(value string) { - globals.SugarLogger.Debugf("RefreshWeixinToken setter value:%s", value) - syseventhub.SysEventHub.OnNewWX3Token(value) - api.WeixinMiniAPI3.CBSetToken(value) - }) - } + // if api.WeixinMiniAPI3 != nil { + // err = RefreshConfig("wechat3", weixinTokenExpires, func() (token string, expireTimeStr string) { + // globals.SugarLogger.Debugf("RefreshWeixin3Token RunMode:%s", beego.BConfig.RunMode) + // if globals.IsMainProductEnv() { + // if tokenInfo, err := api.WeixinMiniAPI3.CBRetrieveToken(); err == nil { + // globals.SugarLogger.Debugf("RefreshWeixin3Token tokenInfo:%s", utils.Format4Output(tokenInfo, true)) + // token = tokenInfo.AccessToken + // } else { + // globals.SugarLogger.Errorf("RefreshWeixin3Token RefreshToken failed with error:%v", err) + // } + // } else { + // if tokenInfo := getWX3TokenFromRemote(api.WeixinMiniAPI3.CBGetToken()); tokenInfo != nil { + // expireTimeStr = utils.Time2Str(time.Now().Add(-weixinTokenExpires)) + // token = tokenInfo.Token + // } + // } + // return token, expireTimeStr + // }, func(value string) { + // globals.SugarLogger.Debugf("RefreshWeixinToken setter value:%s", value) + // syseventhub.SysEventHub.OnNewWX3Token(value) + // api.WeixinMiniAPI3.CBSetToken(value) + // }) + // } return err } diff --git a/globals/api/api.go b/globals/api/api.go index ff5420c37..60e077ed4 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -60,7 +60,7 @@ var ( WeixinAPI *weixinapi.API // 微信公众号 WeixinMiniAPI *weixinapi.API // 小程序 WeixinMiniAPI2 *weixinapi.API // 小程序2 - WeixinMiniAPI3 *weixinapi.API // 小程序3 + WeixinApp *weixinapi.API // app微信登录 WeixinMiniAppID2 string WeixinMiniAppID3 string WxpayAPI *wxpayapi.API // 微信支付API @@ -213,7 +213,7 @@ func Init() { } WeixinPageAPI = weixinapi.New(beego.AppConfig.String("weixinPageAppID"), beego.AppConfig.String("weixinPageSecret")) if WeixinMiniAppID3 = beego.AppConfig.String("weixinMiniAppID3"); WeixinMiniAppID3 != "" { - WeixinMiniAPI3 = weixinapi.New(WeixinMiniAppID3, beego.AppConfig.String("weixinMiniSecret3")) + WeixinApp = weixinapi.New(WeixinMiniAppID3, beego.AppConfig.String("weixinMiniSecret3")) } if globals.WxpayNotifyURL != "" { // WxpayAPI = wxpayapi.New(beego.AppConfig.String("wxpayAppID"), beego.AppConfig.String("wxpayAppKey"), beego.AppConfig.String("wxpayAppMchID")) From 93462f9a2b643de0139e8309eb5b3e33b7f72496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 14:12:52 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E6=89=93=E5=8D=B0login=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 9585578ea..580bc330f 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/base64" "errors" + "fmt" "regexp" "strings" "time" @@ -295,6 +296,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string } else { err = ErrIllegalAuthType } + fmt.Println("testauthInfo", utils.Format4Output(authInfo, false)) return authInfo, err } From 0331446547f91512313e741ce2679c00f21e49ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 14:39:50 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E5=BE=AE=E4=BF=A1appisexit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 580bc330f..9c90e713d 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -276,9 +276,9 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) } //如果是小程序 - if authType == "weixinmini" { + if authType == "weixinmini" || authType == "weixinapp" { appID := strings.Split(authSecret, ",")[0] - if appID == "wx08a5c2a8581414ff" || appID == "wx2d6949f724b2541d" { //菜市或者果园 + if appID == "wx08a5c2a8581414ff" || appID == "wx2d6949f724b2541d" || appID == "wx18111a41fd17f24f" { //菜市或者果园 if user != nil { binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", "wx2bb99eb5d2c9b82c") if err != nil { From eb5cafb48ad27e22b86efb28690f17375c33d3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 18:15:37 +0800 Subject: [PATCH 11/18] bg --- business/model/dao/store_sku.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 9de5294e8..d72ade33f 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1451,14 +1451,12 @@ func GetStoreSkuBindByNameID(db *DaoDB, storeID, nameID, status int) (storeSkuBi AND a.name_id = ? AND c.deleted_at = ? AND a.deleted_at = ? - AND c.status = ? ` sqlParams := []interface{}{ storeID, nameID, utils.DefaultTimeValue, utils.DefaultTimeValue, - status, } err = GetRows(db, &storeSkuBind, sql, sqlParams...) return storeSkuBind, err From cff8020ecdaedc35413440a6c80a9a53643cdf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 18:18:12 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E4=B8=AD=E4=BD=8D=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index c7dde5e56..d97e0b375 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3333,7 +3333,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf } else { payPercentage = store.PayPercentage } - priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{store.CityCode}, nil, []int{skuList[0].NameID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) + priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{0}, nil, []int{skuList[0].NameID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) if len(priceReferList) > 0 { price = priceReferList[0].MidUnitPrice / payPercentage * 100 } From 1ccd767ab8788d01922368da961cf11775a76a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 14 Aug 2020 09:39:01 +0800 Subject: [PATCH 13/18] linshi --- business/jxstore/tempop/tempop.go | 37 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 6d9cf1108..6ba3c6c20 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -13,7 +13,6 @@ import ( "github.com/360EntSecGroup-Skylar/excelize" "github.com/qiniu/api.v7/storage" - "git.rosy.net.cn/baseapi/platformapi/dadaapi" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/utils" @@ -1585,18 +1584,34 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("updateList2", utils.Format4Output(updateList, false)) // fmt.Println("deleteList2", deleteList) var ( - db = dao.GetDB() + db = dao.GetDB() + storeSkus []*model.StoreSkuBind ) - list, err := dao.GetStoreCourierList(db, nil, []int{model.VendorIDDada}, model.StoreStatusAll, model.StoreAuditStatusAll) - for _, v := range list { - sd, _ := api.DadaAPI.ShopDetail(v.VendorStoreID) - if !strings.Contains(sd.StationName, globals.StoreName) { - shopInfo := &dadaapi.ShopInfo{ - OriginShopID: v.VendorStoreID, - StationName: globals.StoreName + "-" + sd.StationName, - } - api.DadaAPI.ShopUpdate(shopInfo) + sql := ` + SELECT a.* FROM store_sku_bind a,store b + WHERE a.store_id = b.id AND b.deleted_at = '1970-01-01 00:00:00' AND a.status = 1 AND a.unit_price = 100 + AND a.deleted_at = '1970-01-01 00:00:00' + AND a.sku_id NOT IN (34268,6045545,29401,6039481,29285,29286,29287,6040945,6040963,31737,33465,6045629,34989,6043733) + ` + err = dao.GetRows(db, &storeSkus, sql, nil) + for _, v := range storeSkus { + var unitPrice = 0 + his, _ := dao.GetStoreSkuHistory(db, []int{v.StoreID}, []int{v.SkuID}, model.StoreAuditStatusAll, utils.Time2Date(utils.Str2Time("2020-08-09 00:00:00"))) + if len(his) == 0 { + p, _ := dao.GetPriceReferSnapshotNoPage(db, []int{0}, []int{v.SkuID}, nil, utils.Time2Date(time.Now().AddDate(0, 0, -1))) + unitPrice = p[0].MidUnitPrice + } else { + unitPrice = his[0].UnitPrice } + skus, _ := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil) + var skuBindInfos []*cms.StoreSkuBindInfo + skuBindInfo := &cms.StoreSkuBindInfo{ + StoreID: v.StoreID, + NameID: skus[0].NameID, + UnitPrice: unitPrice, + } + skuBindInfos = append(skuBindInfos, skuBindInfo) + cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) } return err } From 2fa25879750ee32bd32a716b10af2f001852494c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 14 Aug 2020 09:50:34 +0800 Subject: [PATCH 14/18] linshi --- business/jxstore/tempop/tempop.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 6ba3c6c20..e76835f83 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1589,9 +1589,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { ) sql := ` SELECT a.* FROM store_sku_bind a,store b - WHERE a.store_id = b.id AND b.deleted_at = '1970-01-01 00:00:00' AND a.status = 1 AND a.unit_price = 100 + WHERE a.store_id = b.id AND b.deleted_at = '1970-01-01 00:00:00' AND a.unit_price = 100 AND a.deleted_at = '1970-01-01 00:00:00' - AND a.sku_id NOT IN (34268,6045545,29401,6039481,29285,29286,29287,6040945,6040963,31737,33465,6045629,34989,6043733) + AND a.sku_id NOT IN (34268,6045545,29401,6039481,29285,29286,29287,6040945,6040963,31737,33465,6045629,34989,6043733,6039661,25917,29569) ` err = dao.GetRows(db, &storeSkus, sql, nil) for _, v := range storeSkus { From 14d85186de65c66e513b5391da8c6608c78b03d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 14 Aug 2020 15:35:47 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E5=8A=9B=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 71 +++++++++++++++++++++++++++ controllers/cms_store_sku.go | 21 ++++++++ routers/commentsRouter_controllers.go | 9 ++++ 3 files changed, 101 insertions(+) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index d97e0b375..33cdd96fa 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4797,3 +4797,74 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku } return nil, hint, err } + +func GetSpecialtyStoreSkus(ctx *jxcontext.Context, storeIDs, vendorIDs []int) (err error) { + type SpecialtyStoreSkus struct { + StoreID int `json:"门店ID"` + StoreName string `json:"门店名"` + SkuID int `json:"SkuID"` + SkuName string `json:"商品名"` + Price float64 `json:"平台价"` + VendorName string `json:"平台名"` + } + var ( + db = dao.GetDB() + specialtyStoreSkus []*SpecialtyStoreSkus + excelTitle = []string{ + "门店ID", + "门店名", + "SkuID", + "商品名", + "平台价", + "平台名", + } + sheetList []*excel.Obj2ExcelSheetConfig + downloadURL, fileName string + ) + for _, v := range vendorIDs { + for _, vv := range storeIDs { + storeDetail, err := dao.GetStoreDetail(db, vv, v) + if err != nil || storeDetail == nil { + continue + } + if partner.IsMultiStore(v) { + + } else { + handler := partner.GetPurchasePlatformFromVendorID(v).(partner.ISingleStoreStoreSkuHandler) + skuList, _ := handler.GetStoreSkusFullInfo(ctx, nil, vv, storeDetail.VendorStoreID, nil) + for _, sku := range skuList { + if sku.SkuList[0].IsSpecialty == model.YES { + specialtyStoreSku := &SpecialtyStoreSkus{ + StoreID: vv, + StoreName: storeDetail.Name, + SkuID: sku.SkuList[0].SkuID, + SkuName: sku.Name, + Price: float64(sku.SkuList[0].VendorPrice) / 100, + VendorName: model.VendorNames[v], + } + specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku) + } + } + } + } + } + excelConf := &excel.Obj2ExcelSheetConfig{ + Title: "sheet1", + Data: specialtyStoreSkus, + CaptionList: excelTitle, + } + sheetList = append(sheetList, excelConf) + if excelConf != nil { + downloadURL, fileName, err = jxutils.UploadExeclAndPushMsg(sheetList, "力荐或置顶商品") + } else { + baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!") + } + if err != nil { + baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName, err) + } else { + noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, ctx.GetUserID(), "异步任务完成", noticeMsg) + baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL) + } + return err +} diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 51f102cad..41b74b5a6 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -896,3 +896,24 @@ func (c *StoreSkuController) StoreSkuPriceAudit() { } }) } + +// @Title 查看美团力荐或京东置顶商品 +// @Description 查看美团力荐或京东置顶商品 +// @Param token header string true "认证token" +// @Param vendorIDs formData string true "平台ids" +// @Param storeIDs formData string true "门店IDs" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetSpecialtyStoreSkus [post] +func (c *StoreSkuController) GetSpecialtyStoreSkus() { + c.callGetSpecialtyStoreSkus(func(params *tStoreSkuGetSpecialtyStoreSkusParams) (retVal interface{}, errCode string, err error) { + var ( + storeIDs, vendorIDs []int + ) + if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.VendorIDs, &vendorIDs); err != nil { + return retVal, "", err + } + err = cms.GetSpecialtyStoreSkus(params.Ctx, storeIDs, vendorIDs) + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 2a962a10e..0b48de2c5 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -2088,6 +2088,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"], + beego.ControllerComments{ + Method: "GetSpecialtyStoreSkus", + Router: `/GetSpecialtyStoreSkus`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"], beego.ControllerComments{ Method: "GetStoreAbnormalSkuCount", From a0f436cdc7dcd986cca7ce4bb8872c485c305aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 14 Aug 2020 17:45:04 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=BE=8E=E5=9B=A2?= =?UTF-8?q?=E5=8A=9B=E8=8D=90=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 33cdd96fa..38d755be4 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4828,7 +4828,36 @@ func GetSpecialtyStoreSkus(ctx *jxcontext.Context, storeIDs, vendorIDs []int) (e continue } if partner.IsMultiStore(v) { - + var ( + page = 1 + vendorSkuIDs []string + ) + _, totalCount, _ := api.JdPageAPI.GetJdTopSkus(storeDetail.VendorStoreID, page) + for ; page < totalCount/10+1; page++ { + result, _, _ := api.JdPageAPI.GetJdTopSkus(storeDetail.VendorStoreID, page) + vendorSkuIDs = append(vendorSkuIDs, result...) + } + for _, vvv := range vendorSkuIDs { + thingMap := &model.ThingMap{} + sql := ` + SELECT * FROM thing_map WHERE thing_type = 3 AND vendor_thing_id = ? AND vendor_org_code = 320406 + AND deleted_at = ? + ` + sqlParams := []interface{}{ + vvv, utils.DefaultTimeValue, + } + dao.GetRow(db, &thingMap, sql, sqlParams) + skus, _ := dao.GetSkus(db, []int{int(thingMap.ThingID)}, nil, nil, nil, nil) + specialtyStoreSku := &SpecialtyStoreSkus{ + StoreID: vv, + StoreName: storeDetail.Name, + SkuID: int(thingMap.ThingID), + SkuName: skus[0].Name, + Price: 0, + VendorName: model.VendorNames[v], + } + specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku) + } } else { handler := partner.GetPurchasePlatformFromVendorID(v).(partner.ISingleStoreStoreSkuHandler) skuList, _ := handler.GetStoreSkusFullInfo(ctx, nil, vv, storeDetail.VendorStoreID, nil) From a4e15bb61c8db6df34f58ca1e078d701af3a71dc 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, 17 Aug 2020 09:05:31 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index d72ade33f..c9ff12c48 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -563,7 +563,7 @@ func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInf sm.vendor_id, sm.vendor_org_code, sm.yb_app_id, sm.yb_app_key, t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time, - t1.store_id, t1.deleted_at bind_deleted_at, + t1.store_id, t1.deleted_at bind_deleted_at, t1.stock, t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, IF(t11.%s <> '', t11.%s, t3.img) img, From 927c261f0dc86df59845e126fb4885b9d24719d4 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, 17 Aug 2020 15:00:52 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 2 -- business/jxcallback/orderman/order.go | 2 +- business/jxutils/jxutils.go | 2 +- business/partner/purchase/jx/localjx/order.go | 17 ++++++++++------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 9c90e713d..1afde6854 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/base64" "errors" - "fmt" "regexp" "strings" "time" @@ -296,7 +295,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string } else { err = ErrIllegalAuthType } - fmt.Println("testauthInfo", utils.Format4Output(authInfo, false)) return authInfo, err } diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 41e665df1..0e0ae072b 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -215,7 +215,7 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m // } // } else { if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) { - order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100) + order.NewEarningPrice = order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) - waybill.DesiredFee } // } } diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index c7288df87..c56c1af1a 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -606,7 +606,7 @@ func RefreshOrderEarningPrice3(order *model.GoodsOrder, payPercentage int, bill // if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { // order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100 // } else { - order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100 + order.NewEarningPrice = order.TotalShopMoney*int64((100-payPercentage/2))/100 - bill.DesiredFee // } } else { order.NewEarningPrice = order.EarningPrice diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 7dbb93ca8..08400ba92 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1466,14 +1466,17 @@ func GetMatterOrderStatus(ctx *jxcontext.Context, vendorOrderID string) (result if err != nil { return nil, err } - for _, v := range queryOrderStatus.OrderStatusList { - matter := &MatterOrderStatus{} - matter.Time = utils.Str2Time(v.OperateTime) - matter.Status = v.SoStatusName - matter.Name = v.SoStatusName - matter.Sign = 1 - result = append(result, matter) + if len(queryOrderStatus.OrderStatusList) > 0 { + for _, v := range queryOrderStatus.OrderStatusList { + matter := &MatterOrderStatus{} + matter.Time = utils.Str2Time(v.OperateTime) + matter.Status = v.SoStatusName + matter.Name = v.SoStatusName + matter.Sign = 1 + result = append(result, matter) + } } + if len(getTrackMessagePlusByOrderResult.ResultData) > 0 { for _, vv := range getTrackMessagePlusByOrderResult.ResultData { matter := &MatterOrderStatus{}