刷新高价品?

This commit is contained in:
苏尹岚
2020-07-03 16:50:55 +08:00
parent 6c4d8472ad
commit 694f61c6ce
3 changed files with 49 additions and 39 deletions

View File

@@ -1096,6 +1096,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
return nil, fmt.Errorf("商品:%s价格:%s太夸张", allBinds[0].Name, jxutils.IntPrice2StandardCurrencyString(int64(skuBindInfo.UnitPrice)))
}
unitPrice = skuBindInfo.UnitPrice
if isRefreshHigh {
if allBinds[0].UnitPrice > unitPrice {
continue
}
}
} else {
unitPrice = allBinds[0].UnitPrice
if unitPrice == 0 {
@@ -1213,21 +1218,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask)
updateFieldMap["Price"] = 1
}
if isRefreshHigh {
if beforeMsg.UnitPrice > skuBindInfo.UnitPrice {
skuBind.UnitPrice = unitPrice
skuBind.Price = price
skuBind.JxPrice = jxPrice
updateFieldMap["UnitPrice"] = 1
updateFieldMap["JxPrice"] = 1
}
} else {
skuBind.UnitPrice = unitPrice
skuBind.Price = price
skuBind.JxPrice = jxPrice
updateFieldMap["UnitPrice"] = 1
updateFieldMap["JxPrice"] = 1
}
skuBind.UnitPrice = unitPrice
skuBind.Price = price
skuBind.JxPrice = jxPrice
updateFieldMap["UnitPrice"] = 1
updateFieldMap["JxPrice"] = 1
}
}
if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 {

View File

@@ -46,7 +46,7 @@ var (
"20:00:00",
}
dailyWorkTimeList2 = []string{
"04:00:00",
"02:00:00",
}
priceReferTimeList = []string{
"03:00:00",

View File

@@ -1560,29 +1560,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// }
//京东商城街道name
var stores []*model.Store
var db = dao.GetDB()
sql := `
SELECT b.*
FROM store_map a, store b
WHERE a.store_id = b.id
AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ?
AND b.deleted_at = ?
`
sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue}
err = dao.GetRows(db, &stores, sql, sqlParams)
for _, v := range stores {
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat))
if result["regeocode"] != nil {
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
if street != "" {
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
storeMap := storeMaps[0]
storeMap.JdsStreetName = street
dao.UpdateEntity(db, storeMap, "JdsStreetName")
}
}
}
// var stores []*model.Store
// var db = dao.GetDB()
// sql := `
// SELECT b.*
// FROM store_map a, store b
// WHERE a.store_id = b.id
// AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ?
// AND b.deleted_at = ?
// `
// sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue}
// err = dao.GetRows(db, &stores, sql, sqlParams)
// for _, v := range stores {
// result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat))
// if result["regeocode"] != nil {
// street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
// if street != "" {
// storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
// storeMap := storeMaps[0]
// storeMap.JdsStreetName = street
// dao.UpdateEntity(db, storeMap, "JdsStreetName")
// }
// }
// }
// var stores []*model.Store
// sql := `
@@ -1610,6 +1610,21 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// continue
// }
// }
// type tStore struct {
// }
// sql := `
// SELECT count(a.unit_price) count,a.name_id,a.store_id FROM (
// SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c
// where a.sku_id = b.id
// and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00'
// and a.store_id = ?
// and a.deleted_at = '1970-01-01 00:00:00')a
// GROUP BY 2,3
// HAVING count(a.unit_price) > 1
// `
// sqlParams := []interface{}{}
return err
}