From adeb7cea44facd2346ed39427a0ea411a19e7993 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 10 Jan 2024 22:01:16 +0800 Subject: [PATCH] by Robin at 20240110; fix un-jwt auth --- app/mix/controller/init.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index a7069bf5..92e9662a 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -132,18 +132,18 @@ func Init(r *gin.Engine) { // 实名认证 apiRealNameAuthenticationGroup := r.Group("/api/realname_authentication", PrepareToC()) - apiRealNameAuthenticationGroup.POST("create", middleware.JSONParamValidator(realname_authenticationproto.ApiCreateReq{}), middleware.RequestDecryptor(), ApiCreateRealNameAuthentication) + apiRealNameAuthenticationGroup.POST("create", middleware.JSONParamValidator(realname_authenticationproto.ApiCreateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiCreateRealNameAuthentication) apiRealNameAuthenticationGroup.POST("list_by_mid", middleware.JSONParamValidator(realname_authenticationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetRealNameAuthenticationList) // 联系客服 apiContactCustomerServiceGroup := r.Group("/api/contact_customer_service", PrepareToC()) - apiContactCustomerServiceGroup.POST("create", middleware.JSONParamValidator(contact_customer_serviceproto.ApiCreateReq{}), ApiCreateContactCustomerService) - apiContactCustomerServiceGroup.POST("list_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.ApiListBySessionIdReq{}), ApiGetContactCustomerServiceListBySessionId) + apiContactCustomerServiceGroup.POST("create", middleware.JSONParamValidator(contact_customer_serviceproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateContactCustomerService) + apiContactCustomerServiceGroup.POST("list_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.ApiListBySessionIdReq{}), middleware.JwtAuthenticator(), ApiGetContactCustomerServiceListBySessionId) // 联系客服对话表 apiContactCustomerServiceSessionGroup := r.Group("/api/contact_customer_service_session", PrepareToC()) - apiContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiCreateReq{}), ApiCreateContactCustomerServiceSession) - apiContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiListByMidReq{}), ApiGetContactCustomerServiceSessionListByMid) + apiContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateContactCustomerServiceSession) + apiContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetContactCustomerServiceSessionListByMid) // 主播标签 apiStreamerTagGroup := r.Group("/api/streamer_tag", PrepareToC()) @@ -159,11 +159,11 @@ func Init(r *gin.Engine) { // 是否有新版本 apiVersion := r.Group("/api/version", PrepareToC()) - apiVersion.POST("is_there_a_new_version_available", middleware.JSONParamValidator(base.BaseRequest{}), OpIsThereANewVersionAvailable) + apiVersion.POST("is_there_a_new_version_available", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpIsThereANewVersionAvailable) // 上传媒体失败配置 apiUploadMediaFailConfig := r.Group("/api/upload_media_fail_config", PrepareToC()) - apiUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), OpGetUploadMediaFailConfigList) + apiUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetUploadMediaFailConfigList) // =============================== 以下是服务,只允许内网调用 =============================== @@ -312,23 +312,23 @@ func Init(r *gin.Engine) { //opRealNameAuthenticationGroup.POST("create", middleware.JSONParamValidator(realname_authenticationproto.OpCreateReq{}), middleware.RequestDecryptor(), OpCreateRealNameAuthentication) //opRealNameAuthenticationGroup.POST("update", middleware.JSONParamValidator(realname_authenticationproto.OpUpdateReq{}), middleware.RequestDecryptor(), OpUpdateRealNameAuthentication) //opRealNameAuthenticationGroup.POST("delete_batch", middleware.JSONParamValidator(realname_authenticationproto.OpDeleteBatchReq{}), OpDeleteBatchRealNameAuthentication) - opRealNameAuthenticationGroup.POST("list", middleware.JSONParamValidator(realname_authenticationproto.OpListReq{}), OpGetRealNameAuthenticationList) + opRealNameAuthenticationGroup.POST("list", middleware.JSONParamValidator(realname_authenticationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetRealNameAuthenticationList) opRealNameAuthenticationGroup.POST("approve", middleware.JSONParamValidator(realname_authenticationproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveRealNameAuthentication) //opRealNameAuthenticationGroup.POST("list_by_mid", middleware.JSONParamValidator(realname_authenticationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetRealNameAuthenticationList) // 联系客服 opContactCustomerServiceGroup := r.Group("/op/contact_customer_service", PrepareOp()) - opContactCustomerServiceGroup.POST("create", middleware.JSONParamValidator(contact_customer_serviceproto.OpCreateReq{}), OpCreateContactCustomerService) - opContactCustomerServiceGroup.POST("update_by_ids", middleware.JSONParamValidator(contact_customer_serviceproto.OpUpdateByIdsReq{}), OpUpdateContactCustomerServiceByIds) + opContactCustomerServiceGroup.POST("create", middleware.JSONParamValidator(contact_customer_serviceproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateContactCustomerService) + opContactCustomerServiceGroup.POST("update_by_ids", middleware.JSONParamValidator(contact_customer_serviceproto.OpUpdateByIdsReq{}), middleware.JwtAuthenticator(), OpUpdateContactCustomerServiceByIds) //opContactCustomerServiceGroup.POST("delete", middleware.JSONParamValidator(contact_customer_serviceproto.OpDeleteReq{}), OpDeleteContactCustomerService) - opContactCustomerServiceGroup.POST("list_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.OpListBySessionIdReq{}), OpGetContactCustomerServiceListBySessionId) - opContactCustomerServiceGroup.POST("list_unread_group_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.OpListUnreadReq{}), OpGetContactCustomerServiceListUnreadGroupByMid) + opContactCustomerServiceGroup.POST("list_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.OpListBySessionIdReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceListBySessionId) + opContactCustomerServiceGroup.POST("list_unread_group_by_session_id", middleware.JSONParamValidator(contact_customer_serviceproto.OpListUnreadReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceListUnreadGroupByMid) // 联系客服对话表 opContactCustomerServiceSessionGroup := r.Group("/op/contact_customer_service_session", PrepareOp()) - opContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpCreateReq{}), OpCreateContactCustomerServiceSession) - opContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListByMidReq{}), OpGetContactCustomerServiceSessionListByMid) - opContactCustomerServiceSessionGroup.POST("list", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListReq{}), OpGetContactCustomerServiceSessionList) + opContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateContactCustomerServiceSession) + opContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceSessionListByMid) + opContactCustomerServiceSessionGroup.POST("list", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceSessionList) // 图片审核任务 opImageAuditTaskGroup := r.Group("/op/image_audit_task", PrepareOp()) @@ -359,7 +359,7 @@ func Init(r *gin.Engine) { // 上传媒体失败配置 opUploadMediaFailConfig := r.Group("/op/upload_media_fail_config", PrepareOp()) - opUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), OpGetUploadMediaFailConfigList) + opUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetUploadMediaFailConfigList) // 每日报表表 opDailyStatementGroup := r.Group("/op/daily_statement", PrepareOp())