|
|
@@ -857,11 +857,38 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string) |
|
|
|
var list []model.OneCirclesGreenEnergySignIn |
|
|
|
err = engine.Where("start_time >= ?", startDate).And("uid = ?", user.Uid).Find(&list) |
|
|
|
if len(list) <= 0 && mapOneCirclesPublicPlatoonFreePunishWithUser[user.Uid] == nil { |
|
|
|
var oneCirclesPublicPlatoonRecordsPunishWithUser model.OneCirclesPublicPlatoonRecordsPunishWithUser |
|
|
|
has, err1 := engine.Where("uid = ?", user.Uid).Get(&oneCirclesPublicPlatoonRecordsPunishWithUser) |
|
|
|
if err1 != nil { |
|
|
|
return err1 |
|
|
|
} |
|
|
|
oneCirclesPublicPlatoonRecordsPunishWithUserDate, _ := time.ParseInLocation("2006-01-02", oneCirclesPublicPlatoonRecordsPunishWithUser.Date, time.Local) |
|
|
|
if has && now.AddDate(0, 0, -7).After(oneCirclesPublicPlatoonRecordsPunishWithUserDate) { |
|
|
|
//TODO::不进行重复处罚 |
|
|
|
continue |
|
|
|
} |
|
|
|
//进行处罚 |
|
|
|
err, _ = OneCirclesDealCommonWealthPunish(engine, user.Uid, "公排处罚") |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
//添加 one_circles_public_platoon_records_punish_with_user 记录 |
|
|
|
if has { |
|
|
|
oneCirclesPublicPlatoonRecordsPunishWithUser.Date = now.Format("2006-01-02") |
|
|
|
_, err2 := db.OneCirclesPublicPlatoonRecordsPunishWithUserUpdate(engine, oneCirclesPublicPlatoonRecordsPunishWithUser.Id, &oneCirclesPublicPlatoonRecordsPunishWithUser, "date") |
|
|
|
if err2 != nil { |
|
|
|
return err2 |
|
|
|
} |
|
|
|
} else { |
|
|
|
_, err2 := db.OneCirclesPublicPlatoonRecordsPunishWithUserInsert(engine, &model.OneCirclesPublicPlatoonRecordsPunishWithUser{ |
|
|
|
Uid: user.Uid, |
|
|
|
Date: now.Format("2006-01-02"), |
|
|
|
}) |
|
|
|
if err2 != nil { |
|
|
|
return err2 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
page++ |
|
|
|