Merge branch 'feat-hjj-QuestionnaireSurvey' into dev

This commit is contained in:
jiaji.H 2026-03-11 18:39:18 +08:00
commit 5a1257f251

View File

@ -2,6 +2,7 @@ package dao
import (
"encoding/json"
"errors"
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"micro-bundle/pkg/app"
@ -9,6 +10,7 @@ import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp *bundle.SendQuestionnaireSurveyResponse, err error) {
@ -36,6 +38,9 @@ func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp *
Where("user_tel = ? and deleted_at is null", req.UserTel).
First(&questionnaireInfo).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
resp.Status = 0
}
return resp, err
}
if questionnaireInfo.UserId != 0 {
@ -102,6 +107,9 @@ func GetQuestionnaireSurveyInfo(req *bundle.GetQuestionnaireSurveyInfoRequest) (
Order("created_at desc").
First(&questionnaireInfo).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errors.New("问卷信息不存在")
}
return data, err
}
return data, nil