Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-09-12 18:28:02 +08:00

View File

@@ -149,11 +149,14 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
ORDER BY t1.id DESC ORDER BY t1.id DESC
LIMIT 1` LIMIT 1`
var lastShop *model.PageShop var lastShop *model.PageShop
if dao.GetRow(db, &lastShop, sql) == nil { if err2 := dao.GetRow(db, &lastShop, sql); err2 == nil {
index := -1 index := -1
for k, v := range cityCodeList { for k, v := range cityCodeList {
if v >= lastShop.CityCode {
index = k
if v == lastShop.CityCode { if v == lastShop.CityCode {
index = k + 1 index++
}
if index >= len(cityCodeList) { if index >= len(cityCodeList) {
index = -1 index = -1
} }
@@ -166,6 +169,9 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
cityCodeList2 = append(cityCodeList2, cityCodeList[:index]...) cityCodeList2 = append(cityCodeList2, cityCodeList[:index]...)
cityCodeList = cityCodeList2 cityCodeList = cityCodeList2
} }
globals.SugarLogger.Debugf("GetAndStoreCitiesShops last cityCode:%d, cityCodeList:%v", lastShop.CityCode, cityCodeList)
} else {
globals.SugarLogger.Debugf("GetAndStoreCitiesShops get lastest city code error:%v", err2)
} }
} }
if len(vendorIDs) == 0 { if len(vendorIDs) == 0 {