by Robin at 20240125; add token auth

This commit is contained in:
Leufolium 2024-01-25 08:59:52 +08:00
parent a1bae6eb21
commit 12ee83520f
1 changed files with 26 additions and 26 deletions

View File

@ -55,6 +55,25 @@ func Init(r *gin.Engine) {
// gateway网关给客户端调用 // gateway网关给客户端调用
//toCApiGroup := r.Group("/api", PrepareToC()) //toCApiGroup := r.Group("/api", PrepareToC())
// 支付相关
vasPayGroup := r.Group("/api/vas", PrepareToC())
vasPayGroup.POST("get_coins_product_list", middleware.JSONParamValidator(vasproto.GetCoinsProductListReq{}), middleware.JwtAuthenticator(), GetCoinsProductList)
vasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.CreateOrderReq{}), middleware.JwtAuthenticator(), CreateOrder)
vasPayGroup.POST("one_step_unlock", middleware.JSONParamValidator(vasproto.OneStepUnlockContactReq{}), middleware.JwtAuthenticator(), OneStepUnlock)
vasPayGroup.POST("consumer_fill_contact", middleware.JSONParamValidator(vasproto.ConsumerFillContactReq{}), middleware.JwtAuthenticator(), ConsumerFillContact)
vasPayGroup.POST("get_add_wechat_list", middleware.JSONParamValidator(vasproto.GetAddWechatListReq{}), middleware.JwtAuthenticator(), GetAddWechatList)
vasPayGroup.POST("confirm_add_wechat", middleware.JSONParamValidator(vasproto.ConfirmAddWechatReq{}), middleware.JwtAuthenticator(), ConfirmAddWechat)
vasPayGroup.POST("get_unlock_wechat_list", middleware.JSONParamValidator(vasproto.GetUnlockWechatListReq{}), middleware.JwtAuthenticator(), GetUnlockWechatList)
vasPayGroup.POST("get_ch_list", middleware.JSONParamValidator(vasproto.GetCHListReq{}), middleware.JwtAuthenticator(), GetCHList)
vasPayGroup.POST("update_wechat", middleware.JSONParamValidator(vasproto.UpdateWechatReq{}), middleware.JwtAuthenticator(), UpdateWechat)
vasPayGroup.POST("query_wechat", middleware.JSONParamValidator(vasproto.QueryWechatReq{}), middleware.JwtAuthenticator(), QueryWechat)
vasPayGroup.POST("h5_direct_unlock_wechat", middleware.JSONParamValidator(vasproto.H5DirectUnlockWechatReq{}), middleware.JwtAuthenticator(), H5DirectUnlockWechat)
vasPayGroup.POST("h5_get_unlock_wechat_list", middleware.JSONParamValidator(vasproto.GetUnlockWechatListReq{}), middleware.JwtAuthenticator(), GetUnlockWechatList)
vasPayGroup.POST("withdraw_page", middleware.JSONParamValidator(vasproto.WithdrawPageReq{}), middleware.JwtAuthenticator(), WithdrawPage)
vasPayGroup.POST("withdraw_send_verifycode", middleware.JSONParamValidator(vasproto.WithdrawSendVerifycodeReq{}), middleware.JwtAuthenticator(), WithdrawSendVerifycode)
vasPayGroup.POST("withdraw_apply", middleware.JSONParamValidator(vasproto.WithdrawApplyReq{}), middleware.JwtAuthenticator(), WithdrawApply)
vasPayGroup.POST("deal_one_coin_order", middleware.JSONParamValidator(vasproto.DealOneCoinOrderReq{}), middleware.JwtAuthenticator(), DealOneCoinOrder)
// 验证码 // 验证码
apiVeriCodeGroup := r.Group("/api/veri_code", PrepareToC()) apiVeriCodeGroup := r.Group("/api/veri_code", PrepareToC())
apiVeriCodeGroup.POST("send", middleware.JSONParamValidator(vericodeproto.ApiSendReq{}), middleware.RequestDecryptor(), ApiSendVeriCode) apiVeriCodeGroup.POST("send", middleware.JSONParamValidator(vericodeproto.ApiSendReq{}), middleware.RequestDecryptor(), ApiSendVeriCode)
@ -192,36 +211,17 @@ func Init(r *gin.Engine) {
// op相关直接调用服务不调用gateway // op相关直接调用服务不调用gateway
// 商品 // 商品
opProductGroup := r.Group("/op/product", PrepareOp()) opProductGroup := r.Group("/op/product", PrepareOp())
opProductGroup.POST("create", middleware.JSONParamValidator(productproto.OpCreateReq{}), OpCreateProduct) opProductGroup.POST("create", middleware.JSONParamValidator(productproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateProduct)
opProductGroup.POST("update", middleware.JSONParamValidator(productproto.OpUpdateReq{}), OpUpdateProduct) opProductGroup.POST("update", middleware.JSONParamValidator(productproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateProduct)
opProductGroup.POST("delete", middleware.JSONParamValidator(productproto.OpDeleteReq{}), OpDeleteProduct) opProductGroup.POST("delete", middleware.JSONParamValidator(productproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteProduct)
opProductGroup.POST("list", middleware.JSONParamValidator(productproto.OpListReq{}), OpGetProductList) opProductGroup.POST("list", middleware.JSONParamValidator(productproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetProductList)
// 支付相关
vasPayGroup := r.Group("/api/vas", PrepareToC())
vasPayGroup.POST("get_coins_product_list", middleware.JSONParamValidator(vasproto.GetCoinsProductListReq{}), GetCoinsProductList)
vasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.CreateOrderReq{}), middleware.JwtAuthenticator(), CreateOrder)
vasPayGroup.POST("one_step_unlock", middleware.JSONParamValidator(vasproto.OneStepUnlockContactReq{}), OneStepUnlock)
vasPayGroup.POST("consumer_fill_contact", middleware.JSONParamValidator(vasproto.ConsumerFillContactReq{}), ConsumerFillContact)
vasPayGroup.POST("get_add_wechat_list", middleware.JSONParamValidator(vasproto.GetAddWechatListReq{}), GetAddWechatList)
vasPayGroup.POST("confirm_add_wechat", middleware.JSONParamValidator(vasproto.ConfirmAddWechatReq{}), ConfirmAddWechat)
vasPayGroup.POST("get_unlock_wechat_list", middleware.JSONParamValidator(vasproto.GetUnlockWechatListReq{}), GetUnlockWechatList)
vasPayGroup.POST("get_ch_list", middleware.JSONParamValidator(vasproto.GetCHListReq{}), GetCHList)
vasPayGroup.POST("update_wechat", middleware.JSONParamValidator(vasproto.UpdateWechatReq{}), UpdateWechat)
vasPayGroup.POST("query_wechat", middleware.JSONParamValidator(vasproto.QueryWechatReq{}), QueryWechat)
vasPayGroup.POST("h5_direct_unlock_wechat", middleware.JSONParamValidator(vasproto.H5DirectUnlockWechatReq{}), H5DirectUnlockWechat)
vasPayGroup.POST("h5_get_unlock_wechat_list", middleware.JSONParamValidator(vasproto.GetUnlockWechatListReq{}), GetUnlockWechatList)
vasPayGroup.POST("withdraw_page", middleware.JSONParamValidator(vasproto.WithdrawPageReq{}), WithdrawPage)
vasPayGroup.POST("withdraw_send_verifycode", middleware.JSONParamValidator(vasproto.WithdrawSendVerifycodeReq{}), WithdrawSendVerifycode)
vasPayGroup.POST("withdraw_apply", middleware.JSONParamValidator(vasproto.WithdrawApplyReq{}), WithdrawApply)
vasPayGroup.POST("deal_one_coin_order", middleware.JSONParamValidator(vasproto.DealOneCoinOrderReq{}), DealOneCoinOrder)
extVasPayGroup := r.Group("/ext/vas") extVasPayGroup := r.Group("/ext/vas")
extVasPayGroup.POST("alipay_callback", AlipayCallback) extVasPayGroup.POST("alipay_callback", middleware.JwtAuthenticator(), AlipayCallback)
opVasPayGroup := r.Group("/op/vas", PrepareOp()) opVasPayGroup := r.Group("/op/vas", PrepareOp())
opVasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.OpCreateOrderReq{}), OpCreateOrder) opVasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.OpCreateOrderReq{}), middleware.JwtAuthenticator(), OpCreateOrder)
opVasPayGroup.POST("coin_order_list", middleware.JSONParamValidator(vasproto.OpCoinOrderListReq{}), OpOrderList) opVasPayGroup.POST("coin_order_list", middleware.JSONParamValidator(vasproto.OpCoinOrderListReq{}), middleware.JwtAuthenticator(), OpOrderList)
// 验证码 // 验证码
opVeriCodeGroup := r.Group("/op/veri_code", PrepareOp()) opVeriCodeGroup := r.Group("/op/veri_code", PrepareOp())