fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 8m21s

This commit is contained in:
2026-03-04 06:33:14 -08:00
parent 6c8f22adc8
commit a01570b59d
22 changed files with 1153 additions and 92 deletions
@@ -2,19 +2,9 @@ package common
import (
"context"
"encoding/json"
"fmt"
"strings"
"github.com/perfect-panel/server/internal/config"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/internal/types"
"github.com/perfect-panel/server/pkg/authmethod"
"github.com/perfect-panel/server/pkg/constant"
"github.com/perfect-panel/server/pkg/logger"
"github.com/perfect-panel/server/pkg/phone"
"github.com/perfect-panel/server/pkg/xerr"
"github.com/pkg/errors"
)
type CheckVerificationCodeLogic struct {
@@ -33,40 +23,8 @@ func NewCheckVerificationCodeLogic(ctx context.Context, svcCtx *svc.ServiceConte
}
func (l *CheckVerificationCodeLogic) CheckVerificationCode(req *types.CheckVerificationCodeRequest) (resp *types.CheckVerificationCodeRespone, err error) {
resp = &types.CheckVerificationCodeRespone{}
req.Account = strings.ToLower(strings.TrimSpace(req.Account))
if req.Method == authmethod.Email {
cacheKey := fmt.Sprintf("%s:%s:%s", config.AuthCodeCacheKey, constant.ParseVerifyType(req.Type), req.Account)
value, err := l.svcCtx.Redis.Get(l.ctx, cacheKey).Result()
if err != nil {
return resp, nil
}
var payload CacheKeyPayload
if err := json.Unmarshal([]byte(value), &payload); err != nil {
return resp, nil
}
if payload.Code != req.Code {
return resp, nil
}
resp.Status = true
}
if req.Method == authmethod.Mobile {
if !phone.CheckPhone(req.Account) {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.TelephoneError), "Invalid phone number")
}
cacheKey := fmt.Sprintf("%s:%s:+%s", config.AuthCodeTelephoneCacheKey, constant.ParseVerifyType(req.Type), req.Account)
value, err := l.svcCtx.Redis.Get(l.ctx, cacheKey).Result()
if err != nil {
return resp, nil
}
var payload CacheKeyPayload
if err := json.Unmarshal([]byte(value), &payload); err != nil {
return resp, nil
}
if payload.Code != req.Code {
return resp, nil
}
resp.Status = true
}
return resp, nil
return l.CheckVerificationCodeWithBehavior(req, VerifyCodeCheckBehavior{
Source: "canonical",
Consume: true,
})
}