推荐商品自动关注,修改,以及暂时只整4个小城市

This commit is contained in:
苏尹岚
2020-01-13 14:53:40 +08:00
parent 140d2835e8
commit 36fbaadb97
9 changed files with 62 additions and 24 deletions

View File

@@ -365,7 +365,7 @@ func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) {
}
}
errList.AddErr(err)
storeList, err2 := dao.GetStoreList(db, nil, nil, key)
storeList, err2 := dao.GetStoreList(db, nil, nil, nil, nil, key)
if err = err2; err == nil && len(storeList) > 0 {
storeIDs := make([]int, len(storeList))
for k, v := range storeList {

View File

@@ -1993,7 +1993,7 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
}
if len(userList) > 0 {
allStores, err := dao.GetStoreList(db, nil, nil, "")
allStores, err := dao.GetStoreList(db, nil, nil, nil, nil, "")
if err != nil {
return err
}
@@ -2167,7 +2167,7 @@ func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs
func SyncStoresCourierInfo(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
storeList2, err := dao.GetStoreList(db, storeIDs, nil, "")
storeList2, err := dao.GetStoreList(db, storeIDs, nil, nil, nil, "")
var storeList []*model.Store
for _, v := range storeList2 {
if v.Status != model.StoreStatusDisabled {

View File

@@ -830,10 +830,6 @@ func UpdateStoresSkusByBind(ctx *jxcontext.Context, parentTask tasksch.ITask, sk
}
}()
for _, storeID := range storeIDs {
fmt.Println(storeID)
for _, v := range skuBindInfosMap[storeID] {
fmt.Println(*v)
}
skuIDs, err2 := updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosMap[storeID], false)
if err = err2; err != nil {
dao.Rollback(db)
@@ -2886,7 +2882,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
skuIDs = append(skuIDs, k)
}
skuList, err := dao.GetSkus(db, skuIDs, nil, nil, nil)
storeList, err := dao.GetStoreList(db, nil, nil, "")
storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "")
if err != nil && len(skuList) == 0 {
return result, err
}
@@ -3059,12 +3055,18 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf
return hint, err
}
func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) {
func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
var (
result1 []interface{}
result1 []interface{}
cityCodes = []int{
530100, //昆明
430300, //湘潭市
510700, //绵阳市
520100, //贵阳市
}
)
storeList, err := dao.GetStoreList(db, nil, nil, "")
storeList, err := dao.GetStoreList(db, nil, cityCodes, nil, nil, "")
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step {
case 0:
@@ -3096,7 +3098,7 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context, isAsync, i
for _, v := range skuName {
skuNameMap[v.ID] = v.ID
}
skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, v.CityCode, v.ID)
skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, v.CityCode, 0)
if err2 != nil {
return retVal, err2
}
@@ -3110,17 +3112,18 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context, isAsync, i
var skuBindInfoList []*StoreSkuBindInfo
for _, vv := range skuNameAndPlaceList {
if skuNameMap[vv.ID] != 0 {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: v.ID,
NameID: vv.ID,
// UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100,
IsFocus: 1,
IsSale: 0,
}
priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{vv.CityCode}, nil, []int{vv.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
if err == nil && len(priceReferList) > 0 {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: v.ID,
NameID: vv.ID,
UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100,
IsFocus: 1,
IsSale: 0,
}
skuBindInfoList = append(skuBindInfoList, storeSkuBindInfo)
storeSkuBindInfo.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100
}
skuBindInfoList = append(skuBindInfoList, storeSkuBindInfo)
}
}
retVal = skuBindInfoList
@@ -3155,7 +3158,7 @@ func AutoFocusStoreSkusWithoutFocus(ctx *jxcontext.Context, skuIDs []int, isSync
nameMap = make(map[int]*StoreSkuBindInfo)
)
db := dao.GetDB()
storeList, err := dao.GetStoreList(db, nil, nil, "")
storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "")
for _, v := range storeList {
storeSkuList, _ := dao.GetStoreSkusAndSkuName(db, []int{v.ID}, skuIDs, nil)
for _, vv := range storeSkuList {

View File

@@ -219,7 +219,7 @@ func TryAddStoreBossRole4User(ctx *jxcontext.Context, user *model.User) (err err
if user.Type&model.UserTypeStoreBoss != 0 {
userMobile := user.GetMobile()
if userMobile != "" {
if storeList, err := dao.GetStoreList(dao.GetDB(), nil, []string{userMobile}, ""); err == nil && len(storeList) > 0 {
if storeList, err := dao.GetStoreList(dao.GetDB(), nil, nil, nil, []string{userMobile}, ""); err == nil && len(storeList) > 0 {
roleList := make([]*authz.RoleInfo, len(storeList))
for k, v := range storeList {
roleList[k] = autils.NewStoreBossRole(v.ID)