优化通知接口
This commit is contained in:
parent
b7af0f63ac
commit
df6c263ea0
11
git_hook.go
11
git_hook.go
@ -8,8 +8,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/zhangdeman/gopkg/git_hook"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -17,9 +15,12 @@ import (
|
||||
func main() {
|
||||
router := gin.Default()
|
||||
// 注册回调路由
|
||||
_ = git_hook.RegisterGitHookRouter(router, func(ctx *gin.Context, hookData *git_hook.HookData) {
|
||||
callbackData, _ := json.Marshal(hookData)
|
||||
fmt.Println("回调数据 : ", string(callbackData))
|
||||
_ = git_hook.RegisterGitHookRouter(router, func(ctx *gin.Context, hookData *git_hook.HookData) *git_hook.ResponseData {
|
||||
return &git_hook.ResponseData{
|
||||
Code: 0,
|
||||
Message: "成功接收到web hook通知",
|
||||
Data: hookData,
|
||||
}
|
||||
})
|
||||
_ = router.Run(":12590")
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module git.zhangdeman.cn/zhangdeman/git_hook
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211111140656-6287bc062fd8
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211112034039-2c436b1a6c2f
|
||||
github.com/gin-gonic/gin v1.7.4
|
||||
)
|
||||
|
||||
|
2
go.sum
2
go.sum
@ -1,5 +1,7 @@
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211111140656-6287bc062fd8 h1:8Q8gDw9KrO2RkernimnXD8lPAu63YS2bwuMBK5nfI2o=
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211111140656-6287bc062fd8/go.mod h1:+ga94Zdtpve/XVHlc3UbnrxXoNw9HCuGRowxtJsePag=
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211112034039-2c436b1a6c2f h1:KOJxfoNlRTaNRHa0yUT5rW08Ol2gZJmsnhm1w9YsTq4=
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20211112034039-2c436b1a6c2f/go.mod h1:+ga94Zdtpve/XVHlc3UbnrxXoNw9HCuGRowxtJsePag=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
Loading…
Reference in New Issue
Block a user