Fix stupid ai errors

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-21 14:58:23 +08:00
parent 96d76b3657
commit 2f26b2ddb5
9 changed files with 32 additions and 32 deletions

View File

@@ -25,7 +25,7 @@ func Exchange(c *gin.Context) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceExchange). SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -39,7 +39,7 @@ func Exchange(c *gin.Context) {
userIdOrig, ok := c.Get("user_id") userIdOrig, ok := c.Get("user_id")
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceExchange). SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -95,7 +95,7 @@ func Exchange(c *gin.Context) {
url, err := url.Parse(exchangeReq.RedirectUri) url, err := url.Parse(exchangeReq.RedirectUri)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceExchange). SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -25,7 +25,7 @@ func Magic(c *gin.Context) {
var req MagicRequest var req MagicRequest
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceMagic). SetEndpoint(exception.EndpointAuthServiceMagic).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -40,7 +40,7 @@ func Magic(c *gin.Context) {
ok, err := turnstile.VerifyTurnstile(req.TurnstileToken, c.ClientIP()) ok, err := turnstile.VerifyTurnstile(req.TurnstileToken, c.ClientIP())
if err != nil || !ok { if err != nil || !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceMagic). SetEndpoint(exception.EndpointAuthServiceMagic).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -16,7 +16,7 @@ func Redirect(c *gin.Context) {
clientId := c.Query("client_id") clientId := c.Query("client_id")
if clientId == "" { if clientId == "" {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -29,7 +29,7 @@ func Redirect(c *gin.Context) {
redirectUri := c.Query("redirect_uri") redirectUri := c.Query("redirect_uri")
if redirectUri == "" { if redirectUri == "" {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -42,7 +42,7 @@ func Redirect(c *gin.Context) {
state := c.Query("state") state := c.Query("state")
if state == "" { if state == "" {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -58,7 +58,7 @@ func Redirect(c *gin.Context) {
authCode, ok := authcode.VerifyAuthCode(code) authCode, ok := authcode.VerifyAuthCode(code)
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).
@@ -110,7 +110,7 @@ func Redirect(c *gin.Context) {
client, err := clientData.GetClientByClientId(clientId) client, err := clientData.GetClientByClientId(clientId)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).
@@ -124,7 +124,7 @@ func Redirect(c *gin.Context) {
err = client.ValidateRedirectURI(redirectUri) err = client.ValidateRedirectURI(redirectUri)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).
@@ -152,7 +152,7 @@ func Redirect(c *gin.Context) {
url, err := url.Parse(redirectUri) url, err := url.Parse(redirectUri)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRedirect). SetEndpoint(exception.EndpointAuthServiceRedirect).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -16,7 +16,7 @@ func Refresh(c *gin.Context) {
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh). SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -34,7 +34,7 @@ func Refresh(c *gin.Context) {
accessToken, err := JwtTool.RefreshAccessToken(req.RefreshToken) accessToken, err := JwtTool.RefreshAccessToken(req.RefreshToken)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh). SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -21,7 +21,7 @@ func Token(c *gin.Context) {
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceToken). SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -35,7 +35,7 @@ func Token(c *gin.Context) {
authCode, ok := authcode.VerifyAuthCode(req.Code) authCode, ok := authcode.VerifyAuthCode(req.Code)
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceAuth). SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceToken). SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -41,7 +41,7 @@ func Checkin(c *gin.Context) {
eventIdOrig, ok := c.GetQuery("event_id") eventIdOrig, ok := c.GetQuery("event_id")
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckin). SetEndpoint(exception.EndpointEventServiceCheckin).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -96,7 +96,7 @@ func CheckinSubmit(c *gin.Context) {
err := attendanceData.VerifyCheckinCode(req.ChekinCode) err := attendanceData.VerifyCheckinCode(req.ChekinCode)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckinSubmit). SetEndpoint(exception.EndpointEventServiceCheckinSubmit).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -140,7 +140,7 @@ func CheckinQuery(c *gin.Context) {
eventIdOrig, ok := c.GetQuery("event_id") eventIdOrig, ok := c.GetQuery("event_id")
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckinQuery). SetEndpoint(exception.EndpointEventServiceCheckinQuery).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -152,7 +152,7 @@ func CheckinQuery(c *gin.Context) {
eventId, err := uuid.Parse(eventIdOrig) eventId, err := uuid.Parse(eventIdOrig)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckinQuery). SetEndpoint(exception.EndpointEventServiceCheckinQuery).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -179,7 +179,7 @@ func CheckinQuery(c *gin.Context) {
return return
} else if attendance == nil { } else if attendance == nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceCheckinQuery). SetEndpoint(exception.EndpointEventServiceCheckinQuery).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -15,7 +15,7 @@ func Info(c *gin.Context) {
eventIdOrig, ok := c.GetQuery("event_id") eventIdOrig, ok := c.GetQuery("event_id")
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceInfo). SetEndpoint(exception.EndpointEventServiceInfo).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -43,7 +43,7 @@ func Info(c *gin.Context) {
event, err := eventData.GetEventById(eventId) event, err := eventData.GetEventById(eventId)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceEvent). SetService(exception.ServiceEvent).
SetEndpoint(exception.EndpointEventServiceInfo). SetEndpoint(exception.EndpointEventServiceInfo).
SetType(exception.TypeSpecific). SetType(exception.TypeSpecific).

View File

@@ -18,7 +18,7 @@ func List(c *gin.Context) {
offset, ok := c.GetQuery("offset") offset, ok := c.GetQuery("offset")
if !ok { if !ok {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList). SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -32,7 +32,7 @@ func List(c *gin.Context) {
limitNum, err := strconv.ParseInt(limit, 10, 64) limitNum, err := strconv.ParseInt(limit, 10, 64)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList). SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -45,7 +45,7 @@ func List(c *gin.Context) {
offsetNum, err := strconv.ParseInt(offset, 10, 64) offsetNum, err := strconv.ParseInt(offset, 10, 64)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList). SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).

View File

@@ -44,7 +44,7 @@ func Update(c *gin.Context) {
err = c.ShouldBindJSON(&ReqInfo) err = c.ShouldBindJSON(&ReqInfo)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -82,7 +82,7 @@ func Update(c *gin.Context) {
if ReqInfo.Username != "" { if ReqInfo.Username != "" {
if len(ReqInfo.Username) < 5 || len(ReqInfo.Username) >= 255 { if len(ReqInfo.Username) < 5 || len(ReqInfo.Username) >= 255 {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -97,7 +97,7 @@ func Update(c *gin.Context) {
if ReqInfo.Nickname != "" { if ReqInfo.Nickname != "" {
if utf8.RuneCountInString(ReqInfo.Nickname) > 24 { if utf8.RuneCountInString(ReqInfo.Nickname) > 24 {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -112,7 +112,7 @@ func Update(c *gin.Context) {
if ReqInfo.Subtitle != "" { if ReqInfo.Subtitle != "" {
if utf8.RuneCountInString(ReqInfo.Subtitle) > 32 { if utf8.RuneCountInString(ReqInfo.Subtitle) > 32 {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -128,7 +128,7 @@ func Update(c *gin.Context) {
_, err := url.ParseRequestURI(ReqInfo.Avatar) _, err := url.ParseRequestURI(ReqInfo.Avatar)
if err != nil { if err != nil {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).
@@ -144,7 +144,7 @@ func Update(c *gin.Context) {
if ReqInfo.Bio != "" { if ReqInfo.Bio != "" {
if !cryptography.IsBase64Std(ReqInfo.Bio) { if !cryptography.IsBase64Std(ReqInfo.Bio) {
errorCode := new(exception.Builder). errorCode := new(exception.Builder).
SetStatus(exception.StatusClient). SetStatus(exception.StatusUser).
SetService(exception.ServiceUser). SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceUpdate). SetEndpoint(exception.EndpointUserServiceUpdate).
SetType(exception.TypeCommon). SetType(exception.TypeCommon).