diff --git a/db/db_one_circles_public_platoon_free_punish_with_user.go b/db/db_one_circles_public_platoon_free_punish_with_user.go new file mode 100644 index 0000000..7249cb6 --- /dev/null +++ b/db/db_one_circles_public_platoon_free_punish_with_user.go @@ -0,0 +1,19 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" + "xorm.io/xorm" +) + +func FindAllOneCirclesPublicPlatoonFreePunishWithUser(Db *xorm.Engine) (resp map[int]*model.OneCirclesPublicPlatoonFreePunishWithUser, err error) { + var m []model.OneCirclesPublicPlatoonFreePunishWithUser + err = Db.Where("1=1").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + for _, v := range m { + resp[v.Uid] = &v + } + return +} diff --git a/db/model/one_circles_public_platoon_free_punish_with_user.go b/db/model/one_circles_public_platoon_free_punish_with_user.go new file mode 100644 index 0000000..49d26dc --- /dev/null +++ b/db/model/one_circles_public_platoon_free_punish_with_user.go @@ -0,0 +1,6 @@ +package model + +type OneCirclesPublicPlatoonFreePunishWithUser struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` +} diff --git a/rule/one_circles/one_circles_public_platoon_user_relation_commission.go b/rule/one_circles/one_circles_public_platoon_user_relation_commission.go index 626d01d..6f73dd8 100644 --- a/rule/one_circles/one_circles_public_platoon_user_relation_commission.go +++ b/rule/one_circles/one_circles_public_platoon_user_relation_commission.go @@ -738,8 +738,8 @@ func OneCirclesDealCommonWealthPunish(engine *xorm.Engine, uid int, reason strin return } if params == nil { - err = errors.New("未查询到公排关系记录") - _ = session.Rollback() + fmt.Println("未查询到公排关系记录!!!!!!!") + return } //TODO::判断是否为推荐用户 @@ -835,6 +835,10 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string) if oneCirclesPublicPlatoonBasicSetting == nil { return errors.New("公排制度未开启") } + mapOneCirclesPublicPlatoonFreePunishWithUser, err := db.FindAllOneCirclesPublicPlatoonFreePunishWithUser(engine) + if err != nil { + return err + } if oneCirclesPublicPlatoonBasicSetting.SystemPunishReplace == 1 { systemPunishReplaceValue := oneCirclesPublicPlatoonBasicSetting.SystemPunishReplaceValue startDate := now.AddDate(0, 0, -systemPunishReplaceValue).Format("2006-01-02") + " 00:00:00" @@ -842,7 +846,7 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string) var pageSize = 100 for { var users []model.User - err = engine.Limit(pageSize, (page-1)*pageSize).Desc("id").Find(&users) + err = engine.Limit(pageSize, (page-1)*pageSize).Desc("uid").Find(&users) if err != nil { return err } @@ -852,7 +856,7 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string) for _, user := range users { var list []model.OneCirclesGreenEnergySignIn err = engine.Where("start_time >= ?", startDate).And("uid = ?", user.Uid).Find(&list) - if len(list) <= 0 { + if len(list) <= 0 && mapOneCirclesPublicPlatoonFreePunishWithUser[user.Uid] == nil { //进行处罚 err, _ = OneCirclesDealCommonWealthPunish(engine, user.Uid, "公排处罚") if err != nil {