forked from BIT_SCST_STIA/SmartMurphytt
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"chainmaker_go/controller"
|
||
|
"fmt"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func CollectRoute(r *gin.Engine) *gin.Engine {
|
||
|
r.POST("/user/login", controller.LoginUser)
|
||
|
// 1 bingfaxing
|
||
|
r.POST("/user/register", controller.RegisterUser)
|
||
|
// 2 tuntuliang
|
||
|
r.POST("/resource/register", controller.RegisterResource)
|
||
|
//
|
||
|
//r.GET("/resource", middleware.AuthMiddleware(), controller.ResourceStatistics)
|
||
|
r.GET("/resource", controller.ResourceStatistics)
|
||
|
r.POST("/resource/notice", controller.RightConfirmationNotice)
|
||
|
r.POST("/resource/transferOwnership", controller.TransferOwnershipRow)
|
||
|
r.GET("/rightConfirm", controller.RightConfirmation)
|
||
|
r.POST("/rightConfirm/row", controller.RightConfirmationRow)
|
||
|
// 3
|
||
|
r.POST("/rightConfirm/yes", controller.RightConfirmationYes)
|
||
|
//
|
||
|
r.POST("/transferOwnership/notice", controller.TransferOwnershipNotice)
|
||
|
r.GET("/transferOwnership", controller.TransferOwnership)
|
||
|
// 4
|
||
|
r.POST("/transferOwnership/yes", controller.TransferOwnershipYes)
|
||
|
//
|
||
|
r.GET("/cookies", func(ctx *gin.Context) {
|
||
|
cookie, err := ctx.Cookie("usename")
|
||
|
if err != nil {
|
||
|
cookie = "NotSet"
|
||
|
ctx.SetCookie("usename", "user_id", 3600, "/", "localhost", false, false)
|
||
|
}
|
||
|
fmt.Printf("Cookie value: %s \n", cookie)
|
||
|
})
|
||
|
return r
|
||
|
}
|