package controller import ( "encoding/json" "fmt" "io/ioutil" "net/http" imageaudittaskproto "service/api/proto/imageaudittask/proto" mediaproto "service/api/proto/media/proto" zonesessionproto "service/api/proto/zonesession/proto" "service/library/logger" "service/library/middleware" "time" "github.com/gorilla/websocket" "github.com/gin-gonic/gin" "service/api/base" "service/api/consts" "service/api/errcode" accountproto "service/api/proto/account/proto" account_cancellationproto "service/api/proto/account_cancellation/proto" accountpunishmentproto "service/api/proto/accountpunishment/proto" accountrelationproto "service/api/proto/accountrelation/proto" appconfigproto "service/api/proto/app_config/proto" callhistoryproto "service/api/proto/callhistory/proto" contact_customer_serviceproto "service/api/proto/contact_customer_service/proto" contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto" daily_statementproto "service/api/proto/daily_statement/proto" daily_statement_zone_info_proto "service/api/proto/daily_statement_zone_info/proto" feedbackproto "service/api/proto/feedback/proto" footprintproto "service/api/proto/footprint/proto" loginproto "service/api/proto/login/proto" momentproto "service/api/proto/moment/proto" moment_audit_taskproto "service/api/proto/moment_audit_task/proto" productproto "service/api/proto/product/proto" realname_authenticationproto "service/api/proto/realname_authentication/proto" streamerproto "service/api/proto/streamer/proto" streamerauthapprovalproto "service/api/proto/streamerauthapproval/proto" streamerlinkproto "service/api/proto/streamerlink/proto" textaudittaskproto "service/api/proto/textaudittask/proto" thumbsupproto "service/api/proto/thumbsup/proto" userwxaddcheckproto "service/api/proto/userwxaddcheck/proto" vasproto "service/api/proto/vas/proto" vericodeproto "service/api/proto/vericode/proto" zoneproto "service/api/proto/zone/proto" zone_collaborator_proto "service/api/proto/zone_collaborator/proto" zone_third_partner_proto "service/api/proto/zone_third_partner/proto" zonemomentproto "service/api/proto/zonemoment/proto" ) func Init(r *gin.Engine) { r.HandleMethodNotAllowed = true // websocket长链接 r.GET("/", ServeFile) r.GET("/ws", HandleWs) // Hello World! helloWorldGroup := r.Group("/hello_world", Prepare()) //helloWorldGroup.GET("hello_world", HelloWorld) helloWorldGroup.POST("hello_world", HelloWorld) // gateway网关,给客户端调用 //toCApiGroup := r.Group("/api", PrepareToC()) // 验证码 apiVeriCodeGroup := r.Group("/api/veri_code", PrepareToC()) apiVeriCodeGroup.POST("send", middleware.JSONParamValidator(vericodeproto.ApiSendReq{}), middleware.RequestDecryptor(), ApiSendVeriCode) // 登录 apiLoginGroup := r.Group("/api/login", PrepareToC()) apiLoginGroup.POST("login_by_pswd", middleware.JSONParamValidator(loginproto.ApiLoginByPswdReq{}), middleware.RequestDecryptor(), ApiLoginByPswd) apiLoginGroup.POST("login_by_veri_code", middleware.JSONParamValidator(loginproto.ApiLoginByVeriCodeReq{}), middleware.RequestDecryptor(), ApiLoginByVeriCode) apiLoginGroup.POST("logout", middleware.JSONParamValidator(loginproto.ApiLogoutReq{}), middleware.JwtAuthenticator(), ApiLogout) apiLoginGroup.POST("set_password", middleware.JSONParamValidator(loginproto.ApiSetPswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiSetPassword) apiLoginGroup.POST("reset_password", middleware.JSONParamValidator(loginproto.ApiResetPswdReq{}), middleware.RequestDecryptor(), ApiResetPassword) apiLoginGroup.POST("update_password", middleware.JSONParamValidator(loginproto.ApiUpdatePswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiUpdatePassword) apiLoginGroup.POST("validate", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), ApiValidate) // 账号,用户端支持改、查自己、查别人、经验增长,不支持增删 apiAccountGroup := r.Group("/api/account", PrepareToC()) apiAccountGroup.POST("update", middleware.JSONParamValidator(accountproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiUpdateAccount) apiAccountGroup.POST("list_by_mid", middleware.JSONParamValidator(accountproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetAccountListByMid) //apiAccountGroup.POST("list_by_user_id", middleware.JSONParamValidator(accountproto.ApiListByUserIdReq{}), middleware.JwtAuthenticator(), ApiGetAccountListByUserId) apiAccountGroup.POST("list_others_by_mid", middleware.JSONParamValidator(accountproto.ApiListOthersByMidReq{}), middleware.JwtAuthenticator(), ApiGetAccountListForOthersByMid) apiAccountGroup.POST("list_others_by_mids", middleware.JSONParamValidator(accountproto.ApiListOthersByMidsReq{}), middleware.JwtAuthenticator(), ApiGetAccountListForOthersByMids) apiAccountGroup.POST("list_others_by_user_id", middleware.JSONParamValidator(accountproto.ApiListOthersByUserIdReq{}), middleware.JwtAuthenticator(), ApiGetAccountListForOthersByUserId) apiAccountGroup.POST("exp_inc", middleware.JSONParamValidator(accountproto.ApiExpIncReq{}), middleware.JwtAuthenticator(), ApiAccountExpInc) apiAccountGroup.POST("cancel", middleware.JSONParamValidator(accountproto.ApiCancelReq{}), middleware.JwtAuthenticator(), ApiCancelAccount) apiAccountGroup.POST("abort_cancellation", middleware.JSONParamValidator(accountproto.ApiAbortCancellationReq{}), middleware.JwtAuthenticator(), ApiAbortAccountCancellation) // 用户关系,用户端支持增删查,不支持改 apiAccountRelationGroup := r.Group("/api/account_relation", PrepareToC()) apiAccountRelationGroup.POST("create", middleware.JSONParamValidator(accountrelationproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateAccountRelation) //apiAccountRelationGroup.POST("update", middleware.JSONParamValidator(accountrelationproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateAccountRelation) apiAccountRelationGroup.POST("delete", middleware.JSONParamValidator(accountrelationproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteAccountRelation) apiAccountRelationGroup.POST("list_follow", middleware.JSONParamValidator(accountrelationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetFollowAccountRelationList) apiAccountRelationGroup.POST("list_is_followed", middleware.JSONParamValidator(accountrelationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetIsFollowedAccountRelationList) apiAccountRelationGroup.POST("list_friend", middleware.JSONParamValidator(accountrelationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetFriendAccountRelationList) apiAccountRelationGroup.POST("list_ignore", middleware.JSONParamValidator(accountrelationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetIgnoreAccountRelationList) apiAccountRelationGroup.POST("list_able_to_access_weixin_of", middleware.JSONParamValidator(accountrelationproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetAbleToAccessWeixinOfAccountRelationList) apiAccountRelationGroup.POST("list_by_sentence", middleware.JSONParamValidator(accountrelationproto.ApiListBySentenceReq{}), middleware.JwtAuthenticator(), ApiGetAccountRelationBySentence) apiAccountRelationGroup.POST("count", middleware.JSONParamValidator(accountrelationproto.ApiCountReq{}), middleware.JwtAuthenticator(), ApiGetAccountRelationCount) // 动态 apiMomentGroup := r.Group("/api/moment", PrepareToC()) apiMomentGroup.POST("create", middleware.JSONParamValidator(momentproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateMoment) apiMomentGroup.POST("update", middleware.JSONParamValidator(momentproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateMoment) apiMomentGroup.POST("delete", middleware.JSONParamValidator(momentproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteMoment) apiMomentGroup.POST("list", middleware.JSONParamValidator(momentproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetMomentList) apiMomentGroup.POST("list_by_mid", middleware.JSONParamValidator(momentproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetMomentListByMid) apiMomentGroup.POST("list_by_mids", middleware.JSONParamValidator(momentproto.ApiListByMidsReq{}), middleware.JwtAuthenticator(), ApiGetMomentListByMids) apiMomentGroup.POST("thumbs_up", middleware.JSONParamValidator(momentproto.ApiThumbsUpReq{}), middleware.JwtAuthenticator(), ApiThumbsUpMoment) apiMomentGroup.POST("list_by_ids", middleware.JSONParamValidator(momentproto.ApiListByIdsReq{}), middleware.JwtAuthenticator(), ApiGetMomentListByIds) apiMomentGroup.POST("recomm_list", middleware.JSONParamValidator(momentproto.ApiRecommListReq{}), middleware.JwtAuthenticator(), ApiGetMomentRecommList) apiMomentGroup.POST("is_moment_image_encrypt_enabled", middleware.JSONParamValidator(base.BaseRequest{}), OpGetIsMomentImageEncryptEnabled) // 足迹 // apiFootPrintGroup := r.Group("/api/footprint", PrepareToC()) // apiFootPrintGroup.POST("create", middleware.JSONParamValidator(footprintproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateFootPrint) // apiFootPrintGroup.POST("delete", middleware.JSONParamValidator(footprintproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteFootPrint) // apiFootPrintGroup.POST("list_view", middleware.JSONParamValidator(footprintproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetViewFootPrintList) // apiFootPrintGroup.POST("list_is_viewed", middleware.JSONParamValidator(footprintproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetIsViewedFootPrintList) // apiFootPrintGroup.POST("count", middleware.JSONParamValidator(footprintproto.ApiCountReq{}), middleware.JwtAuthenticator(), ApiGetFootPrintCount) // 点赞 apiThumbsUpGroup := r.Group("/api/thumbs_up", PrepareToC()) apiThumbsUpGroup.POST("list", middleware.JSONParamValidator(thumbsupproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetThumbsUpList) // 女神认证审批,用户端支持增删查,不支持改 apiStreamerAuthApprovalGroup := r.Group("/api/streamer_auth_approval", PrepareToC()) apiStreamerAuthApprovalGroup.POST("create", middleware.JSONParamValidator(streamerauthapprovalproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateStreamerAuthApproval) apiStreamerAuthApprovalGroup.POST("delete", middleware.JSONParamValidator(streamerauthapprovalproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteStreamerAuthApproval) apiStreamerAuthApprovalGroup.POST("list", middleware.JSONParamValidator(streamerauthapprovalproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetStreamerAuthApprovalList) // 主播 apiStreamerGroup := r.Group("/api/streamer", PrepareToC()) apiStreamerGroup.POST("update", middleware.JSONParamValidator(streamerproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateStreamer) apiStreamerGroup.POST("list_by_mid", middleware.JSONParamValidator(streamerproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetStreamerListByMid) apiStreamerGroup.POST("list_ext_by_mid", middleware.JSONParamValidator(streamerproto.ApiListExtByMidReq{}), middleware.JwtAuthenticator(), ApiGetStreamerExtListByMid) apiStreamerGroup.POST("list_ext_by_mids", middleware.JSONParamValidator(streamerproto.ApiListExtByMidsReq{}), middleware.JwtAuthenticator(), ApiGetStreamerExtListByMids) apiStreamerGroup.POST("list_ext_by_user_id", middleware.JSONParamValidator(streamerproto.ApiListExtByUserIdReq{}), ApiGetStreamerExtListByUserId) apiStreamerGroup.POST("list_ext_fuzzily_by_user_id", middleware.JSONParamValidator(streamerproto.ApiListExtFuzzilyByUserIdReq{}), middleware.JwtAuthenticator(), ApiGetStreamerExtListFuzzilyByUserId) apiStreamerGroup.POST("list_ext_fuzzily_by_name", middleware.JSONParamValidator(streamerproto.ApiListExtFuzzilyByNameReq{}), middleware.JwtAuthenticator(), ApiGetStreamerExtListFuzzilyByName) apiStreamerGroup.POST("list_wx_id", middleware.JSONParamValidator(streamerproto.ApiListStreamerWxIdReq{}), middleware.JwtAuthenticator(), ApiGetStreamerWxId) apiStreamerGroup.POST("recomm_list", middleware.JSONParamValidator(streamerproto.ApiRecommListReq{}), middleware.JwtAuthenticator(), ApiGetStreamerRecommList) // 意见反馈 apiFeedbackGroup := r.Group("/api/feedback", PrepareToC()) apiFeedbackGroup.POST("create", middleware.JSONParamValidator(feedbackproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateFeedback) // 主播链接 apiStreamerLinkGroup := r.Group("/api/streamer_link", PrepareToC()) apiStreamerLinkGroup.POST("create", middleware.JSONParamValidator(streamerlinkproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateStreamerLink) apiStreamerLinkGroup.POST("update", middleware.JSONParamValidator(streamerlinkproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateStreamerLink) apiStreamerLinkGroup.POST("delete", middleware.JSONParamValidator(streamerlinkproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteStreamerLink) apiStreamerLinkGroup.POST("list_by_mid", middleware.JSONParamValidator(streamerlinkproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetStreamerLinkListByMid) apiStreamerLinkGroup.POST("create_batch", middleware.JSONParamValidator(streamerlinkproto.ApiCreateBatchReq{}), middleware.JwtAuthenticator(), ApiCreateBatchStreamerLink) apiStreamerLinkGroup.POST("delete_batch", middleware.JSONParamValidator(streamerlinkproto.ApiDeleteBatchReq{}), middleware.JwtAuthenticator(), ApiDeleteBatchStreamerLink) // 用户微信添加审核 apiUserWxAddCheckGroup := r.Group("/api/user_wx_add_check", PrepareToC()) apiUserWxAddCheckGroup.POST("create", middleware.JSONParamValidator(userwxaddcheckproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateUserWxAddCheck) apiUserWxAddCheckGroup.POST("update", middleware.JSONParamValidator(userwxaddcheckproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateUserWxAddCheck) apiUserWxAddCheckGroup.POST("delete", middleware.JSONParamValidator(userwxaddcheckproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteUserWxAddCheck) //todo : list apiUserWxAddCheckGroup.POST("list", middleware.JSONParamValidator(userwxaddcheckproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetUserWxAddCheckList) // 实名认证 apiRealNameAuthenticationGroup := r.Group("/api/realname_authentication", PrepareToC()) 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{}), 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{}), middleware.JwtAuthenticator(), ApiCreateContactCustomerServiceSession) apiContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetContactCustomerServiceSessionListByMid) // 应用配置表 apiAppConfigGroup := r.Group("/api/app_config", PrepareToC()) apiAppConfigGroup.POST("list_by_key", middleware.JSONParamValidator(appconfigproto.ApiListByKeyReq{}), middleware.JwtAuthenticator(), ApiGetAppConfigListByKey) // 主播标签 apiStreamerTagGroup := r.Group("/api/streamer_tag", PrepareToC()) apiStreamerTagGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetStreamerTagList) // 平台icon apiPlatformGroup := r.Group("/api/platform", PrepareToC()) apiPlatformGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetPlatformList) // 运营微信 apiSupportWxIdGroup := r.Group("/api/support_wx_id", PrepareToC()) apiSupportWxIdGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetSupportWxIdList) // 是否有新版本 apiVersion := r.Group("/api/version", PrepareToC()) apiVersion.POST("is_there_a_new_version_available", middleware.JSONParamValidator(base.BaseRequest{}), OpIsThereANewVersionAvailable) // 上传媒体失败配置 apiUploadMediaFailConfig := r.Group("/api/upload_media_fail_config", PrepareToC()) apiUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetUploadMediaFailConfigList) // 账户注销 apiAccountCancellationGroup := r.Group("/api/account_cancellation", PrepareToC()) apiAccountCancellationGroup.POST("list_by_mid", middleware.JSONParamValidator(account_cancellationproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetAccountCancellationListByMid) // 空间 apiZoneGroup := r.Group("/api/zone", PrepareToC()) apiZoneGroup.POST("create", middleware.JSONParamValidator(zoneproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateZone) apiZoneGroup.POST("update", middleware.JSONParamValidator(zoneproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZone) apiZoneGroup.POST("delete", middleware.JSONParamValidator(zoneproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZone) apiZoneGroup.POST("list", middleware.JSONParamValidator(zoneproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetZoneList) apiZoneGroup.POST("list_by_mid", middleware.JSONParamValidator(zoneproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneListByMid) apiZoneGroup.POST("list_by_visitor_mid", middleware.JSONParamValidator(zoneproto.ApiListByVisitorMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneListByVisitorMid) apiZoneGroup.POST("list_by_user_id_from_outside", middleware.JSONParamValidator(zoneproto.ApiListByUserIdFromOutsideReq{}), ApiGetZoneListByUserIdFromOutside) apiZoneGroup.POST("get_cashier", middleware.JSONParamValidator(vasproto.ZoneGetCashierReq{}), ZoneGetCashier) apiZoneGroup.POST("create_order", middleware.JSONParamValidator(vasproto.ZoneCreateOrderReq{}), ZoneCreateOrder) apiZoneGroup.POST("refund_page", middleware.JSONParamValidator(vasproto.ZoneRefundPageReq{}), ZoneRefundPage) apiZoneGroup.POST("refund", middleware.JSONParamValidator(vasproto.ZoneRefundReq{}), ZoneRefund) apiZoneGroup.POST("member_list", middleware.JSONParamValidator(vasproto.GetZoneMemberListReq{}), ZoneMemberList) apiZoneGroup.POST("free_join", middleware.JSONParamValidator(vasproto.ZoneFreeJoinReq{}), ZoneFreeJoin) apiZoneGroup.POST("exit", middleware.JSONParamValidator(vasproto.ZoneExitReq{}), ZoneExit) // 私密圈动态 apiZoneMomentGroup := r.Group("/api/zone_moment", PrepareToC()) apiZoneMomentGroup.POST("create", middleware.JSONParamValidator(zonemomentproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateZoneMoment) apiZoneMomentGroup.POST("update", middleware.JSONParamValidator(zonemomentproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZoneMoment) apiZoneMomentGroup.POST("delete", middleware.JSONParamValidator(zonemomentproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZoneMoment) apiZoneMomentGroup.POST("list_by_visitor_mid", middleware.JSONParamValidator(zonemomentproto.ApiListByVisitorMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneMomentListByVisitorMid) apiZoneMomentGroup.POST("list_by_creater_mid", middleware.JSONParamValidator(zonemomentproto.ApiListByCreaterMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneMomentListByCreaterMid) apiZoneMomentGroup.POST("list_by_zid", middleware.JSONParamValidator(zonemomentproto.ApiListByZidReq{}), middleware.JwtAuthenticator(), ApiGetZoneMomentListByZid) apiZoneMomentGroup.POST("thumbs_up", middleware.JSONParamValidator(zonemomentproto.ApiZoneMomentThumbsUpReq{}), middleware.JwtAuthenticator(), ApiZoneMomentThumbsUpMoment) apiZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.ApiHeadReq{}), middleware.JwtAuthenticator(), ApiHeadZoneMoment) apiZoneMomentGroup.POST("list_statistics_by_creater_mid", middleware.JSONParamValidator(zonemomentproto.ApiListStatisticsByCreaterMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneMomentStatisticsByCreaterMid) // 空间对话 apiZoneSessionGroup := r.Group("/api/zone_session", PrepareToC()) apiZoneSessionGroup.POST("upsert", middleware.JSONParamValidator(zonesessionproto.ApiUpsertReq{}), middleware.JwtAuthenticator(), ApiUpsertZoneSession) // 空间代运营表 apiZoneThirdPartnerGroup := r.Group("/api/zone_third_partner", PrepareToC()) apiZoneThirdPartnerGroup.POST("create", middleware.JSONParamValidator(zone_third_partner_proto.ApiCreateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiCreateZoneThirdPartner) //apiZoneThirdPartnerGroup.POST("update", middleware.JSONParamValidator(zone_third_partner_proto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZoneThirdPartner) //apiZoneThirdPartnerGroup.POST("delete", middleware.JSONParamValidator(zone_third_partner_proto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZoneThirdPartner) apiZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetZoneThirdPartnerList) // 空间协作者表 apiZoneCollaboratorGroup := r.Group("/api/zone_collaborator", PrepareToC()) apiZoneCollaboratorGroup.POST("create", middleware.JSONParamValidator(zone_collaborator_proto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateZoneCollaborator) apiZoneCollaboratorGroup.POST("update", middleware.JSONParamValidator(zone_collaborator_proto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZoneCollaborator) apiZoneCollaboratorGroup.POST("delete", middleware.JSONParamValidator(zone_collaborator_proto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZoneCollaborator) apiZoneCollaboratorGroup.POST("list", middleware.JSONParamValidator(zone_collaborator_proto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetZoneCollaboratorList) // =============================== 以下是服务,只允许内网调用 =============================== // op相关,直接调用服务,不调用gateway // 商品 opProductGroup := r.Group("/op/product", PrepareOp()) opProductGroup.POST("create", middleware.JSONParamValidator(productproto.OpCreateReq{}), OpCreateProduct) opProductGroup.POST("update", middleware.JSONParamValidator(productproto.OpUpdateReq{}), OpUpdateProduct) opProductGroup.POST("delete", middleware.JSONParamValidator(productproto.OpDeleteReq{}), OpDeleteProduct) opProductGroup.POST("list", middleware.JSONParamValidator(productproto.OpListReq{}), OpGetProductList) // 支付相关 vasPayGroup := r.Group("/api/vas", PrepareToC()) vasPayGroup.POST("get_coins_product_list", middleware.JSONParamValidator(vasproto.GetCoinsProductListReq{}), GetCoinsProductList) vasPayGroup.POST("get_membership_product_list", middleware.JSONParamValidator(vasproto.GetMembershipProductListReq{}), GetMembershipProductList) 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) vasPayGroup.POST("deal_one_order", middleware.JSONParamValidator(vasproto.DealOneOrderReq{}), DealOneOrder) vasPayGroup.POST("moment_order_list", middleware.JSONParamValidator(vasproto.ZoneMomentOrderListReq{}), ZoneMomentOrderList) extVasPayGroup := r.Group("/ext/vas") extVasPayGroup.POST("alipay_callback", AlipayCallback) extVasPayGroup.POST("wxpay_callback", WxpayCallback) opVasPayGroup := r.Group("/op/vas", PrepareOp()) opVasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.OpCreateOrderReq{}), OpCreateOrder) opVasPayGroup.POST("coin_order_list", middleware.JSONParamValidator(vasproto.OpCoinOrderListReq{}), OpCoinOrderList) opVasPayGroup.POST("order_list", middleware.JSONParamValidator(vasproto.OpOrderListReq{}), OpOrderList) opVasPayGroup.POST("refund_order", middleware.JSONParamValidator(vasproto.RefundOrderReq{}), RefundOrder) opVasPayGroup.POST("refund_coin_order", middleware.JSONParamValidator(vasproto.RefundCoinOrderReq{}), RefundCoinOrder) opVasPayGroup.POST("wxpay_callback_manual", middleware.JSONParamValidator(vasproto.WxpayCallbackManualParam{}), WxpayCallbackManual) opVasPayGroup.POST("zone_refund_list", middleware.JSONParamValidator(zoneproto.OpZoneRefundListParam{}), OpZoneRefundList) // 验证码 opVeriCodeGroup := r.Group("/op/veri_code", PrepareOp()) opVeriCodeGroup.POST("send", middleware.JSONParamValidator(vericodeproto.OpSendReq{}), middleware.RequestDecryptor(), OpSendVeriCode) // 登录 opLoginGroup := r.Group("/op/login", PrepareOp()) opLoginGroup.POST("login_by_pswd", middleware.JSONParamValidator(loginproto.OpLoginByPswdReq{}), middleware.RequestDecryptor(), OpLoginByPswd) opLoginGroup.POST("login_by_veri_code", middleware.JSONParamValidator(loginproto.OpLoginByVeriCodeReq{}), middleware.RequestDecryptor(), OpLoginByVeriCode) opLoginGroup.POST("logout", middleware.JSONParamValidator(loginproto.OpLogoutReq{}), middleware.JwtAuthenticator(), OpLogout) opLoginGroup.POST("set_password", middleware.JSONParamValidator(loginproto.OpSetPswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), OpSetPassword) opLoginGroup.POST("reset_password", middleware.JSONParamValidator(loginproto.OpResetPswdReq{}), middleware.RequestDecryptor(), OpResetPassword) opLoginGroup.POST("update_password", middleware.JSONParamValidator(loginproto.OpUpdatePswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), OpUpdatePassword) opLoginGroup.POST("validate", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpValidate) // 账号 opAccountGroup := r.Group("/op/account", PrepareOp()) opAccountGroup.POST("update", middleware.JSONParamValidator(accountproto.OpUpdateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), OpUpdateAccount) opAccountGroup.POST("list_by_mid", middleware.JSONParamValidator(accountproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetAccountListByMid) //opAccountGroup.POST("list_by_mids", middleware.JSONParamValidator(accountproto.OpListByMidsReq{}), middleware.JwtAuthenticator(), OpGetAccountListByMids) opAccountGroup.POST("list_by_user_id", middleware.JSONParamValidator(accountproto.OpListByUserIdReq{}), middleware.JwtAuthenticator(), OpGetAccountListByUserId) opAccountGroup.POST("get_mobile_phone_by_user_id", middleware.JSONParamValidator(accountproto.OpGetMobilePhoneByUserIdReq{}), middleware.JwtAuthenticator(), OpGetMobilePhoneByUserId) opAccountGroup.POST("list_others_by_mid", middleware.JSONParamValidator(accountproto.OpListOthersByMidReq{}), middleware.JwtAuthenticator(), OpGetAccountListForOthersByMid) opAccountGroup.POST("list_others_by_mids", middleware.JSONParamValidator(accountproto.OpListOthersByMidsReq{}), middleware.JwtAuthenticator(), OpGetAccountListForOthersByMids) opAccountGroup.POST("count", middleware.JSONParamValidator(accountproto.OpCountReq{}), middleware.JwtAuthenticator(), OpGetAccountCount) // 动态 opMomentGroup := r.Group("/op/moment", PrepareOp()) opMomentGroup.POST("create", middleware.JSONParamValidator(momentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateMoment) opMomentGroup.POST("update", middleware.JSONParamValidator(momentproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateMoment) opMomentGroup.POST("delete", middleware.JSONParamValidator(momentproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteMoment) opMomentGroup.POST("list", middleware.JSONParamValidator(momentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetMomentList) opMomentGroup.POST("list_deleted", middleware.JSONParamValidator(momentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDeletedMomentList) opMomentGroup.POST("list_by_mid", middleware.JSONParamValidator(momentproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetMomentListByMid) opMomentGroup.POST("thumbs_up", middleware.JSONParamValidator(momentproto.OpThumbsUpReq{}), middleware.JwtAuthenticator(), OpThumbsUpMoment) opMomentGroup.POST("list_by_ids", middleware.JSONParamValidator(momentproto.OpListByIdsReq{}), middleware.JwtAuthenticator(), OpGetMomentListByIds) opMomentGroup.POST("review", middleware.JSONParamValidator(momentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewMoment) // 足迹 opFootPrintGroup := r.Group("/op/footprint", PrepareOp()) opFootPrintGroup.POST("create", middleware.JSONParamValidator(footprintproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateFootPrint) opFootPrintGroup.POST("delete", middleware.JSONParamValidator(footprintproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteFootPrint) opFootPrintGroup.POST("list_view", middleware.JSONParamValidator(footprintproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetViewFootPrintList) opFootPrintGroup.POST("list_is_viewed", middleware.JSONParamValidator(footprintproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetIsViewedFootPrintList) opFootPrintGroup.POST("count", middleware.JSONParamValidator(footprintproto.OpCountReq{}), middleware.JwtAuthenticator(), OpGetFootPrintCount) // 点赞 opThumbsUpGroup := r.Group("/op/thumbs_up", PrepareOp()) opThumbsUpGroup.POST("list", middleware.JSONParamValidator(thumbsupproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetThumbsUpList) // 用户关系 opAccountRelationGroup := r.Group("/op/account_relation", PrepareOp()) opAccountRelationGroup.POST("list_follow", middleware.JSONParamValidator(accountrelationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetFollowAccountRelationList) opAccountRelationGroup.POST("list_is_followed", middleware.JSONParamValidator(accountrelationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetIsFollowedAccountRelationList) opAccountRelationGroup.POST("list_friend", middleware.JSONParamValidator(accountrelationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetFriendAccountRelationList) opAccountRelationGroup.POST("list_ignore", middleware.JSONParamValidator(accountrelationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetIgnoreAccountRelationList) opAccountRelationGroup.POST("list_able_to_access_weixin_of", middleware.JSONParamValidator(accountrelationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetAbleToAccessWeixinOfAccountRelationList) opAccountRelationGroup.POST("list_by_sentence", middleware.JSONParamValidator(accountrelationproto.OpListBySentenceReq{}), middleware.JwtAuthenticator(), OpGetAccountRelationBySentence) opAccountRelationGroup.POST("count", middleware.JSONParamValidator(accountrelationproto.OpCountReq{}), middleware.JwtAuthenticator(), OpGetAccountRelationCount) // 女神认证审批,后台支持查、审批,增删改均不支持 opStreamerAuthApprovalGroup := r.Group("/op/streamer_auth_approval", PrepareOp()) //opStreamerAuthApprovalGroup.POST("create", middleware.JSONParamValidator(streamerauthapprovalproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateStreamerAuthApproval) //opStreamerAuthApprovalGroup.POST("update", middleware.JSONParamValidator(streamerauthapprovalproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateStreamerAuthApproval) //opStreamerAuthApprovalGroup.POST("delete_batch", middleware.JSONParamValidator(streamerauthapprovalproto.OpDeleteBatchReq{}), middleware.JwtAuthenticator(), OpDeleteBatchStreamerAuthApproval) opStreamerAuthApprovalGroup.POST("list", middleware.JSONParamValidator(streamerauthapprovalproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalList) opStreamerAuthApprovalGroup.POST("approve", middleware.JSONParamValidator(streamerauthapprovalproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApproval) // 主播 opStreamerGroup := r.Group("/op/streamer", PrepareOp()) //opStreamerGroup.POST("create", middleware.JSONParamValidator(streamerproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateStreamer) opStreamerGroup.POST("update", middleware.JSONParamValidator(streamerproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateStreamer) //opStreamerGroup.POST("delete", middleware.JSONParamValidator(streamerproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteStreamer) opStreamerGroup.POST("list_by_mid", middleware.JSONParamValidator(streamerproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetStreamerListByMid) opStreamerGroup.POST("list_ext_by_mid", middleware.JSONParamValidator(streamerproto.OpListExtByMidReq{}), middleware.JwtAuthenticator(), OpGetStreamerExtListByMid) opStreamerGroup.POST("list_ext_by_mids", middleware.JSONParamValidator(streamerproto.OpListExtByMidsReq{}), middleware.JwtAuthenticator(), OpGetStreamerExtListByMids) opStreamerGroup.POST("list_ext_by_user_id", middleware.JSONParamValidator(streamerproto.OpListExtByUserIdReq{}), OpGetStreamerExtListByUserId) opStreamerGroup.POST("list_ext_fuzzily_by_user_id", middleware.JSONParamValidator(streamerproto.OpListExtFuzzilyByUserIdReq{}), middleware.JwtAuthenticator(), OpGetStreamerExtListFuzzilyByUserId) opStreamerGroup.POST("list_ext_fuzzily_by_name", middleware.JSONParamValidator(streamerproto.OpListExtFuzzilyByNameReq{}), middleware.JwtAuthenticator(), OpGetStreamerExtListFuzzilyByName) opStreamerGroup.POST("list_wx_id", middleware.JSONParamValidator(streamerproto.OpListStreamerWxIdReq{}), middleware.JwtAuthenticator(), OpGetStreamerWxId) //opStreamerGroup.POST("recomm_list", middleware.JSONParamValidator(streamerproto.OpRecommListReq{}), middleware.JwtAuthenticator(), OpGetStreamerRecommList) // 意见反馈 opFeedbackGroup := r.Group("/op/feedback", PrepareOp()) //opFeedbackGroup.POST("create", middleware.JSONParamValidator(feedbackproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateFeedback) opFeedbackGroup.POST("update", middleware.JSONParamValidator(feedbackproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateFeedback) //opFeedbackGroup.POST("delete", middleware.JSONParamValidator(feedbackproto.OpDeleteReq{}),middleware.JwtAuthenticator(), OpDeleteFeedback) opFeedbackGroup.POST("list", middleware.JSONParamValidator(feedbackproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetFeedbackList) // 通话记录 opCallHistoryGroup := r.Group("/op/call_history", PrepareOp()) opCallHistoryGroup.POST("create", middleware.JSONParamValidator(callhistoryproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateCallHistory) //opCallHistoryGroup.POST("update", middleware.JSONParamValidator(callhistoryproto.OpUpdateReq{}),middleware.JwtAuthenticator(), OpUpdateCallHistory) //opCallHistoryGroup.POST("delete", middleware.JSONParamValidator(callhistoryproto.OpDeleteReq{}),middleware.JwtAuthenticator(), OpDeleteCallHistory) opCallHistoryGroup.POST("list", middleware.JSONParamValidator(callhistoryproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetCallHistoryList) opCallHistoryGroup.POST("list_call_evaluation", middleware.JSONParamValidator(callhistoryproto.OpCallEvaluationListReq{}), middleware.JwtAuthenticator(), OpGetCallEvaluationList) opCallHistoryGroup.POST("count", middleware.JSONParamValidator(callhistoryproto.OpCountReq{}), middleware.JwtAuthenticator(), OpGetCallHistoryCount) // 主播链接 opStreamerLinkGroup := r.Group("/op/streamer_link", PrepareOp()) opStreamerLinkGroup.POST("list_by_mid", middleware.JSONParamValidator(streamerlinkproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetStreamerLinkListByMid) // 用户微信添加审核 opUserWxAddCheckGroup := r.Group("/op/user_wx_add_check", PrepareOp()) opUserWxAddCheckGroup.POST("create", middleware.JSONParamValidator(userwxaddcheckproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateUserWxAddCheck) opUserWxAddCheckGroup.POST("update", middleware.JSONParamValidator(userwxaddcheckproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateUserWxAddCheck) opUserWxAddCheckGroup.POST("delete", middleware.JSONParamValidator(userwxaddcheckproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteUserWxAddCheck) opUserWxAddCheckGroup.POST("list", middleware.JSONParamValidator(userwxaddcheckproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetUserWxAddCheckList) // 实名认证 opRealNameAuthenticationGroup := r.Group("/op/realname_authentication", PrepareOp()) //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{}), 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{}), 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{}), 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{}), 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()) opImageAuditTaskGroup.POST("list", middleware.JSONParamValidator(imageaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetImageAuditTaskList) opImageAuditTaskGroup.POST("pass_batch", middleware.JSONParamValidator(imageaudittaskproto.OpPassBatchReq{}), middleware.JwtAuthenticator(), OpPassImageAuditTaskBatch) // 文字审核任务 opTextAuditTaskGroup := r.Group("/op/text_audit_task", PrepareOp()) opTextAuditTaskGroup.POST("list", middleware.JSONParamValidator(textaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetTextAuditTaskList) opTextAuditTaskGroup.POST("pass_batch", middleware.JSONParamValidator(textaudittaskproto.OpPassBatchReq{}), middleware.JwtAuthenticator(), OpPassTextAuditTaskBatch) // 动态审核任务表 opMomentAuditTaskGroup := r.Group("/op/moment_audit_task", PrepareOp()) opMomentAuditTaskGroup.POST("list", middleware.JSONParamValidator(moment_audit_taskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetMomentAuditTaskList) // 媒体相关 mediaGroup := r.Group("/api/media", PrepareToC()) mediaGroup.POST("auth", middleware.JSONParamValidator(mediaproto.MediaAuthReq{}), middleware.JwtAuthenticator(), MediaAuth) mediaGroup.POST("c_upload", middleware.JSONParamValidator(mediaproto.CUploadReq{}), middleware.JwtAuthenticator(), CUpload) opMediaGroup := r.Group("/op/media", PrepareToC()) opMediaGroup.POST("get_videos_by_status", middleware.JSONParamValidator(mediaproto.OpGetVideosByStatusReq{}), OpGetVideosByStatus) opMediaGroup.POST("update_video_compress", middleware.JSONParamValidator(mediaproto.OpUpdateVideoCompressReq{}), OpUpdateVideoCompress) // 主播标签 opStreamerTagGroup := r.Group("/op/streamer_tag", PrepareOp()) opStreamerTagGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetStreamerTagList) // 平台icon opPlatformGroup := r.Group("/op/platform", PrepareOp()) opPlatformGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetPlatformList) // 运营微信 opSupportWxIdGroup := r.Group("/op/support_wx_id", PrepareOp()) opSupportWxIdGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetSupportWxIdList) // 上传媒体失败配置 opUploadMediaFailConfig := r.Group("/op/upload_media_fail_config", PrepareOp()) opUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetUploadMediaFailConfigList) // 每日报表表 opDailyStatementGroup := r.Group("/op/daily_statement", PrepareOp()) opDailyStatementGroup.POST("list", middleware.JSONParamValidator(daily_statementproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDailyStatementList) // 应用配置表 opAppConfigGroup := r.Group("/op/app_config", PrepareOp()) opAppConfigGroup.POST("update", middleware.JSONParamValidator(appconfigproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateAppConfig) opAppConfigGroup.POST("list_by_key", middleware.JSONParamValidator(appconfigproto.OpListByKeyReq{}), middleware.JwtAuthenticator(), OpGetAppConfigListByKey) // 账号处罚 opAccountPunishmentGroup := r.Group("/op/account_punishment", PrepareOp()) opAccountPunishmentGroup.POST("create", middleware.JSONParamValidator(accountpunishmentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateAccountPunishment) opAccountPunishmentGroup.POST("list", middleware.JSONParamValidator(accountpunishmentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetAccountPunishmentList) opAccountPunishmentGroup.POST("unblock", middleware.JSONParamValidator(accountpunishmentproto.OpUnblockReq{}), middleware.JwtAuthenticator(), OpUnblockAccountPunishment) opAccountPunishmentGroup.POST("list_terminated", middleware.JSONParamValidator(accountpunishmentproto.OpListTerminatedReq{}), middleware.JwtAuthenticator(), OpGetTerminatedAccountPunishmentList) // 账户注销 opAccountCancellationGroup := r.Group("/op/account_cancellation", PrepareOp()) opAccountCancellationGroup.POST("list", middleware.JSONParamValidator(account_cancellationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetAccountCancellationList) // 空间 opZoneGroup := r.Group("/op/zone", PrepareOp()) opZoneGroup.POST("create", middleware.JSONParamValidator(zoneproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateZone) opZoneGroup.POST("update", middleware.JSONParamValidator(zoneproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZone) opZoneGroup.POST("delete", middleware.JSONParamValidator(zoneproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZone) opZoneGroup.POST("list", middleware.JSONParamValidator(zoneproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneList) opZoneGroup.POST("list_by_user_id", middleware.JSONParamValidator(zoneproto.OpListByUserIdReq{}), middleware.JwtAuthenticator(), OpGetZoneListByUserId) opZoneGroup.POST("unlock_third_partners", middleware.JSONParamValidator(zoneproto.OpZoneUnlockThirdPartnersParam{}), OpZoneUnlockThirdPartners) opZoneGroup.POST("unlock_collaborators", middleware.JSONParamValidator(zoneproto.OpZoneUnlockCollaboratorsParam{}), OpZoneUnlockCollaborators) // 私密圈动态 opZoneMomentGroup := r.Group("/op/zone_moment", PrepareOp()) opZoneMomentGroup.POST("create", middleware.JSONParamValidator(zonemomentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateZoneMoment) opZoneMomentGroup.POST("update", middleware.JSONParamValidator(zonemomentproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZoneMoment) opZoneMomentGroup.POST("delete", middleware.JSONParamValidator(zonemomentproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneMoment) opZoneMomentGroup.POST("list", middleware.JSONParamValidator(zonemomentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentList) opZoneMomentGroup.POST("list_by_user_id", middleware.JSONParamValidator(zonemomentproto.OpListByUserIdReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentListByUserId) opZoneMomentGroup.POST("review", middleware.JSONParamValidator(zonemomentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewZoneMoment) opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment) opZoneMomentGroup.POST("set_private", middleware.JSONParamValidator(zonemomentproto.OpSetPrivateReq{}), middleware.JwtAuthenticator(), OpSetPrivateZoneMoment) // 空间代运营表 opZoneThirdPartnerGroup := r.Group("/op/zone_third_partner", PrepareOp()) opZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner) opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), OpGetZoneThirdPartnerList) // 空间相关每日报表 opDailyStatementZoneInfoGroup := r.Group("/op/daily_statement_zone_info", PrepareOp()) opDailyStatementZoneInfoGroup.POST("list", middleware.JSONParamValidator(daily_statement_zone_info_proto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDailyStatementZoneInfoList) } func ServeFile(ctx *gin.Context) { ctx.File("/Users/erwin/wishpal/wishpal-live-service/app/mix/conf/index.html") } func ReplyOk(ctx *gin.Context, data any) { ctx.JSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeSuccess, ErrCode: consts.ErrorCodeSuccess, Data: data, }) } func ReplyErrorMsg(ctx *gin.Context, msg string) { ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeFail, ErrCode: consts.ErrorCodeFail, Msg: msg, }) } func ReplyErrCodeMsg(ctx *gin.Context, ec errcode.ErrCode) { ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeFail, ErrCode: ec, Msg: errcode.ErrCodeMsgMap[ec], }) } func ReplyErrCodeMsgAndDetail(ctx *gin.Context, ec errcode.ErrCode, params ...any) { ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeFail, ErrCode: ec, Msg: fmt.Sprintf(errcode.ErrCodeMsgMap[ec], params...), }) } func ReplyJsonError(ctx *gin.Context, code int, msg string) { ctx.AbortWithStatusJSON(code, base.BaseResponse{ Ret: consts.RetCodeFail, Msg: msg, }) } func PrepareOp() gin.HandlerFunc { return func(ctx *gin.Context) { //if ctx.ClientIP() != "127.0.0.1" { // ReplyJsonError(ctx, http.StatusBadRequest, fmt.Sprintf("not localhost, ip: %s", ctx.ClientIP())) // return //} // if !wsign.CheckSignature(ctx) { // ReplyErrCodeMsg(ctx, errcode.ErrCodeCheckSignatureFail) // return // } var bodyParam map[string]interface{} buf, err := ioutil.ReadAll(ctx.Request.Body) err = json.Unmarshal(buf, &bodyParam) if err != nil { logger.Error("arg parse fail: %v", err) ReplyJsonError(ctx, http.StatusBadRequest, "参数解析失败") return } buf, err = json.Marshal(&bodyParam) ctx.Set(gin.BodyBytesKey, buf) } } func Prepare() gin.HandlerFunc { return func(ctx *gin.Context) { if ctx.ClientIP() != "127.0.0.1" { ReplyJsonError(ctx, http.StatusBadRequest, fmt.Sprintf("not localhost, ip: %s", ctx.ClientIP())) return } var bodyParam map[string]interface{} buf, err := ioutil.ReadAll(ctx.Request.Body) err = json.Unmarshal(buf, &bodyParam) if err != nil { logger.Error("arg parse fail: %v", err) ReplyJsonError(ctx, http.StatusBadRequest, "参数解析失败") return } buf, err = json.Marshal(&bodyParam) ctx.Set(gin.BodyBytesKey, buf) } } func PrepareToC() gin.HandlerFunc { return func(ctx *gin.Context) { // if !wsign.CheckSignature(ctx) { // ReplyErrCodeMsg(ctx, errcode.ErrCodeCheckSignatureFail) // return // } var bodyParam map[string]interface{} buf, err := ioutil.ReadAll(ctx.Request.Body) err = json.Unmarshal(buf, &bodyParam) if err != nil { logger.Error("arg parse fail: %v", err) ReplyJsonError(ctx, http.StatusBadRequest, "参数解析失败") return } buf, err = json.Marshal(&bodyParam) ctx.Set(gin.BodyBytesKey, buf) } } func PrepareExt() gin.HandlerFunc { return func(ctx *gin.Context) { var bodyParam map[string]interface{} buf, err := ioutil.ReadAll(ctx.Request.Body) err = json.Unmarshal(buf, &bodyParam) if err != nil { logger.Error("arg parse fail: %v", err) ReplyJsonError(ctx, http.StatusBadRequest, "参数解析失败") return } buf, err = json.Marshal(&bodyParam) ctx.Set(gin.BodyBytesKey, buf) } } var upGrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, } func WsHandle(c *gin.Context) { //升级get请求为webSocket协议 ws, err := upGrader.Upgrade(c.Writer, c.Request, nil) if err != nil { c.Writer.Write([]byte(err.Error())) return } defer ws.Close() for { //读取ws中的数据 mt, message, err := ws.ReadMessage() if err != nil { c.Writer.Write([]byte(err.Error())) break } fmt.Println("client message " + string(message)) //写入ws数据 err = ws.WriteMessage(mt, []byte(time.Now().String())) if err != nil { break } fmt.Println("system message " + time.Now().String()) } }