From 79ccd0036ef5859e091be16e7dc8ff0c73ce6147 Mon Sep 17 00:00:00 2001 From: Asai Neko Date: Sun, 8 Feb 2026 17:07:33 +0800 Subject: [PATCH] Fix service_event nil kycid Signed-off-by: Asai Neko --- service/service_event/checkin.go | 39 ++++++++++++++++++++++++++++- service/service_event/join_event.go | 20 +++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/service/service_event/checkin.go b/service/service_event/checkin.go index 913691c..f29bae7 100644 --- a/service/service_event/checkin.go +++ b/service/service_event/checkin.go @@ -31,7 +31,7 @@ type CheckinResult struct { func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) { attendandeData, err := new(data.Attendance). - GetAttendance(payload.Context, payload.Data.EventId, payload.UserId) + GetAttendance(payload.Context, payload.UserId, payload.Data.EventId) if err != nil { result = &CheckinResult{ Common: shared.CommonResult{ @@ -49,9 +49,46 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR return } + if attendandeData == nil { + result = &CheckinResult{ + Common: shared.CommonResult{ + HttpCode: 403, + Exception: new(exception.Builder). + SetStatus(exception.StatusUser). + SetService(exception.ServiceEvent). + SetEndpoint(exception.EndpointEventServiceCheckin). + SetType(exception.TypeCommon). + SetOriginal(exception.CommonErrorInvalidInput). + Throw(payload.Context), + }, + } + return + } + eventData, err := new(data.Event). GetEventById(payload.Context, payload.Data.EventId) + if err != nil || eventData == nil { + code := 500 + if eventData == nil { + code = 404 + } + result = &CheckinResult{ + Common: shared.CommonResult{ + HttpCode: code, + Exception: new(exception.Builder). + SetStatus(exception.StatusUser). + SetService(exception.ServiceEvent). + SetEndpoint(exception.EndpointEventServiceCheckin). + SetType(exception.TypeCommon). + SetOriginal(exception.CommonErrorInvalidInput). + SetError(err). + Throw(payload.Context), + }, + } + return + } + if attendandeData.KycId == uuid.Nil && eventData.EnableKYC == true { result = &CheckinResult{ Common: shared.CommonResult{ diff --git a/service/service_event/join_event.go b/service/service_event/join_event.go index 8ef8c4d..e71eef9 100644 --- a/service/service_event/join_event.go +++ b/service/service_event/join_event.go @@ -205,6 +205,26 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even } attendenceData.SetRole("normal") + if payload.Data.KycId != "" { + kycUUID, err := uuid.Parse(payload.Data.KycId) + if err != nil { + return &EventJoinResult{ + Common: shared.CommonResult{ + HttpCode: 400, + Exception: new(exception.Builder). + SetStatus(exception.StatusUser). + SetService(exception.ServiceEvent). + SetEndpoint(exception.EndpointEventServiceJoin). + SetType(exception.TypeCommon). + SetOriginal(exception.CommonErrorUuidParseFailed). + SetError(err). + Throw(payload.Context), + }, + } + } + attendenceData.SetKycId(kycUUID) + } + attendanceId, err := attendenceData.Create(payload.Context) if err != nil { return &EventJoinResult{