|
@ -56,8 +56,11 @@ func (t *SignCtl) CheckSign() { |
|
|
history := new(models.SignHistory) |
|
|
history := new(models.SignHistory) |
|
|
signExist, err := history.GetByUserId(activityId, uid, activity.RehearsalId, area.Id) |
|
|
signExist, err := history.GetByUserId(activityId, uid, activity.RehearsalId, area.Id) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
|
t.JSON(signExist) |
|
|
|
|
|
|
|
|
if !signExist || history.Status != 2 { |
|
|
|
|
|
t.JSON(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
t.JSON(true) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (t *SignCtl) Setting() { |
|
|
func (t *SignCtl) Setting() { |
|
@ -129,13 +132,15 @@ func (t *SignCtl) Sign() { |
|
|
t.Assert(exist, code.MSG_INVITE_LETTER_NOT_EXIST, "您没收到邀请函") |
|
|
t.Assert(exist, code.MSG_INVITE_LETTER_NOT_EXIST, "您没收到邀请函") |
|
|
} |
|
|
} |
|
|
//检查是否已经签到了
|
|
|
//检查是否已经签到了
|
|
|
signHistory := new(models.SignHistory) |
|
|
|
|
|
exist, err = signHistory.GetByUserId(activityId, uid, activity.RehearsalId, area.Id) |
|
|
|
|
|
|
|
|
history := new(models.SignHistory) |
|
|
|
|
|
exist, err = history.GetByUserId(activityId, uid, activity.RehearsalId, area.Id) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
t.Assert(!exist, code.MSG_SIGN_HISTORY_EXIST, "您已经签到过了") // 存在判断
|
|
|
|
|
|
|
|
|
if exist || history.Status == 2 { |
|
|
|
|
|
t.ERROR("您已经签到过了", code.MSG_SIGN_HISTORY_EXIST) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 签到人数
|
|
|
// 签到人数
|
|
|
signTotal, err := signHistory.Count(signUp.Id, activity.RehearsalId, activity.Id) |
|
|
|
|
|
|
|
|
signTotal, err := history.Count(signUp.Id, activity.RehearsalId, activity.Id) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
|
signUpTotal, err := new(models.InvitationLetter).Count(activity.Id, activity.RehearsalId) |
|
|
signUpTotal, err := new(models.InvitationLetter).Count(activity.Id, activity.RehearsalId) |
|
@ -145,18 +150,18 @@ func (t *SignCtl) Sign() { |
|
|
t.ERROR("彩排人数不能超过10人", code.MSG_SIGN_UP_REHEARSAL_LIMIT) |
|
|
t.ERROR("彩排人数不能超过10人", code.MSG_SIGN_UP_REHEARSAL_LIMIT) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
signHistory = new(models.SignHistory) |
|
|
|
|
|
signHistory.Type = _type |
|
|
|
|
|
signHistory.UserId = uid |
|
|
|
|
|
signHistory.RehearsalId = activity.RehearsalId |
|
|
|
|
|
signHistory.ActivityId = activityId |
|
|
|
|
|
signHistory.SignRuleId = signUp.Id |
|
|
|
|
|
signHistory.AreaId = areaId |
|
|
|
|
|
signHistory.Status = 2 |
|
|
|
|
|
signHistory.IsDelete = false |
|
|
|
|
|
signHistory.UpdatedAt = time.Now() |
|
|
|
|
|
signHistory.CreatedAt = time.Now() |
|
|
|
|
|
_, err = models.Add(signHistory) |
|
|
|
|
|
|
|
|
history = new(models.SignHistory) |
|
|
|
|
|
history.Type = _type |
|
|
|
|
|
history.UserId = uid |
|
|
|
|
|
history.RehearsalId = activity.RehearsalId |
|
|
|
|
|
history.ActivityId = activityId |
|
|
|
|
|
history.SignRuleId = signUp.Id |
|
|
|
|
|
history.AreaId = areaId |
|
|
|
|
|
history.Status = 2 |
|
|
|
|
|
history.IsDelete = false |
|
|
|
|
|
history.UpdatedAt = time.Now() |
|
|
|
|
|
history.CreatedAt = time.Now() |
|
|
|
|
|
_, err = models.Add(history) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
|
go ws_send_service.SendSign(fmt.Sprintf("%d", activity.Id), |
|
|
go ws_send_service.SendSign(fmt.Sprintf("%d", activity.Id), |
|
@ -176,7 +181,7 @@ func (t *SignCtl) Sign() { |
|
|
func (t *SignCtl) RealSign() { |
|
|
func (t *SignCtl) RealSign() { |
|
|
activityId := t.MustGetInt64("activity_id") |
|
|
activityId := t.MustGetInt64("activity_id") |
|
|
userId := t.MustGetUID() |
|
|
userId := t.MustGetUID() |
|
|
areaId := t.MustGetAreaId() |
|
|
|
|
|
|
|
|
areaId := t.MustGetInt64("area_id") |
|
|
|
|
|
|
|
|
user := new(models.User) |
|
|
user := new(models.User) |
|
|
exist, err := models.Get(user, userId) |
|
|
exist, err := models.Get(user, userId) |
|
|