From db8ca7470bee6b6e5a7b81e9b6f03ad727ce6d11 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 12 Sep 2019 18:13:42 +0800 Subject: [PATCH 1/3] - fk --- business/netspider/netspider.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/netspider/netspider.go b/business/netspider/netspider.go index 9994ca6aa..60f1648a2 100644 --- a/business/netspider/netspider.go +++ b/business/netspider/netspider.go @@ -149,7 +149,7 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis ORDER BY t1.id DESC LIMIT 1` var lastShop *model.PageShop - if dao.GetRow(db, &lastShop, sql) == nil { + if err2 := dao.GetRow(db, &lastShop, sql); err2 == nil { index := -1 for k, v := range cityCodeList { if v == lastShop.CityCode { @@ -166,6 +166,9 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis cityCodeList2 = append(cityCodeList2, cityCodeList[:index]...) cityCodeList = cityCodeList2 } + globals.SugarLogger.Debugf("GetAndStoreCitiesShops cityCodeList:%v", cityCodeList) + } else { + globals.SugarLogger.Debugf("GetAndStoreCitiesShops get lastest city code error:%v", err2) } } if len(vendorIDs) == 0 { From 9c135ed9277964b59db3fcef5b0182f35774bc32 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 12 Sep 2019 18:18:43 +0800 Subject: [PATCH 2/3] - fk --- business/netspider/netspider.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/netspider/netspider.go b/business/netspider/netspider.go index 60f1648a2..7885b67b4 100644 --- a/business/netspider/netspider.go +++ b/business/netspider/netspider.go @@ -166,7 +166,7 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis cityCodeList2 = append(cityCodeList2, cityCodeList[:index]...) cityCodeList = cityCodeList2 } - globals.SugarLogger.Debugf("GetAndStoreCitiesShops cityCodeList:%v", cityCodeList) + globals.SugarLogger.Debugf("GetAndStoreCitiesShops last cityCode:%d, cityCodeList:%v", lastShop.CityCode, cityCodeList) } else { globals.SugarLogger.Debugf("GetAndStoreCitiesShops get lastest city code error:%v", err2) } From e0418ad25ae9c423e4ee8da94877df8f1773a785 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 12 Sep 2019 18:24:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8DGetAndStoreCitiesShop?= =?UTF-8?q?s=E4=B8=AD=E5=9F=8E=E5=B8=82=E7=BB=A7=E7=BB=AD=E7=9A=84bug?= =?UTF-8?q?=EF=BC=88=E6=89=BE=E4=B8=8D=E5=88=B0=E5=9F=8E=E5=B8=82=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/netspider/netspider.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/business/netspider/netspider.go b/business/netspider/netspider.go index 7885b67b4..61d635fac 100644 --- a/business/netspider/netspider.go +++ b/business/netspider/netspider.go @@ -152,8 +152,11 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis if err2 := dao.GetRow(db, &lastShop, sql); err2 == nil { index := -1 for k, v := range cityCodeList { - if v == lastShop.CityCode { - index = k + 1 + if v >= lastShop.CityCode { + index = k + if v == lastShop.CityCode { + index++ + } if index >= len(cityCodeList) { index = -1 }