Browse Source

add reverse:for v4.0.9 积分释放规则

tags/v4.0.9
huangjiajun 1 year ago
parent
commit
27838a5c3c
2 changed files with 30 additions and 0 deletions
  1. +11
    -0
      db/db_user.go
  2. +19
    -0
      rule/integral_release_settlement.go

+ 11
- 0
db/db_user.go View File

@@ -23,6 +23,17 @@ func UserProfileFindByID(Db *xorm.Engine, id interface{}) (*model.UserProfile, e
} }
return &m, nil return &m, nil
} }
func DbsUserFindByIdsSess(sess *xorm.Session, uid []int) (*[]model.User, error) {
var users []model.User
if err := sess.In("uid", uid).Find(&users); err != nil {
return nil, err
}
if len(users) == 0 {
return nil, nil
}
return &users, nil
}

func UserProfileFindByIDWithSession(sess *xorm.Session, id interface{}) (*model.UserProfile, error) { func UserProfileFindByIDWithSession(sess *xorm.Session, id interface{}) (*model.UserProfile, error) {
var m model.UserProfile var m model.UserProfile
if has, err := sess.Where("uid = ?", id). if has, err := sess.Where("uid = ?", id).


+ 19
- 0
rule/integral_release_settlement.go View File

@@ -83,7 +83,26 @@ func DailySettlementIntegralRelease(engine *xorm.Engine, mid string, isTask bool
"key": "state", "key": "state",
"value": 1, "value": 1,
}) })
var uids = make([]int, 0)
for _, ord := range *integralReleaseUserWithOrds { for _, ord := range *integralReleaseUserWithOrds {
uids = append(uids, ord.Uid)
}
uidList, err := db.DbsUserFindByIdsSess(session, uids)
if err != nil {
_ = session.Rollback()
return err
}
userMap := make(map[int]model.User)
for _, v := range *uidList {
userMap[v.Uid] = v
}

for _, ord := range *integralReleaseUserWithOrds {
_, ok := userMap[ord.Uid]
if ok == false {
//判断下这个用户有没有被删了
continue
}
if zhios_order_relate_utils.StrToFloat64(ord.OrdDiscountRatio) == 0 { if zhios_order_relate_utils.StrToFloat64(ord.OrdDiscountRatio) == 0 {
continue continue
} }


Loading…
Cancel
Save