- beta启动时自动运行netspider.GetAndStoreCitiesShops
This commit is contained in:
@@ -15,8 +15,10 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/netspider"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -106,6 +108,10 @@ func Init() {
|
||||
ScheduleTimerFunc("AutoSaleStoreSku", func() {
|
||||
cms.AutoSaleStoreSku(jxcontext.AdminCtx, nil, false)
|
||||
}, autoSaleStoreSkuTimeList)
|
||||
|
||||
if beego.BConfig.RunMode == "beta" {
|
||||
netspider.GetAndStoreCitiesShops(jxcontext.AdminCtx, nil, nil, 0, 0, false, true)
|
||||
}
|
||||
}
|
||||
|
||||
func doDailyWork() {
|
||||
|
||||
@@ -192,9 +192,11 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
}
|
||||
}()
|
||||
for _, v := range shopList {
|
||||
tmpShop := *v
|
||||
dao.DeleteEntity(db, &tmpShop, model.FieldVendorStoreID, model.FieldVendorID)
|
||||
if err = dao.CreateEntity(db, v); err != nil {
|
||||
if v.DistrictCode > 0 {
|
||||
tmpShop := *v
|
||||
dao.DeleteEntity(db, &tmpShop, model.FieldVendorStoreID, model.FieldVendorID)
|
||||
}
|
||||
if err = dao.CreateEntity(db, v); err != nil && !dao.IsDuplicateError(err) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user