diff --git a/internal/dao/questionnaire_survey.go b/internal/dao/questionnaire_survey.go index a66fe0f..7f37a28 100644 --- a/internal/dao/questionnaire_survey.go +++ b/internal/dao/questionnaire_survey.go @@ -36,6 +36,7 @@ func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp * questionnaireInfo := &model.QuestionnaireSurvey{} err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}). Where("user_tel = ? and deleted_at is null", req.UserTel). + Order("created_at desc"). First(&questionnaireInfo).Error if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { @@ -45,6 +46,10 @@ func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp * } } if questionnaireInfo.UserId != 0 { + if questionnaireInfo.SurveyStatus == msg.QuestionnaireSent { + resp.Status = 0 + return resp, nil + } resp.Status = 2 return resp, nil }