Commit 4e1c124a authored by hujiebin's avatar hujiebin

Merge branch 'feature/family' into feature/3.5

parents 4db784cf 796e14c7
...@@ -30,6 +30,7 @@ func IncrGroupPowerMonthStarScore(model *domain.Model, groupPowerId, userId mysq ...@@ -30,6 +30,7 @@ func IncrGroupPowerMonthStarScore(model *domain.Model, groupPowerId, userId mysq
UserId: userId, UserId: userId,
Type: _type, Type: _type,
Score: score, Score: score,
LastCalTs: lastCalTs,
} }
if err := model.DB().Model(GroupPowerMonthStar{}).Clauses(clause.OnConflict{ if err := model.DB().Model(GroupPowerMonthStar{}).Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "month"}, {Name: "group_power_id"}, {Name: "user_id"}, {Name: "type"}}, Columns: []clause.Column{{Name: "month"}, {Name: "group_power_id"}, {Name: "user_id"}, {Name: "type"}},
......
...@@ -51,12 +51,13 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64) ...@@ -51,12 +51,13 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
score := nowTs - curTs score := nowTs - curTs
day := time.Now().Format("2006-01-02") day := time.Now().Format("2006-01-02")
onMicNew := &UserOnMic{ onMicNew := &UserOnMic{
Date: day, Date: day,
UserId: userId, UserId: userId,
Seconds: mysql.Num(score), Seconds: mysql.Num(score),
LastCalTs: nowTs,
} }
if err := model.DB().Model(UserOnMic{}).Clauses(clause.OnConflict{ if err := model.DB().Model(UserOnMic{}).Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "day"}, {Name: "user_id"}}, Columns: []clause.Column{{Name: "date"}, {Name: "user_id"}},
DoUpdates: clause.Assignments(map[string]interface{}{ DoUpdates: clause.Assignments(map[string]interface{}{
"seconds": gorm.Expr("seconds + ?", onMicNew.Seconds), "seconds": gorm.Expr("seconds + ?", onMicNew.Seconds),
"last_cal_ts": nowTs, "last_cal_ts": nowTs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment