Skip to content

Conversation

@Xkta
Copy link
Contributor

@Xkta Xkta commented Sep 18, 2025

No description provided.

@silenceper
Copy link
Owner

@Xkta 能先描述一下加上这个json tag的原因? 对kratos不太熟悉,是怎么兼容的

@houseme
Copy link
Collaborator

houseme commented Sep 18, 2025

@Xkta 能先描述一下加上这个json tag的原因? 对kratos不太熟悉,是怎么兼容的

+1

@houseme houseme requested a review from Copilot September 18, 2025 14:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adjusts the struct tags for WeChat Work callback URL parameters to be compatible with the Kratos framework by adding JSON tags alongside existing form tags.

  • Adds JSON struct tags to the SignatureOptions struct fields for dual serialization support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Xkta
Copy link
Contributor Author

Xkta commented Sep 18, 2025

@Xkta 能先描述一下加上这个json tag的原因? 对kratos不太熟悉,是怎么兼容的

具体见 // VerifyURL 验证请求参数是否合法并返回解密后的消息内容 验证请求参数是否合法并返回解密后的消息内容,这里使用了 c.ShouldBindQuery(&options) 解析入参,这是 Gin 框架依赖 form 标签的用法。如果切换到 kratos 框架,也有类似的功能,比如 ctx.BindQuery(&options),但 kratos 是依赖 json 标签来解析的。

这次结构体标签的调整,给字段同时加上了 form 和 json 标签,可以让同一个 SignatureOptions 结构体在 Gin 和 kratos 框架下都能直接用于查询参数的绑定解析,方便在不同 web 框架之间平滑迁移和复用代码。

@silenceper silenceper merged commit c136b87 into silenceper:v2 Sep 19, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants