Bläddra i källkod

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

tags/v4.0.9
huangjiajun 1 år sedan
förälder
incheckning
27838a5c3c
2 ändrade filer med 30 tillägg och 0 borttagningar
  1. +11
    -0
      db/db_user.go
  2. +19
    -0
      rule/integral_release_settlement.go

+ 11
- 0
db/db_user.go Visa fil

@@ -23,6 +23,17 @@ func UserProfileFindByID(Db *xorm.Engine, id interface{}) (*model.UserProfile, e
}
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) {
var m model.UserProfile
if has, err := sess.Where("uid = ?", id).


+ 19
- 0
rule/integral_release_settlement.go Visa fil

@@ -83,7 +83,26 @@ func DailySettlementIntegralRelease(engine *xorm.Engine, mid string, isTask bool
"key": "state",
"value": 1,
})
var uids = make([]int, 0)
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 {
continue
}


Laddar…
Avbryt
Spara