feat(api): 新增 AES 加密参数接口
- 在 restriction 接口新增 GetAESEncryptionParams 方法 - 从 validation 接口移除 GetAESEncryptionParams 方法 - 删除验证控制器中的 AES 加密参数实现逻辑
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
type IRestrictionV1 interface {
|
||||
GetAESEncryptionParams(ctx context.Context, req *v1.GetAESEncryptionParamsReq) (res *v1.GetAESEncryptionParamsRes, err error)
|
||||
UserInfoCollection(ctx context.Context, req *v1.UserInfoCollectionReq) (res *v1.UserInfoCollectionRes, err error)
|
||||
BlockOrder(ctx context.Context, req *v1.BlockOrderReq) (res *v1.BlockOrderRes, err error)
|
||||
QueryAllProvince(ctx context.Context, req *v1.QueryAllProvinceReq) (res *v1.QueryAllProvinceRes, err error)
|
||||
|
||||
@@ -11,6 +11,5 @@ import (
|
||||
)
|
||||
|
||||
type IValidationV1 interface {
|
||||
GetAESEncryptionParams(ctx context.Context, req *v1.GetAESEncryptionParamsReq) (res *v1.GetAESEncryptionParamsRes, err error)
|
||||
GetCaptcha(ctx context.Context, req *v1.GetCaptchaReq) (res *v1.GetCaptchaRes, err error)
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
|
||||
v1 "kami/api/validation/v1"
|
||||
"kami/internal/errHandler"
|
||||
"kami/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetAESEncryptionParams(ctx context.Context, req *v1.GetAESEncryptionParamsReq) (res *v1.GetAESEncryptionParamsRes, err error) {
|
||||
params, err := service.SysConfigDict().GetAESKey(ctx)
|
||||
if err != nil {
|
||||
err = errHandler.WrapError(ctx, gcode.CodeInternalError, err, "获取 AES 加密参数失败")
|
||||
return
|
||||
}
|
||||
|
||||
res = &v1.GetAESEncryptionParamsRes{
|
||||
Key: params.Key,
|
||||
IV: params.IV,
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user