落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。 Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
516 B
Go
24 lines
516 B
Go
package handler
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/yuxingu/digital-psychology/apps/api/internal/textsafe"
|
|
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
|
)
|
|
|
|
// failTextCompliance maps textsafe rejections to HTTP 400 / code 40060.
|
|
func failTextCompliance(c *gin.Context, err error) bool {
|
|
if err == nil {
|
|
return false
|
|
}
|
|
if errors.Is(err, textsafe.ErrRejected) {
|
|
response.Fail(c, http.StatusBadRequest, 40060, err.Error())
|
|
return true
|
|
}
|
|
return false
|
|
}
|