From 33b5eb548a6fa18b6f431697a762a603586db7c7 Mon Sep 17 00:00:00 2001 From: Tooooommy Date: Wed, 30 Sep 2020 11:49:03 +0800 Subject: [PATCH] fix:bug --- controllers/client/login.go | 12 ++++++++++++ models/module_service_history.go | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/controllers/client/login.go b/controllers/client/login.go index 0f675a2..0c80113 100644 --- a/controllers/client/login.go +++ b/controllers/client/login.go @@ -118,6 +118,18 @@ func (t *UserCtl) WxLogin() { } t.CheckErr(err) + // 校验邀请函是否开启 + invitation := new(models.Invitation) + exist, err = invitation.GetInvitationByActivityId(activityId) + t.CheckErr(err) + //t.Assert(exist, code.MSG_INVITE_SETTING_NOT_EXIST, "邀请函设置不存在") + if exist { // 存在邀请函 + letter := new(models.InvitationLetter) + exist, err = letter.GetByUserIdAndActivityId(user.Id, activity.Id, activity.ArchId, activity.RehearsalId) + t.CheckErr(err) + t.Assert(exist, code.MSG_INVITE_LETTER_NOT_EXIST, "您尚未接受过邀请") + } + sign := new(models.SignUp) exist, err = sign.GetByActivityId(activityId) t.CheckErr(err) diff --git a/models/module_service_history.go b/models/module_service_history.go index a5cfe60..89038b0 100644 --- a/models/module_service_history.go +++ b/models/module_service_history.go @@ -33,8 +33,8 @@ func (t *ModuleServiceHistory) GetByModuleIdAndName(id int, name string) (bool, return core.GetXormAuto().Where("is_delete=0 and service_module_id=? and name=?", id, name).Get(t) } -func (t *ModuleServiceHistory) ExistSignModule(ids []interface{}) (bool, error) { - return core.GetXormAuto().Where("is_delete=0 and name=?", "签到").In("id", ids...).Exist(t) +func (t *ModuleServiceHistory) ExistSignModule(ids interface{}) (bool, error) { + return core.GetXormAuto().Where("is_delete=0 and name=?", "签到").In("id", ids).Exist(t) } func GetModuleServiceHistoryIdsByIdAndName(serviceId, serviceName interface{}) ([]int, error) {