This commit is contained in:
李子铭 2025-03-12 10:26:30 +08:00
parent 77a9782136
commit 51f79d2cd4
2 changed files with 22 additions and 22 deletions

View File

@ -215,25 +215,3 @@ func (s *VoucherService) cmbProductQuery(ctx http.Context) (*v1.CmbQueryProductR
return s.VoucherBiz.CmbProductQuery(ctx, bizContent.ActivityId) return s.VoucherBiz.CmbProductQuery(ctx, bizContent.ActivityId)
} }
func (s *VoucherService) DecryptBody(ctx http.Context) error {
bodyBytes, err := io.ReadAll(ctx.Request().Body)
if err != nil {
return err
}
var req *v1.EncryptBody
if err = json.Unmarshal(bodyBytes, &req); err != nil {
return err
}
decryptBody, err := s.CmbMixRepo.Decrypt(ctx, req.EncryptBody)
if err != nil {
return err
}
return ctx.JSON(200, &v1.DecryptBody{
DecryptBody: decryptBody,
})
}

View File

@ -82,3 +82,25 @@ func (s *VoucherService) CmbProductQueryMock(ctx http.Context) error {
return ctx.JSON(200, reply) return ctx.JSON(200, reply)
} }
func (s *VoucherService) DecryptBody(ctx http.Context) error {
bodyBytes, err := io.ReadAll(ctx.Request().Body)
if err != nil {
return err
}
var req *v1.EncryptBody
if err = json.Unmarshal(bodyBytes, &req); err != nil {
return err
}
decryptBody, err := s.CmbMixRepo.Decrypt(ctx, req.EncryptBody)
if err != nil {
return err
}
return ctx.JSON(200, &v1.DecryptBody{
DecryptBody: decryptBody,
})
}