This commit is contained in:
suyl
2021-05-20 09:07:22 +08:00
parent c2c5242b9b
commit 3ee892c2d0
4 changed files with 87 additions and 51 deletions

View File

@@ -4272,12 +4272,14 @@ func RefreshPageStore() {
jds []*JdPage jds []*JdPage
mts []*MtPage mts []*MtPage
) )
//刷京东门店表的坐标和区名
sql := ` sql := `
SELECT * FROM jingdong_showd WHERE (lng IS NULL AND lat IS NULL) OR (lng = 0 AND lat = 0) SELECT * FROM jingdong_showd WHERE (lng IS NULL AND lat IS NULL) OR (lng = 0 AND lat = 0)
` `
dao.GetRows(db, &jds, sql, nil) dao.GetRows(db, &jds, sql, nil)
for _, v := range jds { for _, v := range jds {
if (v.Lat == "" && v.Lng == "") || (v.Lat == "0" && v.Lng == "0") { if (v.Lat == "" && v.Lng == "") || (v.Lat == "0" && v.Lng == "0") {
if v.Address != "" {
if v.BakInfo != "" { if v.BakInfo != "" {
result, _ := api.AutonaviAPI.GetCoordinateFromAddressAll(v.Address, v.BakInfo) result, _ := api.AutonaviAPI.GetCoordinateFromAddressAll(v.Address, v.BakInfo)
lng, lat, dis := utils.Float64ToStr(result.Lng), utils.Float64ToStr(result.Lat), result.AdName lng, lat, dis := utils.Float64ToStr(result.Lng), utils.Float64ToStr(result.Lat), result.AdName
@@ -4305,12 +4307,15 @@ func RefreshPageStore() {
} }
} }
} }
}
//刷美团门店表的坐标和区名
sql2 := ` sql2 := `
SELECT * FROM meituan_showd WHERE (lng IS NULL AND lat IS NULL) OR (lng = 0 AND lat = 0) SELECT * FROM meituan_showd WHERE (lng IS NULL AND lat IS NULL) OR (lng = 0 AND lat = 0)
` `
dao.GetRows(db, &mts, sql2, nil) dao.GetRows(db, &mts, sql2, nil)
for _, v := range mts { for _, v := range mts {
if (v.Lat == "" && v.Lng == "") || (v.Lat == "0" && v.Lng == "0") { if (v.Lat == "" && v.Lng == "") || (v.Lat == "0" && v.Lng == "0") {
if v.Address != "" {
if v.CityName != "" { if v.CityName != "" {
result, _ := api.AutonaviAPI.GetCoordinateFromAddressAll(v.Address, v.CityName) result, _ := api.AutonaviAPI.GetCoordinateFromAddressAll(v.Address, v.CityName)
lng, lat, dis := utils.Float64ToStr(result.Lng), utils.Float64ToStr(result.Lat), result.AdName lng, lat, dis := utils.Float64ToStr(result.Lng), utils.Float64ToStr(result.Lat), result.AdName
@@ -4339,6 +4344,9 @@ func RefreshPageStore() {
} }
} }
} }
//商品表合并
}
func QueryPageStores2(db *dao.DaoDB, pageSize, offset int, keyword string, vendorStoreID string, vendorID, cityCode, districtCode int, tel string, func QueryPageStores2(db *dao.DaoDB, pageSize, offset int, keyword string, vendorStoreID string, vendorID, cityCode, districtCode int, tel string,
minShopScore float32, minRecentOrderNum, minSkuCount int, lng1, lat1, lng2, lat2 float64) (pagedInfo *model.PagedInfo, err error) { minShopScore float32, minRecentOrderNum, minSkuCount int, lng1, lat1, lng2, lat2 float64) (pagedInfo *model.PagedInfo, err error) {
@@ -4574,6 +4582,8 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
panic(r) panic(r)
} }
}() }()
fmt.Println(sql)
fmt.Println(sqlParams)
if err = dao.GetRowsTx(txDB, &results, sql, sqlParams...); err == nil { if err = dao.GetRowsTx(txDB, &results, sql, sqlParams...); err == nil {
pagedInfo = &model.PagedInfo{ pagedInfo = &model.PagedInfo{
TotalCount: dao.GetLastTotalRowCount2(db, txDB), TotalCount: dao.GetLastTotalRowCount2(db, txDB),

View File

@@ -279,26 +279,26 @@ func Init() {
}, dailyWorkTimeList) }, dailyWorkTimeList)
} }
if beego.BConfig.RunMode == "beta" { if beego.BConfig.RunMode == "beta" {
ScheduleTimerFunc("CancelPayTimeOutOrder", func() { //ScheduleTimerFunc("CancelPayTimeOutOrder", func() {
localjx.CancelPayTimeOutOrder(jxcontext.AdminCtx) // localjx.CancelPayTimeOutOrder(jxcontext.AdminCtx)
}, cancelPayTimeOutOrderList) //}, cancelPayTimeOutOrderList)
ScheduleTimerFunc("GetAndStoreCitiesShops", func() { ScheduleTimerFunc("GetAndStoreCitiesShops", func() {
netspider.GetAndStoreCitiesShops(jxcontext.AdminCtx, nil, nil, 0, 0, false, false) netspider.GetAndStoreCitiesShops(jxcontext.AdminCtx, nil, nil, 0, 0, false, false)
}, []string{ }, []string{
"04:05:06", "04:05:06",
}) })
//京东的订单信息解密密钥获取 //京东的订单信息解密密钥获取
ScheduleTimerFuncByInterval(func() { //ScheduleTimerFuncByInterval(func() {
jdshop.InitKey() // jdshop.InitKey()
}, 10*time.Second, 8*time.Hour) //}, 10*time.Second, 8*time.Hour)
ScheduleTimerFunc("ChangeJxPriceByDiscountAct", func() { ScheduleTimerFunc("ChangeJxPriceByDiscountAct", func() {
act.ChangeJxPriceByDiscountAct(jxcontext.AdminCtx) act.ChangeJxPriceByDiscountAct(jxcontext.AdminCtx)
}, discountActJxList) }, discountActJxList)
ScheduleTimerFunc("CreateOrderByPriceDefend", func() { //ScheduleTimerFunc("CreateOrderByPriceDefend", func() {
localjx.CreateOrderByPriceDefend(jxcontext.AdminCtx) // localjx.CreateOrderByPriceDefend(jxcontext.AdminCtx)
}, []string{ //}, []string{
"22:00:00", // "22:00:00",
}) //})
//刷新门店数据坐标等 //刷新门店数据坐标等
ScheduleTimerFunc("RefreshPageStore", func() { ScheduleTimerFunc("RefreshPageStore", func() {
cms.RefreshPageStore() cms.RefreshPageStore()

View File

@@ -350,3 +350,28 @@ func (*VendorCategoryMap) TableUnique() [][]string {
[]string{"VendorID", "VendorOrgCode", "CategoryID", "DeletedAt"}, []string{"VendorID", "VendorOrgCode", "CategoryID", "DeletedAt"},
} }
} }
//各平台商品数据
type PageSku struct {
ModelIDCUL
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`
VendorSkuID string `orm:"column(vendor_sku_id)" json:"vendorSkuID"`
VendorSkuName string `json:"vendorSkuName"`
MonthSaled int `json:"monthSaled"`
ActPrice int `json:"actPrice"`
SalePrice int `json:"salePrice"`
}
func (*PageSku) TableUnique() [][]string {
return [][]string{
[]string{"VendorID", "VendorStoreID", "VendorSkuID"},
}
}
func (*PageSku) TableIndex() [][]string {
return [][]string{
[]string{"MonthSaled", "SalePrice"},
}
}

View File

@@ -36,6 +36,7 @@ func Init() {
orm.RegisterModel(&model.SkuVendorCategory{}, &model.StoreSkuCategoryMap{}, &model.SkuName{}, &model.Sku{}, &model.SkuNamePlaceBind{}, &model.StoreSkuBind{}) orm.RegisterModel(&model.SkuVendorCategory{}, &model.StoreSkuCategoryMap{}, &model.SkuName{}, &model.Sku{}, &model.SkuNamePlaceBind{}, &model.StoreSkuBind{})
orm.RegisterModel(&model.SkuVendorCategoryMap{}) //商品映射平台类目 orm.RegisterModel(&model.SkuVendorCategoryMap{}) //商品映射平台类目
orm.RegisterModel(&model.VendorCategoryMap{}) //平台分类 orm.RegisterModel(&model.VendorCategoryMap{}) //平台分类
orm.RegisterModel(&model.PageSku{})
orm.RegisterModel(&model.StoreSkuBindHistory{}) orm.RegisterModel(&model.StoreSkuBindHistory{})
orm.RegisterModel(&model.StoreSkuAudit{}) orm.RegisterModel(&model.StoreSkuAudit{})
orm.RegisterModel(&model.SkuCategory{}) orm.RegisterModel(&model.SkuCategory{})