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

This commit is contained in:
苏尹岚
2019-11-12 17:52:12 +08:00
22 changed files with 266 additions and 172 deletions

View File

@@ -105,6 +105,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
}
storeIDs := jxutils.IntMap2List(storeIDMap)
skuIDs := jxutils.IntMap2List(skuIDMap)
// 判断活动是否重叠的检查,当前忽略京东平台及所有结算信息
if !(len(vendorIDs) == 1 && vendorIDs[0] == model.VendorIDJD || act.Type == model.ActSkuFake) {
effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, vendorIDs, storeIDs, skuIDs, act.BeginAt, act.EndAt)
if err != nil {
@@ -150,7 +151,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
v.OriginalPrice = int64(jxPrice)
}
var err2 error
if act.Type != model.ActSkuFake {
if act.Type != model.ActSkuFake { // 非结算,要计算实际活动价格
if storeSkuInfo == nil {
v.ErrMsg = fmt.Sprintf("门店:%d没有关注商品:%d", v.StoreID, v.SkuID)
wrongSkuList = append(wrongSkuList, v)
@@ -281,12 +282,14 @@ func AddActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, actSto
if err = addActStoreSkuBind(ctx, db, actStoreSkuList, actStoreSkuMapList); err != nil {
return err
}
for _, act := range actMap {
if _, err = dao.UpdateEntityLogically(db, partner.Act2ActMap(act),
map[string]interface{}{
model.FieldSyncStatus: act.SyncStatus | model.SyncFlagModifiedMask,
}, ctx.GetUserName(), nil); err != nil {
return err
if act.Type != model.ActSkuFake {
for _, act := range actMap {
if _, err = dao.UpdateEntityLogically(db, partner.Act2ActMap(act),
map[string]interface{}{
model.FieldSyncStatus: act.SyncStatus | model.SyncFlagModifiedMask,
}, ctx.GetUserName(), nil); err != nil {
return err
}
}
}
dao.Commit(db)
@@ -697,11 +700,13 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
syncStatus = model.SyncFlagDeletedMask
}
syncStatus |= act.SyncStatus
if _, err = dao.UpdateEntityLogically(db, partner.Act2ActMap(act),
map[string]interface{}{
model.FieldSyncStatus: syncStatus,
}, ctx.GetUserName(), nil); err != nil {
return err
if act.Type != model.ActSkuFake {
if _, err = dao.UpdateEntityLogically(db, partner.Act2ActMap(act),
map[string]interface{}{
model.FieldSyncStatus: syncStatus,
}, ctx.GetUserName(), nil); err != nil {
return err
}
}
}
if isDeleteAll != isNeedCancelAct {
@@ -709,7 +714,7 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
}
}
if isNeedCancelAct && act.Type != model.ActSkuFake {
if isNeedCancelAct {
act := &model.Act{}
act.ID = actID
if _, err = dao.UpdateEntityLogically(db, act,

View File

@@ -97,6 +97,7 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
"configTypeName": model.ConfigTypeName,
"autoSaleAt": AutoSaleAtStr,
"userTypeName": model.UserTypeName,
"storePriceTypeName": model.StorePriceTypeName,
},
}
}

View File

@@ -67,6 +67,11 @@ type Store4User struct {
OriginalName string `orm:"-" json:"originalName"`
Name string `orm:"size(255)" json:"name"`
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1"` // 格式同上
OpenTime2 int16 `json:"openTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2"` // 格式同上
Status int `json:"status"`
CityCode int `orm:"default(0);null" json:"cityCode"` // todo ?
DistrictCode int `orm:"default(0);null" json:"districtCode"` // todo ?
Address string `orm:"size(255)" json:"address"`
@@ -770,8 +775,8 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
}
} else {
dao.Commit(db)
notifyStoreOperatorChanged(store, valid["operatorPhone"])
}
notifyStoreOperatorChanged(store, valid["operatorPhone"])
}
} else {
globals.SugarLogger.Debugf("UpdateStore track:%s, store:%s", ctx.GetTrackInfo(), utils.Format4Output(store, true))
@@ -1123,7 +1128,7 @@ func TmpGetJxBadCommentsNo(ctx *jxcontext.Context, storeID int) (count int, err
return count, err
}
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, keyword string, storeIDs []int, offset, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
db := dao.GetDB()
sql := `
SELECT SQL_CALC_FOUND_ROWS
@@ -1136,6 +1141,13 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset
WHERE 1 = 1
`
sqlParams := []interface{}{}
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += `
AND (t1.order_id LIKE ? OR t1.jxstoreid LIKE ? OR t1.userphone LIKE ? OR t1.scorecontent LIKE ? OR t1.vendertags LIKE ? OR t1.updated_scorecontent LIKE ?
OR t1.updated_vendertags LIKE ? OR t2.name LIKE ?)`
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
}
if len(storeIDs) > 0 {
sql += " AND t1.jxstoreid IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)

View File

@@ -988,7 +988,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
for _, v := range allBinds {
var num int64
inSkuBind := inSkuBinsMap[v.RealSkuID]
isCanChangePrice := (isUserCanDirectChangePrice || v.ChangePriceType != model.StoreChangePriceTypeBossDisabled)
isCanChangePrice := (isUserCanDirectChangePrice || jxutils.TranslateStorePriceType(v.ChangePriceType) != model.StoreChangePriceTypeBossDisabled)
// globals.SugarLogger.Debug(utils.Format4Output(inSkuBind, false))
var skuBind *model.StoreSkuBind
if v.ID == 0 {
@@ -1448,7 +1448,7 @@ func shouldPendingStorePriceChange(ctx *jxcontext.Context, storeID int, skuBindI
if err = dao.GetEntity(db, store); err != nil {
return false, err
}
return store.ChangePriceType == model.StoreChangePriceTypeNeedApprove, nil
return jxutils.TranslateStorePriceType(store.ChangePriceType) == model.StoreChangePriceTypeNeedApprove, nil
}
}
return false, nil