feat(ECR-012–016): 合规、题库、时辰刷新、头像、MBTI OEJTS 与埋点
落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/middleware"
|
||||
asksvc "github.com/yuxingu/digital-psychology/apps/api/internal/service/ask"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/textsafe"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
||||
)
|
||||
|
||||
@@ -67,6 +69,9 @@ func (h *AskHandler) CreateThread(c *gin.Context) {
|
||||
ProfileID: pid, Scene: req.Scene,
|
||||
})
|
||||
if err != nil {
|
||||
if failTextCompliance(c, err) {
|
||||
return
|
||||
}
|
||||
response.Fail(c, http.StatusBadRequest, 40010, err.Error())
|
||||
return
|
||||
}
|
||||
@@ -142,6 +147,9 @@ func (h *AskHandler) SendMessage(c *gin.Context) {
|
||||
|
||||
out, err := h.Svc.SendMessage(c.Request.Context(), userID, tid, req.Content)
|
||||
if err != nil {
|
||||
if failTextCompliance(c, err) {
|
||||
return
|
||||
}
|
||||
if asksvc.IsQuotaExhausted(err) {
|
||||
response.Fail(c, http.StatusPaymentRequired, 40210, "问答次数已用完,可购买额度或开通成长会员")
|
||||
return
|
||||
@@ -180,7 +188,9 @@ func (h *AskHandler) sendMessageStream(c *gin.Context, userID, tid uuid.UUID, co
|
||||
if err != nil {
|
||||
msg := err.Error()
|
||||
code := 40011
|
||||
if asksvc.IsQuotaExhausted(err) {
|
||||
if errors.Is(err, textsafe.ErrRejected) {
|
||||
code = 40060
|
||||
} else if asksvc.IsQuotaExhausted(err) {
|
||||
msg = "问答次数已用完,可购买额度或开通成长会员"
|
||||
code = 40210
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user