From dcc4e2dc6f6e958e86c12c9d45ce835545371a32 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, 17 Sep 2020 15:52:56 +0800 Subject: [PATCH 01/51] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/sku2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index f9da68b38..c6593b44a 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -114,7 +114,7 @@ func (p *PurchaseHandler) ReorderCategories2(ctx *jxcontext.Context, vendorOrgCo func (p *PurchaseHandler) getVendorCategories(level int, pid int64) (vendorCats []*model.SkuVendorCategory, err error) { // 得到平台的分类,不需要指定分账号 - cats, err := api.Jd2API.QueryChildCategoriesForOP(pid) + cats, err := api.JdAPI.QueryChildCategoriesForOP(pid) if err != nil { return nil, err } From 7c35a90a89efac5d2ddf3595355759a402641621 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, 17 Sep 2020 16:41:23 +0800 Subject: [PATCH 02/51] from storeid ? --- business/partner/purchase/jx/localjx/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index ede956bde..058bddf57 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1122,6 +1122,7 @@ func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) { } //分包后的子订单ID默认是后面加两位(目前的规则),要改的话要注意取消订单那的判断 outJxOrder.OrderID = utils.Str2Int64(order.VendorOrderID)*100 + int64(k+1) + outJxOrder.FromStoreID = order.FromStoreID checkMatterDeliveryAddress(deliveryAddress) order2, err2 := jxOrder2GoodsOrder(jxcontext.AdminCtx, outJxOrder, deliveryAddress, order.UserID, false) if err = err2; err == nil { From af2626e64ddd262f33d43a10f88bcd7b3563ab14 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, 17 Sep 2020 17:05:18 +0800 Subject: [PATCH 03/51] =?UTF-8?q?=E9=87=8D=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/dao_order.go | 4 ++-- business/partner/purchase/jx/localjx/order.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index e95398189..c46002c47 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -1266,12 +1266,12 @@ func GetWaybills(db *DaoDB, vendorOrderID string) (waybills []*model.Waybill, er func GetMatterChildOrders(db *DaoDB, vendorOrderID string) (goods []*model.GoodsOrder, err error) { sql := `SELECT * FROM goods_order - WHERE vendor_order_id LIKE ? OR vendor_order_id LIKE ? + WHERE vendor_order_id LIKE ? OR vendor_order_id LIKE ? OR vendor_order_id LIKE ? AND vendor_id = ? ORDER BY vendor_order_id DESC ` sqlParams := []interface{}{ - vendorOrderID + "0%", vendorOrderID + "1%", + vendorOrderID + "0%", vendorOrderID + "1%", vendorOrderID + "2%", model.VendorIDJX, } err = GetRows(db, &goods, sql, sqlParams) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 058bddf57..ec33cf248 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1122,10 +1122,10 @@ func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) { } //分包后的子订单ID默认是后面加两位(目前的规则),要改的话要注意取消订单那的判断 outJxOrder.OrderID = utils.Str2Int64(order.VendorOrderID)*100 + int64(k+1) - outJxOrder.FromStoreID = order.FromStoreID checkMatterDeliveryAddress(deliveryAddress) order2, err2 := jxOrder2GoodsOrder(jxcontext.AdminCtx, outJxOrder, deliveryAddress, order.UserID, false) if err = err2; err == nil { + order2.FromStoreID = v.FromStoreID order2.AddressID = order.AddressID order2.Status = model.OrderStatusDelivering err = partner.CurOrderManager.OnOrderNew(order2, model.Order2Status(order2)) @@ -1877,6 +1877,7 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er if order == nil || order.StoreID != model.MatterStoreID || order.FromStoreID == 0 { return fmt.Errorf("只允许物料店重发物料订单调用此接口!") } + err = CancelMatterOrder(db, order, cancelMatterOrderReason) // queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(order.EclpOutID) // if len(queryOrderStatus.OrderStatusList) > 0 { // code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode @@ -1887,7 +1888,6 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er globals.SugarLogger.Debugf("SendFailedMatterOrder err : [%v]", err) return err } - err = CancelMatterOrder(db, order, cancelMatterOrderReason) changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) for _, v := range order.Skus { cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) @@ -1910,7 +1910,6 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er } } } - // err = CancelMatterOrder(db, order, cancelMatterOrderReason) changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason) } else if len(order.VendorOrderID) == 16 && order.EclpOutID != "" { // 这是分包的子订单 return fmt.Errorf("请重发主订单!主订单号:[%v]", order.VendorOrderID[len(order.VendorOrderID)-2:]) From a0bd2b2aaa2669bc40c0e606e86d16eacd615d4c 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, 17 Sep 2020 17:16:16 +0800 Subject: [PATCH 04/51] =?UTF-8?q?=E9=87=8D=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index ec33cf248..eec7914c1 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1904,7 +1904,7 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er return err } suffix := utils.Str2Int64(cOrder.VendorOrderID[len(cOrder.VendorOrderID)-2:]) + int64(len(goodsList)) - _, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), cOrder, suffix) + _, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), order, suffix) for _, v := range cOrder.Skus { cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID) } From 14379f270dafda52c20f1c628bff9148c7dcd222 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, 17 Sep 2020 18:00:14 +0800 Subject: [PATCH 05/51] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 3 +++ business/model/dao/sku.go | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 54546dcf3..9bbd8aef8 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -147,6 +147,9 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, if skuVendorInfo.ExdSkuID != "" { return nil, err } + if skuVendorInfo.SkuVendorMapCatID != "" { + skuVendorInfo.VendorVendorCatID = utils.Str2Int64(skuVendorInfo.SkuVendorMapCatID) + } skuVendorInfo.SkuName = jxutils.ComposeSkuNameSync(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0, skuVendorInfo.ExPrefix, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) if skuVendorInfo.ImgWatermark != "" { diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index 0b511a55c..ada9feefe 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -260,7 +260,8 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs t3.jd_category_id vendor_vendor_cat_id, tsu.ex_prefix, tsu.begin_at ex_prefix_begin, tsu.end_at ex_prefix_end, tsu.img_watermark, t3m.sync_status cat_sync_status, - t3m.vendor_thing_id vendor_cat_id + t3m.vendor_thing_id vendor_cat_id, + tsy.vendor_category_id sku_vendor_map_cat_id FROM sku t1 LEFT JOIN thing_map t1m ON t1m.thing_id = t1.id AND t1m.thing_type = ? AND t1m.deleted_at = ?` @@ -286,9 +287,10 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs LEFT JOIN data_resource t11 ON t11.main_url = t2.img LEFT JOIN data_resource t12 ON t12.main_url = t2.img2 LEFT JOIN sku_exinfo_map tsu ON tsu.name_id = t2.id AND tsu.deleted_at = ? AND tsu.vendor_id = t1m.vendor_id + LEFT JOIN sku_vendor_category_map tsy ON tsy.name_id = t2.id AND tsy.vendor_id = ? AND tsy.deleted_at = ? WHERE 1 = 1 ` - sqlParams = append(sqlParams, model.ThingTypeCategory, utils.DefaultTimeValue, utils.DefaultTimeValue) + sqlParams = append(sqlParams, model.ThingTypeCategory, utils.DefaultTimeValue, utils.DefaultTimeValue, model.VendorIDJD, utils.DefaultTimeValue) if mustDirty { sql += " AND t1m.sync_status IS NOT NULL AND t1m.sync_status <> 0" } else { From 6c7b711f5095eac1e56ba6a73a6695f32a0fa34f 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, 18 Sep 2020 08:55:31 +0800 Subject: [PATCH 06/51] =?UTF-8?q?=E8=AF=95=E7=9D=80=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index ff48de932..32c9c8364 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -301,9 +301,10 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn skuItem.SkuName = jxutils.ComposeSkuNameSync(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0, skuItem.ExPrefix, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) skuItem.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0) if skuItem.ImgWatermark != "" && model.IsSyncStatusUpdate(skuItem.SkuSyncStatus) && skuItem.VendorID != model.VendorIDJD { - if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*skuItem.ExPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*skuItem.ExPrefixEnd) <= 0 { - downLoad, _ := uploadImgStandard(skuItem.ImgWatermark) - skuItem.ImgMix = jxutils.MixWatermarkImg(downLoad, skuItem.ImgOrigin, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) + if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*skuItem.ExPrefixBegin) == 0 { + // if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*skuItem.ExPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*skuItem.ExPrefixEnd) <= 0 { + // downLoad, _ := uploadImgStandard(skuItem.ImgWatermark) + skuItem.ImgMix = jxutils.MixWatermarkImg(skuItem.ImgWatermark, skuItem.ImgOrigin, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) } if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*skuItem.ExPrefixEnd) > 0 { skuItem.ImgMix = "" From 6c131898a310a51e0e70be4846b1567cea957b03 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, 18 Sep 2020 09:51:07 +0800 Subject: [PATCH 07/51] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E5=BE=85=E6=8E=A5?= =?UTF-8?q?=E5=8D=95=E6=8E=A8=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index cc627e6a8..fe42e4bf0 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -378,6 +378,7 @@ func (s *DefScheduler) OnOrderNew(order *model.GoodsOrder, isPending bool) (err savedOrderInfo.SetOrder(order) if order.Status == model.OrderStatusWaitAccepted { s.resetTimer(savedOrderInfo, nil, isPending) + push.NotifyNewOrder(order) } if order.Status >= model.OrderStatusNew { s.resetTimer(savedOrderInfo, nil, isPending) @@ -1471,7 +1472,9 @@ func (s *DefScheduler) notifyNewOrder(order *model.GoodsOrder) { smsmsg.NotifyNewOrder(order) smsmsg.NotifyNewUserOrder(order) } - push.NotifyNewOrder(order) + if order.VendorID != model.VendorIDEBAI { + push.NotifyNewOrder(order) + } }) } } From ed40f19ab81a3fa15a11cf32ee56d9621a8b23af 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, 18 Sep 2020 11:19:57 +0800 Subject: [PATCH 08/51] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 9abdee29e..3f9ff36f0 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -174,7 +174,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err buildOrderTo102919(order) continue } else { - if order.EarningType == model.EarningTypeQuote && shopPriceSum+700 > int(order.TotalShopMoney) { + if order.EarningType == model.EarningTypeQuote && utils.Int2Float64(shopPriceSum+700) > float64(order.TotalShopMoney)*jdshopapi.JdsPayPercentage { buildOrderTo102919(order) continue } @@ -184,7 +184,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err buildOrderTo102919(order) continue } else { - if order.EarningType == model.EarningTypeQuote && shopPriceSum+700 > int(order.TotalShopMoney) { + if order.EarningType == model.EarningTypeQuote && utils.Int2Float64(shopPriceSum+700) > float64(order.TotalShopMoney)*jdshopapi.JdsPayPercentage { buildOrderTo102919(order) continue } From 1a105e761c04662cbbadfaec06e7031cde41ced8 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, 18 Sep 2020 11:50:41 +0800 Subject: [PATCH 09/51] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 3f9ff36f0..dc8315258 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -163,8 +163,10 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err ) for _, sku := range order.Skus { storeSkuList, _ := dao.GetStoresSkusInfo(dao.GetDB(), []int{order.StoreID}, []int{sku.SkuID}) - if len(storeSkuList) > 0 && storeSkuList[0].Status == model.StoreSkuBindStatusNormal { - saleNormalSum += 1 + if len(storeSkuList) > 0 { + if storeSkuList[0].Status == model.StoreSkuBindStatusNormal { + saleNormalSum += 1 + } shopPriceSum += storeSkuList[0].Price * sku.Count } } @@ -174,7 +176,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err buildOrderTo102919(order) continue } else { - if order.EarningType == model.EarningTypeQuote && utils.Int2Float64(shopPriceSum+700) > float64(order.TotalShopMoney)*jdshopapi.JdsPayPercentage { + if order.EarningType == model.EarningTypeQuote && shopPriceSum+700 > int(order.TotalShopMoney) { buildOrderTo102919(order) continue } @@ -184,7 +186,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err buildOrderTo102919(order) continue } else { - if order.EarningType == model.EarningTypeQuote && utils.Int2Float64(shopPriceSum+700) > float64(order.TotalShopMoney)*jdshopapi.JdsPayPercentage { + if order.EarningType == model.EarningTypeQuote && shopPriceSum+700 > int(order.TotalShopMoney) { buildOrderTo102919(order) continue } From ec52d564cc869a60b1b45467bf551f3aa87ce137 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, 18 Sep 2020 16:00:50 +0800 Subject: [PATCH 10/51] =?UTF-8?q?=E6=89=A3=E7=82=B9=E5=87=8F=E9=85=8D?= =?UTF-8?q?=E9=80=81=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index e3d5a191b..a196f8c15 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1776,6 +1776,10 @@ func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desir } else { bill.DesiredFee = int64(desiredFee) _, err = dao.UpdateEntity(db, bill, "DesiredFee") + if order.EarningType == model.EarningTypePoints { + order.NewEarningPrice = order.NewEarningPrice - int64(desiredFee) + _, err = dao.UpdateEntity(db, order, "NewEarningPrice") + } } return err } From 43b9de87e2d4dc67d94f05359af6b47d23005038 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, 18 Sep 2020 16:04:23 +0800 Subject: [PATCH 11/51] =?UTF-8?q?=E9=85=8D=E9=80=81=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/orderman_ext.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 9f0de1131..8fa33571c 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -159,7 +159,7 @@ func (c *OrderManager) GetOrderInfo(ctx *jxcontext.Context, vendorOrderID string // 这里用QueryRows而不用QueryRow的原因是用QueryRow在这种情况下不能将数据读出,很奇怪。大概的原因是QueryRow对于GoodsOrderExt这种有嵌入的struct处理有问题 num, err := db.Raw(` - SELECT t3.*,ROUND(t3.shop_sum_price/t3.count) avg_price, t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile + SELECT t3.*,ROUND(t3.shop_sum_price/t3.count) avg_price, t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile, t2.desired_fee FROM goods_order t1 LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id JOIN ( From 867f97c73914e2bb484ca0e6acaa8ddf843d3d0d 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, 18 Sep 2020 16:22:12 +0800 Subject: [PATCH 12/51] =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/user2.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index 6fdc80348..242986fb0 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -211,6 +211,7 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) TryAddStoreBossRole4User(ctx, user) if mobileAuth != nil { + fmt.Println("test111111111111111111111111111111111111", utils.Format4Output(user, false)) if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil { err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo) } From c02005a36da0bef1969a49a2a22c184dddbaa881 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, 18 Sep 2020 16:53:10 +0800 Subject: [PATCH 13/51] =?UTF-8?q?=E7=BE=8E=E5=9B=BE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/order.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 28b16a250..0ce1450dc 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -254,8 +254,10 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo if skuBenefitDetailMap != nil && skuBenefitDetailMap[sku.VendorSkuID] != nil && ignoreSkuMap[sku.SkuID] == 0 /* && sku.Count == 1 */ { for _, v := range skuBenefitDetailMap[sku.VendorSkuID].WmAppOrderActDetails { if /*skuActTypeMap[v.Type] == 1 && */ strings.Index(v.Remark, skuName) >= 0 && sku.Count == v.Count { - ignoreSkuMap[sku.SkuID] = 1 sku.SalePrice -= jxutils.StandardPrice2Int(v.MtCharge + v.PoiCharge) + if sku.SalePrice > 0 { + ignoreSkuMap[sku.SkuID] = 1 + } sku.StoreSubName = utils.Int2Str(v.Type) } } From 77f9dd35daeed61a4a999db106e57848824cc1c0 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, 18 Sep 2020 16:56:05 +0800 Subject: [PATCH 14/51] =?UTF-8?q?=E7=BE=8E=E5=9B=BE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/order.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 0ce1450dc..b16a74abe 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -262,6 +262,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo } } } + if sku.SalePrice < 0 { + sku.SalePrice = jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])) + } // if product["isGift"].(bool) { // sku.SkuType = 1 From 185b8133d4a9b59f1d54043cfcdcd3aec9b6b614 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, 18 Sep 2020 17:03:36 +0800 Subject: [PATCH 15/51] =?UTF-8?q?=E7=BE=8E=E5=9B=BE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/order.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index b16a74abe..14cdc26b4 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -254,9 +254,11 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo if skuBenefitDetailMap != nil && skuBenefitDetailMap[sku.VendorSkuID] != nil && ignoreSkuMap[sku.SkuID] == 0 /* && sku.Count == 1 */ { for _, v := range skuBenefitDetailMap[sku.VendorSkuID].WmAppOrderActDetails { if /*skuActTypeMap[v.Type] == 1 && */ strings.Index(v.Remark, skuName) >= 0 && sku.Count == v.Count { - sku.SalePrice -= jxutils.StandardPrice2Int(v.MtCharge + v.PoiCharge) - if sku.SalePrice > 0 { + if sku.SalePrice-jxutils.StandardPrice2Int(v.MtCharge+v.PoiCharge) < 0 { + continue + } else { ignoreSkuMap[sku.SkuID] = 1 + sku.SalePrice -= jxutils.StandardPrice2Int(v.MtCharge + v.PoiCharge) } sku.StoreSubName = utils.Int2Str(v.Type) } @@ -265,7 +267,6 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo if sku.SalePrice < 0 { sku.SalePrice = jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])) } - // if product["isGift"].(bool) { // sku.SkuType = 1 // } From f18ef3a1a9ba8227b1c4bc0b92cd94df6dfa4499 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, 21 Sep 2020 10:23:08 +0800 Subject: [PATCH 16/51] =?UTF-8?q?=E9=AB=98=E5=BE=B7page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index dc8315258..afeb8e7f5 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -114,9 +114,18 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err order.TotalShopMoney = 100 } if order.ConsigneeAddress != "" { - lng, lat, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") - order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) - order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) + lng, lat, err2 := api.AutonaviAPI.GetCoordinateFromAddressByPage(order.ConsigneeAddress) + if err = err2; err != nil { + globals.SugarLogger.Infof("高德page err: %v", err) + } + if err == nil && lng != 0 && lat != 0 { + order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) + order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) + } else { + lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") + order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng2) + order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat2) + } order.CoordinateType = model.CoordinateTypeMars } for _, v := range msg.ItemInfoList { From e0d0a45d564b49d39fc606d41610c193af19a740 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, 21 Sep 2020 10:32:57 +0800 Subject: [PATCH 17/51] =?UTF-8?q?-30=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index afeb8e7f5..2cbb92430 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -213,8 +213,8 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err // 如果是暂停,表示是预订单g if msg.OrderState == jdshopapi.OrderStatusPause || msg.OrderState == jdshopapi.OrderStatusPopPause { order.BusinessType = model.BusinessTypeDingshida - if time, err := api.JdShopAPI.GetOrderExtInfoByOrderId(order.VendorOrderID2); err == nil { - order.ExpectedDeliveredTime = utils.Str2Time(time) + if time2, err := api.JdShopAPI.GetOrderExtInfoByOrderId(order.VendorOrderID2); err == nil { + order.ExpectedDeliveredTime = utils.Str2Time(time2).Add(-time.Minute * 30) } order.PickDeadline = order.ExpectedDeliveredTime.Add(-time.Hour) } else if msg.OrderState == jdshopapi.OrderStatusWait { @@ -225,9 +225,9 @@ 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 { + if time2, err := api.JdShopAPI.GetOrderExtInfoByOrderId(order.VendorOrderID2); err == nil { order.BusinessType = model.BusinessTypeDingshida - order.ExpectedDeliveredTime = utils.Str2Time(time) + order.ExpectedDeliveredTime = utils.Str2Time(time2).Add(-time.Minute * 30) } } setJdsOrderSeq(order) From 9a3eb3594910ab546168857952d351eac6be741c 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, 21 Sep 2020 14:51:57 +0800 Subject: [PATCH 18/51] =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/order.go | 9 +++++---- business/partner/purchase/jdshop/callback.go | 17 +++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/business/model/order.go b/business/model/order.go index 4c6eeb301..99cc1a475 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -28,10 +28,11 @@ const ( ) const ( - OrderTypeNormal = 0 //普通订单 - OrderTypeMatter = 1 //物料订单 - OrderTypeSupplyGoods = 2 //进货订单 - OrderTypeDefendPrice = 3 //守价订单 + OrderTypeAddressErr = -1 //地址异常订单 + OrderTypeNormal = 0 //普通订单 + OrderTypeMatter = 1 //物料订单 + OrderTypeSupplyGoods = 2 //进货订单 + OrderTypeDefendPrice = 3 //守价订单 ) var ( diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 2cbb92430..8664854eb 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -70,13 +70,11 @@ func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) { if err != nil || order == nil { return err } - // order.StoreID = 102919 - // order.JxStoreID = 102919 - // order.StoreName = "商城模板(成都发货)" - // order.VendorStoreID = model.JdShopMainVendorStoreID - // order.DeliveryFlag = model.OrderDeliveryFlagMaskScheduleDisabled partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) + if order.OrderType == model.OrderTypeAddressErr { + noticeMsg += " 此订单地址有问题,需要矫正坐标!" + } ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "京东商城来新订单了!", noticeMsg) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "1439B3E07D3911EA881A525400E86DC0", "京东商城来新订单了!", noticeMsg) return err @@ -118,11 +116,15 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err if err = err2; err != nil { globals.SugarLogger.Infof("高德page err: %v", err) } + lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") + distance := jxutils.EarthDistance(lng, lat, lng2, lat2) + if distance > 1 { + order.OrderType = model.OrderTypeAddressErr + } if err == nil && lng != 0 && lat != 0 { order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) } else { - lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng2) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat2) } @@ -231,6 +233,9 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err } } setJdsOrderSeq(order) + if order.OrderType == model.OrderTypeAddressErr { + buildOrderTo102919(order) + } return order, err } From d377e40cbd41e02d6c70dd7aaefdc443f0bb7fb1 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, 21 Sep 2020 15:40:06 +0800 Subject: [PATCH 19/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95xinxi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 21 +++++++++++++++++++++ controllers/jx_order.go | 19 +++++++++++++++++++ routers/commentsRouter_controllers.go | 9 +++++++++ 3 files changed, 49 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index a196f8c15..bfd914ce9 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1835,3 +1835,24 @@ func RefreshJdsOrderConsigneeInfo(ctx *jxcontext.Context, vendorOrderID string) partner.CurOrderManager.UpdateOrderFields(order, []string{"ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeMobile2", "BuyerComment", "ConsigneeLng", "ConsigneeLat"}) return err } + +func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, payload map[string]interface{}) (num int64, err error) { + var ( + db = dao.GetDB() + ) + order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID) + valid := dao.StrictMakeMapByStructObject(payload, order, ctx.GetUserName()) + dao.Begin(db) + defer func() { + if r := recover(); r != nil { + dao.Rollback(db) + panic(r) + } + }() + if num, err = dao.UpdateEntityLogically(db, order, valid, ctx.GetUserName(), nil); err != nil { + dao.Rollback(db) + return 0, err + } + dao.Commit(db) + return num, err +} diff --git a/controllers/jx_order.go b/controllers/jx_order.go index d88564eae..952722fed 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -1182,3 +1182,22 @@ func (c *OrderController) RefreshJdsOrderConsigneeInfo() { return retVal, "", err }) } + +// @Title 修改订单信息 +// @Description 修改订单信息 +// @Param token header string true "认证token" +// @Param vendorOrderID formData string true "订单号" +// @Param vendorID formData int true "平台ID" +// @Param payload formData string true "json数据,格式为goodsOrder" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdateOrderInfo [put] +func (c *OrderController) UpdateOrderInfo() { + c.callUpdateOrderInfo(func(params *tOrderUpdateOrderInfoParams) (retVal interface{}, errCode string, err error) { + payload := make(map[string]interface{}) + if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil { + retVal, err = orderman.UpdateOrderInfo(params.Ctx, params.VendorOrderID, params.VendorID, payload) + } + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 43e739309..7fc3d3774 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1386,6 +1386,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], + beego.ControllerComments{ + Method: "UpdateOrderInfo", + Router: `/UpdateOrderInfo`, + AllowHTTPMethods: []string{"put"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], beego.ControllerComments{ Method: "UpdateOrderWaybillTip", From 1c4828e4c7c2db06387379510c1b9043ce0c9af9 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, 21 Sep 2020 17:14:02 +0800 Subject: [PATCH 20/51] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 17 +++++----- .../jxcallback/scheduler/defsch/defsch_afs.go | 2 ++ business/jxutils/unipush/push.go | 33 ++++++++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index bfd914ce9..e9221b96a 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1500,8 +1500,8 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if order.Status >= model.OrderStatusDelivering && order.Status != model.OrderStatusCanceled { return "", fmt.Errorf("暂不支持此状态的订单进行转移!") } - if order.VendorID != model.VendorIDJDShop { - return "", fmt.Errorf("暂不支持非京狗的订单进行转移!") + if order.VendorID != model.VendorIDJDShop || order.VendorID != model.VendorIDJX { + return "", fmt.Errorf("暂不支持该平台的订单进行转移!") } skus, err := dao.GetSimpleOrderSkus(db, vendorOrderID, nil) if err != nil || order == nil { @@ -1519,10 +1519,8 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } } if waybill != nil { - if waybill.WaybillVendorID != model.VendorIDJDWL { - if handler := partner.GetDeliveryPlatformFromVendorID(waybill.WaybillVendorID); handler != nil { - err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") - } + if handler := partner.GetDeliveryPlatformFromVendorID(waybill.WaybillVendorID); handler != nil { + err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") } } } @@ -1533,12 +1531,12 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) //重新构建order的数据 storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") if err != nil || len(storeMaps) == 0 { - return "", fmt.Errorf("该门店未绑定京狗平台,请先绑定后再转移!门店:[%v]", storeID) + return "", fmt.Errorf("该门店未绑定平台,请先绑定后再转移!门店:[%v]", storeID) } stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") if len(storeMaps) > 0 && len(stores) > 0 { if storeMaps[0].VendorStoreID == "" { - return "", fmt.Errorf("该门店未绑定京狗平台,或绑定有误,请联系技术部!门店:[%v]", storeID) + return "", fmt.Errorf("该门店未绑定平台,或绑定有误,请联系技术部!门店:[%v]", storeID) } order.StoreID = storeID order.StoreName = stores[0].Name @@ -1558,6 +1556,9 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if store.OpenTime1 == 0 || store.CloseTime1 == 0 { return "", fmt.Errorf("该门店没有营业时间,不能接单!门店:[%v]", storeID) } + if opentime2.Sub(opentime1) <= time.Hour { + return "", fmt.Errorf("该门店营业时间间隔过小,请确认!门店:[%v]", storeID) + } if !(orderCreatedAt.Sub(opentime1) >= 0 && orderCreatedAt.Sub(closetime1) <= 0) { if store.OpenTime2 != 0 && store.CloseTime2 != 0 { if !(orderCreatedAt.Sub(opentime2) >= 0 && orderCreatedAt.Sub(closetime2) <= 0) { diff --git a/business/jxcallback/scheduler/defsch/defsch_afs.go b/business/jxcallback/scheduler/defsch/defsch_afs.go index f8a00c562..260aec703 100644 --- a/business/jxcallback/scheduler/defsch/defsch_afs.go +++ b/business/jxcallback/scheduler/defsch/defsch_afs.go @@ -3,6 +3,7 @@ package defsch import ( "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" + push "git.rosy.net.cn/jx-callback/business/jxutils/unipush" "git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/msghub" @@ -31,6 +32,7 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err } msghub.OnNewWait4ApproveAfsOrder(order) weixinmsg.NotifyAfsOrderStatus(order) + push.NotifyAfsOrder(order) } } return err diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index 288bc68e3..eb73b8547 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -13,24 +13,19 @@ import ( "github.com/astaxie/beego" ) -func NotifyNewOrder(order *model.GoodsOrder) { +func pushToSingle(content, title string, storeID int) { var ( db = dao.GetDB() ) - globals.SugarLogger.Debugf("NotifyNewOrder push begin orderID :[%v]", order.VendorOrderID) - storePushs, err := dao.GetStorePushClient(db, jxutils.GetSaleStoreIDFromOrder(order), "") + storePushs, err := dao.GetStorePushClient(db, storeID, "") if err != nil { return } for _, v := range storePushs { - sb := new(strings.Builder) - sb.WriteString("老板,") - sb.WriteString(order.ConsigneeName) - sb.WriteString("购买了商品") - sb.WriteString(getOrderDetailBrief(order)) + status, err2 := api.PushAPI.PushToSingle(v.ClientID, false, &unipushapi.Notification{ - Title: "京西菜市新订单推送", - Body: sb.String(), + Title: title, + Body: content, }) if err = err2; err != nil { globals.SugarLogger.Debugf("NotifyNewOrder push error: [%v]", err) @@ -38,7 +33,7 @@ func NotifyNewOrder(order *model.GoodsOrder) { } if status == unipushapi.SuccessOffLine { _, err = api.PushAPI.PushToSingle(v.ClientID, true, &unipushapi.Notification{ - Body: sb.String(), + Body: content, }) if err != nil { globals.SugarLogger.Debugf("NotifyNewOrder push2 error: [%v]", err) @@ -49,6 +44,16 @@ func NotifyNewOrder(order *model.GoodsOrder) { } } +func NotifyNewOrder(order *model.GoodsOrder) { + globals.SugarLogger.Debugf("NotifyNewOrder push begin orderID :[%v]", order.VendorOrderID) + sb := new(strings.Builder) + sb.WriteString("老板,") + sb.WriteString(order.ConsigneeName) + sb.WriteString("购买了商品") + sb.WriteString(getOrderDetailBrief(order)) + pushToSingle(sb.String(), "京西菜市新订单推送", jxutils.GetSaleStoreIDFromOrder(order)) +} + func getOrderDetailBrief(order *model.GoodsOrder) (brief string) { sb := new(strings.Builder) sb.WriteString(order.Skus[0].SkuName) @@ -72,3 +77,9 @@ func getOrderDetailBrief(order *model.GoodsOrder) (brief string) { sb.WriteString("元") return sb.String() } + +func NotifyAfsOrder(afsOrder *model.AfsOrder) (err error) { + globals.SugarLogger.Debugf("NotifyAfsOrder push begin orderID :[%v]", afsOrder.VendorOrderID) + pushToSingle("老板,您有新的售后单,请尽快处理!", "京西菜市售后单推送", jxutils.GetSaleStoreIDFromAfsOrder(afsOrder)) + return err +} From c586ee6f9b60e14633537d4a1898044fa6abff56 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, 21 Sep 2020 17:49:39 +0800 Subject: [PATCH 21/51] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 1 + business/jxutils/unipush/push.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index fe42e4bf0..88c29c18d 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1492,6 +1492,7 @@ func (s *DefScheduler) notifyOrderCanceled(order *model.GoodsOrder) { order = setFakeActualPayPrice(order) weixinmsg.NotifyOrderCanceled(order) smsmsg.NotifyOrderCanceled(order) + push.NotifyOrderCanceled(order) }) } } diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index eb73b8547..32aac9f6c 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -1,6 +1,7 @@ package push import ( + "fmt" "strings" "git.rosy.net.cn/baseapi/platformapi/unipushapi" @@ -83,3 +84,9 @@ func NotifyAfsOrder(afsOrder *model.AfsOrder) (err error) { pushToSingle("老板,您有新的售后单,请尽快处理!", "京西菜市售后单推送", jxutils.GetSaleStoreIDFromAfsOrder(afsOrder)) return err } + +func NotifyOrderCanceled(order *model.GoodsOrder) (err error) { + title := fmt.Sprintf("老板,您的订单%s第%d号订单, %s被取消了!", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID) + pushToSingle(title, "京西菜市取消单推送", jxutils.GetSaleStoreIDFromOrder(order)) + return err +} From 97d4d08e5099e32b71d9e806393d7a5b0e95be15 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 22 Sep 2020 01:06:16 +0800 Subject: [PATCH 22/51] bug && --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index e9221b96a..5404a7b25 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1500,7 +1500,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if order.Status >= model.OrderStatusDelivering && order.Status != model.OrderStatusCanceled { return "", fmt.Errorf("暂不支持此状态的订单进行转移!") } - if order.VendorID != model.VendorIDJDShop || order.VendorID != model.VendorIDJX { + if order.VendorID != model.VendorIDJDShop && order.VendorID != model.VendorIDJX { return "", fmt.Errorf("暂不支持该平台的订单进行转移!") } skus, err := dao.GetSimpleOrderSkus(db, vendorOrderID, nil) From 78ae47ce66f340ce5c5fe171fc86d70e43fdac09 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, 23 Sep 2020 08:34:49 +0800 Subject: [PATCH 23/51] zy --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 5404a7b25..3d309b13e 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1556,7 +1556,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if store.OpenTime1 == 0 || store.CloseTime1 == 0 { return "", fmt.Errorf("该门店没有营业时间,不能接单!门店:[%v]", storeID) } - if opentime2.Sub(opentime1) <= time.Hour { + if closetime1.Sub(opentime1) <= time.Hour { return "", fmt.Errorf("该门店营业时间间隔过小,请确认!门店:[%v]", storeID) } if !(orderCreatedAt.Sub(opentime1) >= 0 && orderCreatedAt.Sub(closetime1) <= 0) { From b5cb571630f39bb0a2b3597f0f0799c63a28be76 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, 23 Sep 2020 09:49:07 +0800 Subject: [PATCH 24/51] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E4=B9=9F=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 48 +++++++++++-------- business/jxutils/jxutils.go | 39 +++++++++++++-- business/partner/purchase/jx/localjx/order.go | 41 ++-------------- business/partner/purchase/jx/order_afs.go | 4 +- 4 files changed, 69 insertions(+), 63 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 3d309b13e..826a5bec1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1593,36 +1593,42 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } else { return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID) } - if len(order.VendorOrderID) > 12 { - var goodsOrders []*model.GoodsOrder - sql := ` - SELECT * FROM goods_order WHERE vendor_order_id2 = ? ORDER BY vendor_order_id DESC - ` - sqlParams := []interface{}{order.VendorOrderID2} - err = dao.GetRows(db, &goodsOrders, sql, sqlParams) - if goodsOrders[0].Status != model.OrderStatusCanceled { - err = jdshop.ChangeOrderStatus(goodsOrders[0].VendorOrderID, model.OrderStatusCanceled, "订单转移被取消") + if order.VendorID == model.VendorIDJDShop { + if len(order.VendorOrderID) > 12 { + var goodsOrders []*model.GoodsOrder + sql := ` + SELECT * FROM goods_order WHERE vendor_order_id2 = ? ORDER BY vendor_order_id DESC + ` + sqlParams := []interface{}{order.VendorOrderID2} + err = dao.GetRows(db, &goodsOrders, sql, sqlParams) + if goodsOrders[0].Status != model.OrderStatusCanceled { + err = jdshop.ChangeOrderStatus(goodsOrders[0].VendorOrderID, model.OrderStatusCanceled, "订单转移被取消") + } + // suffix := utils.Str2Int(goodsOrders[0].VendorOrderID[12:len(goodsOrders[0].VendorOrderID)]) + // suffix++ + if len(order.VendorOrderID2) > 18 { + order.VendorOrderID2 = order.VendorOrderID2[0:12] + } + order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*10000) + utils.Int2Str(time.Now().Second()) + if len(order.VendorOrderID) < 18 { + order.VendorOrderID = order.VendorOrderID + "0" + } } - // suffix := utils.Str2Int(goodsOrders[0].VendorOrderID[12:len(goodsOrders[0].VendorOrderID)]) - // suffix++ - if len(order.VendorOrderID2) > 18 { - order.VendorOrderID2 = order.VendorOrderID2[0:12] - } - order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*10000) + utils.Int2Str(time.Now().Second()) - if len(order.VendorOrderID) < 18 { - order.VendorOrderID = order.VendorOrderID + "0" + if storeID != model.JdShopMainStoreID { + order.DeliveryFlag = model.NO } + } else { + order.VendorOrderID2 = order.VendorOrderID + order.VendorOrderID = utils.Int64ToStr(jxutils.GenOrderNo()) + order.DeliveryFlag = model.NO } for _, sku := range skus { sku.VendorOrderID = order.VendorOrderID sku.ID = 0 order.Skus = append(order.Skus, sku) } - if storeID != model.JdShopMainStoreID { - order.DeliveryFlag = model.NO - } - order.Status = model.OrderStatusNew setJdsOrderSeq(order) + order.Status = model.OrderStatusNew err = partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) vendorOrderIDJds = order.VendorOrderID return vendorOrderIDJds, err diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index c578cd043..2fe3d5aa0 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/aes" + "crypto/md5" "encoding/base64" "fmt" "io/ioutil" @@ -26,9 +27,10 @@ import ( ) var ( - routinePool *routinepool.Pool - skuNamePat *regexp.Regexp - emailPat *regexp.Regexp + routinePool *routinepool.Pool + skuNamePat *regexp.Regexp + emailPat *regexp.Regexp + orderNoBeginTimestamp int64 resourceTypeMap = map[int][]string{ model.VendorIDQiNiuCloud: []string{ @@ -75,6 +77,7 @@ func init() { // https://stackoverflow.com/questions/38933898/error-parsing-regexp-invalid-or-unsupported-perl-syntax skuNamePat = regexp.MustCompile(`([\((\[【][^\((\[【\))\]】]*[\))\]】])?(.*?)([((].*[))])?\s*约?([1-9][\d\.]*)(g|G|kg|kG|Kg|KG|l|L|ml|mL|Ml|ML|克)\s*([((].*[))])?\s*(?:\/|/|)\s*([^\s()()]{0,2})(\s.*)?$\s*([((].*[))])?$`) emailPat = regexp.MustCompile(`[A-Za-z0-9_\-.]+@(?:[A-Za-z0-9_\-]+\.)+[A-Za-z]+`) + orderNoBeginTimestamp = utils.Str2Time("2010-01-01 00:00:00").Unix() } func getJxStoreIDFromOrder(order *model.GoodsOrder) (retVal int) { @@ -168,6 +171,36 @@ func GetPossibleVendorIDFromVendorOrderID(vendorOrderID string) (vendorID int) { return vendorID } +func GenOrderNo() (orderNo int64) { + const prefix = 88 + const randPartNum = 1000 + orderNo = time.Now().Unix() - orderNoBeginTimestamp + orderNo = orderNo * randPartNum + md5Bytes := md5.Sum([]byte(utils.GetUUID())) + randPart := 0 + for k, v := range md5Bytes { + randPart += int(v) << ((k % 3) * 8) + } + orderNo += int64(randPart % randPartNum) + orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix + return orderNo +} + +func GenAfsOrderNo() (orderNo int64) { + const prefix = 80 + const randPartNum = 100 + orderNo = time.Now().Unix() - orderNoBeginTimestamp + orderNo = orderNo * randPartNum + md5Bytes := md5.Sum([]byte(utils.GetUUID())) + randPart := 0 + for k, v := range md5Bytes { + randPart += int(v) << ((k % 3) * 8) + } + orderNo += int64(randPart % randPartNum) + orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix + return orderNo +} + func GetPossibleVendorIDFromAfsOrderID(afsOrderID string) (vendorID int) { vendorID = model.VendorIDUnknown if afsOrderIDInt64 := utils.Str2Int64WithDefault(afsOrderID, 0); afsOrderIDInt64 > 0 { diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index eec7914c1..e9980384f 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1,7 +1,6 @@ package localjx import ( - "crypto/md5" "fmt" "math" "regexp" @@ -140,8 +139,6 @@ type MatterOrderStatus struct { } var ( - orderNoBeginTimestamp int64 - weekdayMap = map[int]string{ 1: "一", 2: "二", @@ -174,7 +171,6 @@ var ( ) func init() { - orderNoBeginTimestamp = utils.Str2Time("2010-01-01 00:00:00").Unix() } func GetMyOrders(ctx *jxcontext.Context, fromDateStr, toDateStr string, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { @@ -250,7 +246,7 @@ func CreateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64, if jxOrder.IsPriceDefend == model.YES { outJxOrder.OrderID = jxOrder.OrderID } else { - outJxOrder.OrderID = GenOrderNo(ctx) + outJxOrder.OrderID = jxutils.GenOrderNo() } order, err2 := jxOrder2GoodsOrder(ctx, outJxOrder, deliveryAddress, "", IsDeliverySelf) if err = err2; err == nil { @@ -273,7 +269,7 @@ func buildDefendPriceOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, address ) issue = jxutils.GetDefendPriceIssue() priceDefendOrder := &model.PriceDefendOrder{ - VendorOrderID: utils.Int64ToStr(GenOrderNo(ctx)), + VendorOrderID: utils.Int64ToStr(jxutils.GenOrderNo()), StoreID: jxOrder.StoreID, SkuID: jxOrder.Skus[0].SkuID, AddressID: addressID, @@ -471,37 +467,6 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) { return err } -func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) { - const prefix = 88 - const randPartNum = 1000 - orderNo = time.Now().Unix() - orderNoBeginTimestamp - // fmt.Println(orderNo) - orderNo = orderNo * randPartNum - md5Bytes := md5.Sum([]byte(utils.GetUUID())) - randPart := 0 - for k, v := range md5Bytes { - randPart += int(v) << ((k % 3) * 8) - } - orderNo += int64(randPart % randPartNum) - orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix - return orderNo -} - -func GenAfsOrderNo(ctx *jxcontext.Context) (orderNo int64) { - const prefix = 80 - const randPartNum = 100 - orderNo = time.Now().Unix() - orderNoBeginTimestamp - orderNo = orderNo * randPartNum - md5Bytes := md5.Sum([]byte(utils.GetUUID())) - randPart := 0 - for k, v := range md5Bytes { - randPart += int(v) << ((k % 3) * 8) - } - orderNo += int64(randPart % randPartNum) - orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix - return orderNo -} - func GenPayOrderID(order *model.GoodsOrder) (payOrderID int64) { return utils.Str2Int64(order.VendorOrderID) } @@ -2007,7 +1972,7 @@ func CreateOrderByPriceDefend(ctx *jxcontext.Context) (err error) { BuyerComment: "守价订单", StoreID: vv[0].StoreID, IsPriceDefend: model.YES, - OrderID: GenOrderNo(ctx), + OrderID: jxutils.GenOrderNo(), UserID: address.UserID, } for _, priceDefend := range vv { diff --git a/business/partner/purchase/jx/order_afs.go b/business/partner/purchase/jx/order_afs.go index 757c6ec44..c67602161 100644 --- a/business/partner/purchase/jx/order_afs.go +++ b/business/partner/purchase/jx/order_afs.go @@ -5,6 +5,8 @@ import ( "strings" "time" + "git.rosy.net.cn/jx-callback/business/jxutils" + "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/business/model/dao" @@ -142,7 +144,7 @@ func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.G func buildOrderStatus(ctx *jxcontext.Context, order *model.GoodsOrder, reason string, isJxShop bool) (orderStatus *model.OrderStatus) { orderStatus = &model.OrderStatus{ - VendorOrderID: utils.Int64ToStr(localjx.GenAfsOrderNo(ctx)), // 是售后单ID,不是订单ID,订单ID在RefVendorOrderID中 + VendorOrderID: utils.Int64ToStr(jxutils.GenAfsOrderNo()), // 是售后单ID,不是订单ID,订单ID在RefVendorOrderID中 VendorID: order.VendorID, OrderType: model.OrderTypeAfsOrder, RefVendorOrderID: order.VendorOrderID, From 56cd470c35d57a850c37f0ae6e00bc315bb60eb0 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, 23 Sep 2020 10:09:03 +0800 Subject: [PATCH 25/51] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A1=A5=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 826a5bec1..307ef43a3 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1212,7 +1212,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o continue } //有可能是库里已经有这个订单了 - orderE, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(jdsOrder.OrderID)+"01", model.VendorIDJDShop) + orderE, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(jdsOrder.OrderID)+"000001", model.VendorIDJDShop) if orderE != nil { continue } From fcfe25797e1a15bd11711893673d2c8eab58a282 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, 23 Sep 2020 10:22:18 +0800 Subject: [PATCH 26/51] =?UTF-8?q?beta=E4=B8=8D=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/unipush/push.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index 32aac9f6c..acd099a4d 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -18,6 +18,9 @@ func pushToSingle(content, title string, storeID int) { var ( db = dao.GetDB() ) + if !globals.IsProductEnv() { + return + } storePushs, err := dao.GetStorePushClient(db, storeID, "") if err != nil { return From 26c2a33f2d418e64e4f11b6d0db6738183d49149 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, 23 Sep 2020 10:39:22 +0800 Subject: [PATCH 27/51] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 307ef43a3..27c757710 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1524,10 +1524,6 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } } } - err = jdshop.ChangeOrderStatus(vendorOrderID, model.OrderStatusCanceled, "订单转移被取消") - if err != nil { - return "", err - } //重新构建order的数据 storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") if err != nil || len(storeMaps) == 0 { @@ -1617,10 +1613,31 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if storeID != model.JdShopMainStoreID { order.DeliveryFlag = model.NO } + err = jdshop.ChangeOrderStatus(vendorOrderID, model.OrderStatusCanceled, "订单转移被取消") + if err != nil { + return "", err + } } else { order.VendorOrderID2 = order.VendorOrderID order.VendorOrderID = utils.Int64ToStr(jxutils.GenOrderNo()) order.DeliveryFlag = model.NO + orderStatus := &model.OrderStatus{ + VendorOrderID: vendorOrderID, + VendorID: model.VendorIDJX, + OrderType: model.OrderTypeOrder, + RefVendorOrderID: vendorOrderID, + RefVendorID: model.VendorIDJX, + VendorStatus: utils.Int2Str(model.OrderStatusCanceled), + Status: model.OrderStatusCanceled, + StatusTime: time.Now(), + Remark: "订单转移被取消", + } + jxutils.CallMsgHandlerAsync(func() { + err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus) + }, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX)) + if err != nil { + return "", err + } } for _, sku := range skus { sku.VendorOrderID = order.VendorOrderID From 910f9d399b1432651641cfed603a0c9312da44d4 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, 23 Sep 2020 10:50:00 +0800 Subject: [PATCH 28/51] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=93=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 27c757710..e6b56a88b 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1646,6 +1646,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } setJdsOrderSeq(order) order.Status = model.OrderStatusNew + fmt.Println("testordddddddddddddddddddddddddddddddddddd", utils.Format4Output(order, false)) err = partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) vendorOrderIDJds = order.VendorOrderID return vendorOrderIDJds, err From 8409985668b0e6539f6fe9c3de8575d0dd7cea61 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, 23 Sep 2020 11:05:34 +0800 Subject: [PATCH 29/51] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=93=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index e6b56a88b..bda7fb937 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1617,6 +1617,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if err != nil { return "", err } + order.Status = model.OrderStatusNew } else { order.VendorOrderID2 = order.VendorOrderID order.VendorOrderID = utils.Int64ToStr(jxutils.GenOrderNo()) @@ -1638,6 +1639,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if err != nil { return "", err } + order.Status = model.OrderStatusAccepted } for _, sku := range skus { sku.VendorOrderID = order.VendorOrderID @@ -1645,8 +1647,6 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) order.Skus = append(order.Skus, sku) } setJdsOrderSeq(order) - order.Status = model.OrderStatusNew - fmt.Println("testordddddddddddddddddddddddddddddddddddd", utils.Format4Output(order, false)) err = partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) vendorOrderIDJds = order.VendorOrderID return vendorOrderIDJds, err From 55c6962f5da8b447961aa49dc8bde575402a4896 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, 23 Sep 2020 13:35:34 +0800 Subject: [PATCH 30/51] =?UTF-8?q?test=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 2 ++ business/jxstore/cms/user2.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 1afde6854..21703528d 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("testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", utils.Format4Output(authInfo, false)) return authInfo, err } diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index 242986fb0..6fdc80348 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -211,7 +211,6 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) TryAddStoreBossRole4User(ctx, user) if mobileAuth != nil { - fmt.Println("test111111111111111111111111111111111111", utils.Format4Output(user, false)) if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil { err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo) } From b53ddbeb7c3ed0cc0b9109aa6a8d11da029b3957 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, 23 Sep 2020 13:55:11 +0800 Subject: [PATCH 31/51] =?UTF-8?q?test=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 21703528d..9dec02055 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -271,6 +271,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string user = userProvider.GetUser(authBindEx.UserID, UserIDID) } } + fmt.Println("test2222222222222222222222222222222", utils.Format4Output(user, false)) authInfo = createAuthInfo(user, authBindEx) if user != nil && user.GetID() != "" { userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) @@ -296,7 +297,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string } else { err = ErrIllegalAuthType } - fmt.Println("testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", utils.Format4Output(authInfo, false)) return authInfo, err } @@ -401,6 +401,7 @@ func createToken(user IUser, authBindInfo *AuthBindEx) (token string, tokenType userID := TokenUserEmpty userName := authBindInfo.AuthID tokenType = TokenTypeOnlyAuth + fmt.Println("test111111111111111111111", utils.Format4Output(user, false)) if user != nil { userID = user.GetID() userName = "[" + user.GetID2() + "]" From 2ffbc14b4dfeec0e7f2838690651a1c84dc12771 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, 23 Sep 2020 14:49:18 +0800 Subject: [PATCH 32/51] =?UTF-8?q?test=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 9dec02055..f653406be 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/base64" "errors" - "fmt" "regexp" "strings" "time" @@ -244,7 +243,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string realAuthID = user.GetID() } if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil { - // globals.SugarLogger.Debugf("auth2 Login authBindEx:%s", utils.Format4Output(authBindEx, false)) + globals.SugarLogger.Debugf("testttttttttttttttttttttttttttttttttttt", utils.Format4Output(authBindEx, false)) if authBindEx == nil { // mobile, email会返回nil(表示不会新建AuthBind实体) user = userProvider.GetUser(authID, authIDType) authBindEx = &AuthBindEx{ @@ -271,7 +270,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string user = userProvider.GetUser(authBindEx.UserID, UserIDID) } } - fmt.Println("test2222222222222222222222222222222", utils.Format4Output(user, false)) authInfo = createAuthInfo(user, authBindEx) if user != nil && user.GetID() != "" { userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP()) @@ -401,7 +399,6 @@ func createToken(user IUser, authBindInfo *AuthBindEx) (token string, tokenType userID := TokenUserEmpty userName := authBindInfo.AuthID tokenType = TokenTypeOnlyAuth - fmt.Println("test111111111111111111111", utils.Format4Output(user, false)) if user != nil { userID = user.GetID() userName = "[" + user.GetID2() + "]" From 0ad0fc7840121944f369cb526584f0aad91e33b5 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, 23 Sep 2020 15:04:04 +0800 Subject: [PATCH 33/51] =?UTF-8?q?test=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 | 6 ------ business/auth2/authprovider/weixin/weixin_mini.go | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/business/auth2/authprovider/weixin/weixin.go b/business/auth2/authprovider/weixin/weixin.go index 2f4b344a9..a1876c258 100644 --- a/business/auth2/authprovider/weixin/weixin.go +++ b/business/auth2/authprovider/weixin/weixin.go @@ -27,7 +27,6 @@ var ( AutherObjWX *Auther AutherObjMP *Auther AutherObjNative *Auther - AutherObjApp *Auther ) var ( @@ -49,11 +48,6 @@ 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) { diff --git a/business/auth2/authprovider/weixin/weixin_mini.go b/business/auth2/authprovider/weixin/weixin_mini.go index 072ea9573..b6b31715f 100644 --- a/business/auth2/authprovider/weixin/weixin_mini.go +++ b/business/auth2/authprovider/weixin/weixin_mini.go @@ -27,11 +27,15 @@ var ( var ( AutherObjMini *MiniAuther + AutherObjApp *MiniAuther ) func init() { AutherObjMini = new(MiniAuther) auth2.RegisterAuther(AuthTypeMini, AutherObjMini) + + AutherObjApp = new(MiniAuther) + auth2.RegisterAuther(AuthTypeWxApp, AutherObjApp) } func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBindEx *auth2.AuthBindEx, err error) { From f9530f614ceeb87462459a287c93b79026d69c1e 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, 23 Sep 2020 15:07:45 +0800 Subject: [PATCH 34/51] =?UTF-8?q?test=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 | 6 ++++++ business/auth2/authprovider/weixin/weixin_mini.go | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/business/auth2/authprovider/weixin/weixin.go b/business/auth2/authprovider/weixin/weixin.go index a1876c258..2f4b344a9 100644 --- a/business/auth2/authprovider/weixin/weixin.go +++ b/business/auth2/authprovider/weixin/weixin.go @@ -27,6 +27,7 @@ var ( AutherObjWX *Auther AutherObjMP *Auther AutherObjNative *Auther + AutherObjApp *Auther ) var ( @@ -48,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) { diff --git a/business/auth2/authprovider/weixin/weixin_mini.go b/business/auth2/authprovider/weixin/weixin_mini.go index b6b31715f..072ea9573 100644 --- a/business/auth2/authprovider/weixin/weixin_mini.go +++ b/business/auth2/authprovider/weixin/weixin_mini.go @@ -27,15 +27,11 @@ var ( var ( AutherObjMini *MiniAuther - AutherObjApp *MiniAuther ) func init() { AutherObjMini = new(MiniAuther) auth2.RegisterAuther(AuthTypeMini, AutherObjMini) - - AutherObjApp = new(MiniAuther) - auth2.RegisterAuther(AuthTypeWxApp, AutherObjApp) } func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBindEx *auth2.AuthBindEx, err error) { From 698196606421ef92880a621fe54faf8624b3f45a 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, 24 Sep 2020 09:17:17 +0800 Subject: [PATCH 35/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index e64f152fb..80b74c741 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3619,7 +3619,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status storeAudits[0].AuditStatus = model.StoreAuditStatusCreated //添加门店 storeExt := &StoreExt{} - utils.Map2StructByJson(utils.Struct2MapByJson(&storeAudit), &storeExt, false) + utils.Map2StructByJson(utils.Struct2MapByJson(&storeAudits[0]), &storeExt, false) storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) if err != nil { return retVal, fmt.Errorf(err.Error()) @@ -3635,7 +3635,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status } storeAudits[0].LastOperator = ctx.GetUserName() storeAudits[0].Remark = storeAudit.Remark - _, err = dao.UpdateEntity(db, storeAudits[0], "UserID", "Status", "Remark") + _, err = dao.UpdateEntity(db, storeAudits[0], "LastOperator", "Status", "Remark") //是否推送app消息 if err == nil { From 21c3de8951840964e5333060a38aea2fca505cc4 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, 24 Sep 2020 09:24:12 +0800 Subject: [PATCH 36/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/cms_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 1d10c0ec6..da28300eb 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -889,7 +889,7 @@ func (c *StoreController) GetStoreAudit() { // @Title 门店审核 // @Description 门店审核 // @Param token header string true "认证token" -// @Param payload fomData string true "json数据,storeaudit对象" +// @Param payload formData string true "json数据,storeaudit对象" // @Param status formData int false "审核标志,1通过,-1 不通过" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult From 65f7394351659f7560813b284a1a3cc5116a37ae 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, 24 Sep 2020 09:28:50 +0800 Subject: [PATCH 37/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 80b74c741..3674094e2 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3618,7 +3618,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status if status == model.StoreAuditStatusCreated { storeAudits[0].AuditStatus = model.StoreAuditStatusCreated //添加门店 - storeExt := &StoreExt{} + var storeExt *StoreExt utils.Map2StructByJson(utils.Struct2MapByJson(&storeAudits[0]), &storeExt, false) storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) if err != nil { From 8eebf436dcd4bd454d4cb9751eb87beedb91b010 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, 24 Sep 2020 09:35:12 +0800 Subject: [PATCH 38/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 3674094e2..af6fd43ba 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3601,7 +3601,7 @@ func GetStoreAudit(ctx *jxcontext.Context, statuss []int, keyword, applyTimeStar func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status int) (err error) { db := dao.GetDB() - if status == model.StoreAuditStatusOnline { + if status != model.StoreAuditStatusCreated && status != model.StoreAuditStatusRejected { return fmt.Errorf("审核标志不正确!") } task := tasksch.NewParallelTask("StoreAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(true), ctx, @@ -3618,8 +3618,10 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status if status == model.StoreAuditStatusCreated { storeAudits[0].AuditStatus = model.StoreAuditStatusCreated //添加门店 - var storeExt *StoreExt - utils.Map2StructByJson(utils.Struct2MapByJson(&storeAudits[0]), &storeExt, false) + storeExt := &StoreExt{} + if data, err := json.Marshal(&storeAudits[0]); err == nil { + utils.UnmarshalUseNumber(data, &storeExt) + } storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) if err != nil { return retVal, fmt.Errorf(err.Error()) From 893ff3bd350feb3bc69ada17d6ed19ae10399ec7 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, 24 Sep 2020 09:38:03 +0800 Subject: [PATCH 39/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index af6fd43ba..468b23af0 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3631,13 +3631,13 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status return retVal, fmt.Errorf(err.Error()) } } else if status == model.StoreAuditStatusRejected { - storeAudits[0].Status = model.StoreAuditStatusRejected + storeAudits[0].AuditStatus = model.StoreAuditStatusRejected } else { return retVal, fmt.Errorf("审核标志不正确!") } storeAudits[0].LastOperator = ctx.GetUserName() storeAudits[0].Remark = storeAudit.Remark - _, err = dao.UpdateEntity(db, storeAudits[0], "LastOperator", "Status", "Remark") + _, err = dao.UpdateEntity(db, storeAudits[0], "LastOperator", "AuditStatus", "Remark") //是否推送app消息 if err == nil { From 3466a5fccda19d1d80f7e8420dfef790b2415403 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, 24 Sep 2020 09:49:18 +0800 Subject: [PATCH 40/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 468b23af0..f1084d422 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3570,6 +3570,19 @@ func CreateStoreAudit(ctx *jxcontext.Context, storeAudit *model.StoreAudit) (err if len(storeAudits) > 0 { return fmt.Errorf("您已申请过入驻,请不要重复申请!") } + if storeAudit.Address == "" { + return fmt.Errorf("门店地址必填!") + } + if storeAudit.Lng == 0 || storeAudit.Lat == 0 { + lng, lat, _ := api.AutonaviAPI.GetCoordinateFromAddressByPage(storeAudit.Address) + if lng != 0 && lat != 0 { + storeAudit.Lng = jxutils.StandardCoordinate2Int(lng) + storeAudit.Lat = jxutils.StandardCoordinate2Int(lat) + } else { + return fmt.Errorf("请填写正确的门店地址!") + } + } + if storeAudit.UserID == "" { storeAudit.UserID = ctx.GetUserID() } From 3995b3705bac1af8da11cb57ba126de905f93e56 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, 24 Sep 2020 10:04:58 +0800 Subject: [PATCH 41/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 1 + business/model/store.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index f1084d422..fce31534c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3635,6 +3635,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status if data, err := json.Marshal(&storeAudits[0]); err == nil { utils.UnmarshalUseNumber(data, &storeExt) } + storeExt.ID = 0 storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) if err != nil { return retVal, fmt.Errorf(err.Error()) diff --git a/business/model/store.go b/business/model/store.go index b995d813e..8b513e42a 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -711,8 +711,8 @@ type StoreAudit struct { CloseTime1 int16 `json:"closeTime1" validate:"max=2359,min=1` // 格式同上 OpenTime2 int16 `json:"openTime2" validate:"max=2359,min=1,ltfield=CloseTime2"` // 格式同上 CloseTime2 int16 `json:"closeTime2" validate:"max=2359,min=1` // 格式同上 - Lng int `json:"-"` // 乘了10的6次方 - Lat int `json:"-"` // 乘了10的6次方 + Lng int `json:"lng"` // 乘了10的6次方 + Lat int `json:"lat"` // 乘了10的6次方 DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义 DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米 Status int `json:"status"` From 4184561e5f7ac6dcd4e77ba4cb4a0c3d42dc3be0 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, 24 Sep 2020 10:08:21 +0800 Subject: [PATCH 42/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index fce31534c..be904a6aa 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3636,6 +3636,8 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status utils.UnmarshalUseNumber(data, &storeExt) } storeExt.ID = 0 + storeExt.FloatLng = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLng)) + storeExt.FloatLat = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLat)) storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) if err != nil { return retVal, fmt.Errorf(err.Error()) From 610f44e5b5a56f665a1bc296d1b9b536b91f9c61 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, 24 Sep 2020 10:30:52 +0800 Subject: [PATCH 43/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/store.go | 58 +++++++++++++------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/business/partner/delivery/mtps/store.go b/business/partner/delivery/mtps/store.go index e38939f23..9664c736e 100644 --- a/business/partner/delivery/mtps/store.go +++ b/business/partner/delivery/mtps/store.go @@ -44,36 +44,38 @@ func (c *DeliveryHandler) OnStoreStatus(msg *mtpsapi.CallbackShopStatusMsg) (ret } func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) { - businessHours := []*mtpsapi.BusinessHour{ - &mtpsapi.BusinessHour{ - BeginTime: "06:00", - EndTime: "22:00", - }, - } - shopInfo := &mtpsapi.ShopInfo{ - ShopID: storeDetail.VendorStoreID, - ShopName: storeDetail.Name, - Category: mtpsapi.ShopCategoryFruit, - SecondCategory: mtpsapi.ShopCategoryFruitFruit, - ContactName: storeDetail.PayeeName, - ContactPhone: storeDetail.Tel1, - ContactEmail: fakeContactEmail, - ShopAddress: storeDetail.Address, - ShopLng: storeDetail.Lng, - ShopLat: storeDetail.Lat, - CoordinateType: mtpsapi.CoordinateTypeMars, - BusinessHours: string(utils.MustMarshal(businessHours)), - } - shopStatus := mtpsapi.ShopStatusAuditCreated if globals.EnableStoreWrite { - shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo) - if err == nil { - vendorStoreID = shopInfo.ShopID - status = getAuditStatus(shopStatus) + businessHours := []*mtpsapi.BusinessHour{ + &mtpsapi.BusinessHour{ + BeginTime: "06:00", + EndTime: "22:00", + }, + } + shopInfo := &mtpsapi.ShopInfo{ + ShopID: storeDetail.VendorStoreID, + ShopName: storeDetail.Name, + Category: mtpsapi.ShopCategoryFruit, + SecondCategory: mtpsapi.ShopCategoryFruitFruit, + ContactName: storeDetail.PayeeName, + ContactPhone: storeDetail.Tel1, + ContactEmail: fakeContactEmail, + ShopAddress: storeDetail.Address, + ShopLng: storeDetail.Lng, + ShopLat: storeDetail.Lat, + CoordinateType: mtpsapi.CoordinateTypeMars, + BusinessHours: string(utils.MustMarshal(businessHours)), + } + shopStatus := mtpsapi.ShopStatusAuditCreated + if globals.EnableStoreWrite { + shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo) + if err == nil { + vendorStoreID = shopInfo.ShopID + status = getAuditStatus(shopStatus) + } + } else { + vendorStoreID = utils.Int64ToStr(jxutils.GenFakeID()) + status = model.StoreAuditStatusOnline } - } else { - vendorStoreID = utils.Int64ToStr(jxutils.GenFakeID()) - status = model.StoreAuditStatusOnline } return vendorStoreID, status, err } From 392b2246fefc81c8f90c33cd426cc4ff44170acc 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, 24 Sep 2020 11:03:18 +0800 Subject: [PATCH 44/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index be904a6aa..f14aa13cf 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3636,6 +3636,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status utils.UnmarshalUseNumber(data, &storeExt) } storeExt.ID = 0 + storeExt.StoreLevel = "C" storeExt.FloatLng = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLng)) storeExt.FloatLat = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLat)) storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) From 5ac20742ea6797eb50ccb181be0ab3f7ca58b162 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, 24 Sep 2020 14:42:00 +0800 Subject: [PATCH 45/51] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index f14aa13cf..b84544e4c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3636,7 +3636,7 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status utils.UnmarshalUseNumber(data, &storeExt) } storeExt.ID = 0 - storeExt.StoreLevel = "C" + storeExt.Store.StoreLevel = "C" storeExt.FloatLng = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLng)) storeExt.FloatLat = jxutils.IntCoordinate2Standard(utils.Float64TwoInt(storeExt.FloatLat)) storeID, err := CreateStore(ctx, storeExt, ctx.GetUserName()) From 5348bcb82e35b4dd2a74153425fafa154d3fc48e 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, 24 Sep 2020 18:18:55 +0800 Subject: [PATCH 46/51] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=BE=97=E5=88=B0=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/cms.go | 5 ++ business/partner/purchase/jx/localjx/user.go | 61 ++++++++++++++++++++ controllers/cms.go | 15 +++++ controllers/jx_order2.go | 15 +++++ routers/commentsRouter_controllers.go | 18 ++++++ 5 files changed, 114 insertions(+) create mode 100644 business/partner/purchase/jx/localjx/user.go diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index c7a0603de..21aa88a38 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -222,6 +222,11 @@ func GetCoordinateDistrictCode(ctx *jxcontext.Context, lng, lat float64) (code i return api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat), nil } +func GetCoordinateTownInfo(ctx *jxcontext.Context, lng, lat float64) (name string, err error) { + name, _ = api.AutonaviAPI.GetCoordinateTownInfo(lng, lat) + return name, err +} + func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, msgContent string) (err error) { if needConfirmRequestMap[msgType] == 1 { if _, err = mobile.AutherObj.VerifySecret(mobileNum, verifyCode); err != nil { diff --git a/business/partner/purchase/jx/localjx/user.go b/business/partner/purchase/jx/localjx/user.go new file mode 100644 index 000000000..64c3a9d18 --- /dev/null +++ b/business/partner/purchase/jx/localjx/user.go @@ -0,0 +1,61 @@ +package localjx + +import ( + "time" + + "git.rosy.net.cn/jx-callback/business/model/dao" + + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/jxutils" + "git.rosy.net.cn/jx-callback/business/model" + + "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" +) + +type GetJxShopUsersResult struct { + model.User + RegisterTime time.Time `json:"registerTime"` + BuyCount int `json:"buyCount"` + ActualPayPrice int `json:"actualPayPrice"` + GoodComment string `json:"goodComment"` + BadComment string `json:"badComment"` + UserMembers []*model.UserMember `json:"userMembers"` +} + +func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { + var ( + requestList []*GetJxShopUsersResult + db = dao.GetDB() + ) + sql := ` + SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.name user_name, c.name city_name + FROM store_audit a + JOIN user b ON b.user_id = a.user_id + JOIN place c ON c.code = a.city_code + WHERE a.deleted_at = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, + } + // if len(statuss) > 0 { + // sql += " AND a.audit_status IN (" + GenQuestionMarks(len(statuss)) + ")" + // sqlParams = append(sqlParams, statuss) + // } + + if keyword != "" { + sql += " AND (a.user_id LIKE ? OR a.name LIKE ? OR a.tel1 LIKE ? OR a.tel2 LIKE ? OR a.address LIKE ?)" + sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%") + } + sql += "LIMIT ? OFFSET ?" + pageSize = jxutils.FormalizePageSize(pageSize) + sqlParams = append(sqlParams, pageSize, offset) + dao.Begin(db) + defer dao.Commit(db) + if err = dao.GetRows(db, &requestList, sql, sqlParams...); err == nil { + return &model.PagedInfo{ + TotalCount: dao.GetLastTotalRowCount(db), + Data: requestList, + }, nil + } + return pagedInfo, err +} diff --git a/controllers/cms.go b/controllers/cms.go index a323bb673..a0f3c5ef3 100644 --- a/controllers/cms.go +++ b/controllers/cms.go @@ -139,6 +139,21 @@ func (c *CmsController) GetCoordinateDistrictCode() { }) } +// @Title 根据坐标得到城市 +// @Description 根据坐标得到城市 +// @Param token header string true "认证token" +// @Param lng query number true "经度" +// @Param lat query number true "纬度" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetCoordinateTownInfo [get] +func (c *CmsController) GetCoordinateTownInfo() { + c.callGetCoordinateTownInfo(func(params *tCmsGetCoordinateTownInfoParams) (retVal interface{}, errCode string, err error) { + retVal, err = cms.GetCoordinateTownInfo(params.Ctx, params.Lng, params.Lat) + return retVal, "", err + }) +} + // @Title 得到配置参数 // @Description 得到配置参数 // @Param token header string true "认证token" diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index 275a3af2a..f201bd65a 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -283,3 +283,18 @@ func (c *JxOrderController) TestDefend() { return retVal, "", err }) } + +// @Title 查询京西商城用户信息 +// @Description 查询京西商城用户信息 +// @Param token header string true "认证token" +// @Param keyword query string false "关键字" +// @Param offset query int false "结果起始序号(以0开始,缺省为0)" +// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetJxShopUsers [get] +func (c *JxOrderController) GetJxShopUsers() { + c.callGetJxShopUsers(func(params *tJxorderGetJxShopUsersParams) (retVal interface{}, errCode string, err error) { + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 7fc3d3774..d3a4cd8b0 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -286,6 +286,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"], + beego.ControllerComments{ + Method: "GetCoordinateTownInfo", + Router: `/GetCoordinateTownInfo`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"], beego.ControllerComments{ Method: "GetNewOrderMsg", @@ -691,6 +700,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], + beego.ControllerComments{ + Method: "GetJxShopUsers", + Router: `/GetJxShopUsers`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], beego.ControllerComments{ Method: "GetMatterOrderStatus", From 0b0930ccd1908d9c0487421915ed2626a17fd5c0 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, 24 Sep 2020 18:26:04 +0800 Subject: [PATCH 47/51] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=BE=97=E5=88=B0=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/cms.go | 4 ++-- controllers/cms.go | 8 ++++---- routers/commentsRouter_controllers.go | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 21aa88a38..da514bc19 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -222,8 +222,8 @@ func GetCoordinateDistrictCode(ctx *jxcontext.Context, lng, lat float64) (code i return api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat), nil } -func GetCoordinateTownInfo(ctx *jxcontext.Context, lng, lat float64) (name string, err error) { - name, _ = api.AutonaviAPI.GetCoordinateTownInfo(lng, lat) +func GetCoordinateCityInfo(ctx *jxcontext.Context, lng, lat float64) (name string, err error) { + name, _ = api.AutonaviAPI.GetCoordinateCityInfo(lng, lat) return name, err } diff --git a/controllers/cms.go b/controllers/cms.go index a0f3c5ef3..5c4294fde 100644 --- a/controllers/cms.go +++ b/controllers/cms.go @@ -146,10 +146,10 @@ func (c *CmsController) GetCoordinateDistrictCode() { // @Param lat query number true "纬度" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult -// @router /GetCoordinateTownInfo [get] -func (c *CmsController) GetCoordinateTownInfo() { - c.callGetCoordinateTownInfo(func(params *tCmsGetCoordinateTownInfoParams) (retVal interface{}, errCode string, err error) { - retVal, err = cms.GetCoordinateTownInfo(params.Ctx, params.Lng, params.Lat) +// @router /GetCoordinateCityInfo [get] +func (c *CmsController) GetCoordinateCityInfo() { + c.callGetCoordinateCityInfo(func(params *tCmsGetCoordinateCityInfoParams) (retVal interface{}, errCode string, err error) { + retVal, err = cms.GetCoordinateCityInfo(params.Ctx, params.Lng, params.Lat) return retVal, "", err }) } diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index d3a4cd8b0..860790d4f 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -279,8 +279,8 @@ func init() { beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"], beego.ControllerComments{ - Method: "GetCoordinateDistrictCode", - Router: `/GetCoordinateDistrictCode`, + Method: "GetCoordinateCityInfo", + Router: `/GetCoordinateCityInfo`, AllowHTTPMethods: []string{"get"}, MethodParams: param.Make(), Filters: nil, @@ -288,8 +288,8 @@ func init() { beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:CmsController"], beego.ControllerComments{ - Method: "GetCoordinateTownInfo", - Router: `/GetCoordinateTownInfo`, + Method: "GetCoordinateDistrictCode", + Router: `/GetCoordinateDistrictCode`, AllowHTTPMethods: []string{"get"}, MethodParams: param.Make(), Filters: nil, From 1ff25bfa330c1efdcfe3683e9e75a12e487c278e 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, 25 Sep 2020 09:05:38 +0800 Subject: [PATCH 48/51] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/user.go | 39 ++++++++++---------- controllers/cms_user2.go | 17 +++++++++ controllers/jx_order2.go | 15 -------- routers/commentsRouter_controllers.go | 18 ++++----- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/business/partner/purchase/jx/localjx/user.go b/business/partner/purchase/jx/localjx/user.go index 64c3a9d18..5a4f39d82 100644 --- a/business/partner/purchase/jx/localjx/user.go +++ b/business/partner/purchase/jx/localjx/user.go @@ -1,9 +1,8 @@ package localjx import ( - "time" - "git.rosy.net.cn/jx-callback/business/model/dao" + "git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" @@ -14,12 +13,11 @@ import ( type GetJxShopUsersResult struct { model.User - RegisterTime time.Time `json:"registerTime"` - BuyCount int `json:"buyCount"` - ActualPayPrice int `json:"actualPayPrice"` - GoodComment string `json:"goodComment"` - BadComment string `json:"badComment"` - UserMembers []*model.UserMember `json:"userMembers"` + BuyCount int `json:"buyCount"` + ActualPayPrice int `json:"actualPayPrice"` + GoodCommentCount int `json:"goodCommentCount"` + BadCommentCount int `json:"badCommentCount"` + UserMembers []*model.UserMember `json:"userMembers"` } func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { @@ -28,23 +26,24 @@ func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int db = dao.GetDB() ) sql := ` - SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.name user_name, c.name city_name - FROM store_audit a - JOIN user b ON b.user_id = a.user_id - JOIN place c ON c.code = a.city_code - WHERE a.deleted_at = ? + SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.buy_count, b.actual_pay_price + FROM user a, + (SELECT a.user_id, COUNT(*) buy_count, SUM(c.actual_pay_price) actual_pay_price + FROM user a + JOIN auth_bind b ON b.user_id = a.user_id AND b.deleted_at = ? AND b.type_id = ? + JOIN goods_order c ON c.user_id = a.user_id AND c.status <> ? + WHERE a.deleted_at = ? + GROUP BY 1) b + WHERE a.user_id = b.user_id ` sqlParams := []interface{}{ + utils.DefaultTimeValue, api.WeixinMiniAppID2, + model.OrderStatusCanceled, utils.DefaultTimeValue, } - // if len(statuss) > 0 { - // sql += " AND a.audit_status IN (" + GenQuestionMarks(len(statuss)) + ")" - // sqlParams = append(sqlParams, statuss) - // } - if keyword != "" { - sql += " AND (a.user_id LIKE ? OR a.name LIKE ? OR a.tel1 LIKE ? OR a.tel2 LIKE ? OR a.address LIKE ?)" - sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%") + sql += " AND (a.user_id LIKE ? OR a.name LIKE ? OR a.moblie LIKE ? OR a.user_id2 LIKE ?)" + sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%") } sql += "LIMIT ? OFFSET ?" pageSize = jxutils.FormalizePageSize(pageSize) diff --git a/controllers/cms_user2.go b/controllers/cms_user2.go index a52dbf392..702ea35fa 100644 --- a/controllers/cms_user2.go +++ b/controllers/cms_user2.go @@ -12,6 +12,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils/jsonerr" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" + "git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx" "github.com/astaxie/beego" ) @@ -533,3 +534,19 @@ func (c *User2Controller) GetUserAgreement() { return retVal, "", err }) } + +// @Title 查询京西商城用户信息 +// @Description 查询京西商城用户信息 +// @Param token header string true "认证token" +// @Param keyword query string false "关键字" +// @Param offset query int false "结果起始序号(以0开始,缺省为0)" +// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetJxShopUsers [get] +func (c *User2Controller) GetJxShopUsers() { + c.callGetJxShopUsers(func(params *tUser2GetJxShopUsersParams) (retVal interface{}, errCode string, err error) { + retVal, err = localjx.GetJxShopUsers(params.Ctx, params.Keyword, params.Offset, params.PageSize) + return retVal, "", err + }) +} diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index f201bd65a..275a3af2a 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -283,18 +283,3 @@ func (c *JxOrderController) TestDefend() { return retVal, "", err }) } - -// @Title 查询京西商城用户信息 -// @Description 查询京西商城用户信息 -// @Param token header string true "认证token" -// @Param keyword query string false "关键字" -// @Param offset query int false "结果起始序号(以0开始,缺省为0)" -// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)" -// @Success 200 {object} controllers.CallResult -// @Failure 200 {object} controllers.CallResult -// @router /GetJxShopUsers [get] -func (c *JxOrderController) GetJxShopUsers() { - c.callGetJxShopUsers(func(params *tJxorderGetJxShopUsersParams) (retVal interface{}, errCode string, err error) { - return retVal, "", err - }) -} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 860790d4f..ef9ee799b 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -700,15 +700,6 @@ func init() { Filters: nil, Params: nil}) - beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], - beego.ControllerComments{ - Method: "GetJxShopUsers", - Router: `/GetJxShopUsers`, - AllowHTTPMethods: []string{"get"}, - MethodParams: param.Make(), - Filters: nil, - Params: nil}) - beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], beego.ControllerComments{ Method: "GetMatterOrderStatus", @@ -2952,6 +2943,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"], + beego.ControllerComments{ + Method: "GetJxShopUsers", + Router: `/GetJxShopUsers`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"], beego.ControllerComments{ Method: "GetMyJxStoreList", From eb407ce79291b324a7c61b5e72567f9d79effaa0 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, 25 Sep 2020 09:31:36 +0800 Subject: [PATCH 49/51] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index bda7fb937..b6bf7facd 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1874,7 +1874,7 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, panic(r) } }() - if num, err = dao.UpdateEntityLogically(db, order, valid, ctx.GetUserName(), nil); err != nil { + if num, err = dao.UpdateEntityByKV(db, order, valid, nil); err != nil { dao.Rollback(db) return 0, err } From 935b3064d22655d4e03ea0c1ab2b4f7d963f9743 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, 25 Sep 2020 09:38:27 +0800 Subject: [PATCH 50/51] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b6bf7facd..a7944759e 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1867,16 +1867,18 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, ) order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID) valid := dao.StrictMakeMapByStructObject(payload, order, ctx.GetUserName()) - dao.Begin(db) - defer func() { - if r := recover(); r != nil { + if valid != nil { + dao.Begin(db) + defer func() { + if r := recover(); r != nil { + dao.Rollback(db) + panic(r) + } + }() + if num, err = dao.UpdateEntityByKV(db, order, valid, nil); err != nil { dao.Rollback(db) - panic(r) + return 0, err } - }() - if num, err = dao.UpdateEntityByKV(db, order, valid, nil); err != nil { - dao.Rollback(db) - return 0, err } dao.Commit(db) return num, err From f0a6b1b95768289e1cd5bf1f5fdf8fba1cfa3f8a 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, 25 Sep 2020 09:44:55 +0800 Subject: [PATCH 51/51] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index a7944759e..1db00161e 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1867,7 +1867,7 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, ) order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID) valid := dao.StrictMakeMapByStructObject(payload, order, ctx.GetUserName()) - if valid != nil { + if len(valid) > 0 { dao.Begin(db) defer func() { if r := recover(); r != nil {