This commit is contained in:
rosydev
2022-03-03 17:46:38 +08:00
parent eac5c5a0d1
commit 6c5416f89b

View File

@@ -1223,23 +1223,16 @@ func UpdateUserLastInfo(ctx *jxcontext.Context, storeID, brandID int) (err error
db = dao.GetDB()
)
if user, err := dao.GetUserByID(db, "user_id", ctx.GetUserID()); err == nil {
//不带参数进入的店铺品牌值为0
if storeID == 0 || storeID == 102919 {
//本次与上次不同时再更新
if storeID != user.LastStoreID {
user.LastStoreID = storeID
if user.LastBrandID > 1 {
user.LastBrandID = 0
}
} else { //带参数进入的店铺
user.LastStoreID = storeID
if storeID == model.MatterStoreID { //物料店比较特殊
user.LastBrandID = 1
} else {
user.LastBrandID = storeID
}
_, err = dao.UpdateEntity(db, user, "LastStoreID")
}
if brandID != user.LastBrandID {
user.LastBrandID = brandID
_, err = dao.UpdateEntity(db, user, "LastBrandID")
}
_, err = dao.UpdateEntity(db, user, "LastStoreID")
_, err = dao.UpdateEntity(db, user, "LastBrandID")
}
return err
}