From 8b11068fef526de27e6e141bd5b92d938e3d6a61 Mon Sep 17 00:00:00 2001 From: Blizzard Date: Fri, 1 May 2026 01:19:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20rbac=E8=BF=81=E7=A7=BB=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E5=B9=B6=E5=B7=B2=E9=83=A8=E7=BD=B2=E8=87=B3?= =?UTF-8?q?dev=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 9 + .idea/go.imports.xml | 10 + .idea/modules.xml | 8 + .idea/sundynix-micro-go.iml | 9 + .idea/vcs.xml | 6 + .run/auth-api.run.xml | 10 + .run/file-api.run.xml | 10 + .run/file-rpc.run.xml | 10 + .run/gateway.run.xml | 10 + .run/plant-api.run.xml | 10 + .run/plant-rpc.run.xml | 10 + .run/system-api.run.xml | 10 + .run/system-rpc.run.xml | 10 + .run/zero-gateway.run.xml | 10 + app/{user/api/user.api => auth/api/auth.api} | 37 +- app/{user/api/user.go => auth/api/auth.go} | 10 +- app/auth/api/etc/auth-api.yaml | 23 + .../api/internal/config/config.go | 10 +- .../handler/auth/getCaptchaHandler.go | 22 + .../handler/auth/loginByPhoneHandler.go | 6 +- .../api/internal/handler/auth/loginHandler.go | 10 +- .../internal/handler/auth/miniLoginHandler.go | 6 +- .../api/internal/handler/routes.go | 34 +- .../handler/user/changePasswordHandler.go | 6 +- .../handler/user/getLocationHandler.go | 6 +- .../handler/user/getUserInfoHandler.go | 4 +- .../handler/user/getWeatherHandler.go | 6 +- .../handler/user/updateUserHandler.go | 6 +- .../internal/logic/auth/getCaptchaLogic.go | 33 + .../internal/logic/auth/loginByPhoneLogic.go | 30 +- .../api/internal/logic/auth/loginLogic.go | 115 + .../api/internal/logic/auth/miniLoginLogic.go | 29 +- .../logic/user/changePasswordLogic.go | 4 +- .../internal/logic/user/getLocationLogic.go | 4 +- .../internal/logic/user/getUserInfoLogic.go | 114 + .../internal/logic/user/getWeatherLogic.go | 4 +- .../internal/logic/user/updateUserLogic.go | 8 +- app/auth/api/internal/svc/serviceContext.go | 32 + .../api/internal/types/types.go | 11 +- app/{user => auth}/model/user_model.go | 0 app/file/api/file.api | 2 +- app/file/api/file.go | 2 + app/file/rpc/file.go | 2 + app/gateway/etc/gateway.yaml | 31 +- app/gateway/gateway.go | 23 +- app/gateway/internal/config/config.go | 14 +- app/gateway/internal/handler/proxy.go | 36 +- app/gateway/internal/middleware/auth.go | 140 + app/gateway/internal/middleware/cors.go | 2 + .../internal/middleware/operationLog.go | 172 + app/plant/api/internal/svc/serviceContext.go | 6 +- app/plant/api/plant.api | 10 +- app/plant/api/plant.go | 2 + app/plant/rpc/plant.go | 2 + app/radio/api/etc/radio-api.yaml | 28 - app/radio/api/internal/config/config.go | 20 - .../analytics/getAnalyticsOverviewHandler.go | 33 - .../analytics/getChannelAnalyticsHandler.go | 33 - .../analytics/getUserAnalyticsHandler.go | 33 - .../callback/wechatPayCallbackHandler.go | 25 - .../handler/category/createCategoryHandler.go | 33 - .../handler/category/deleteCategoryHandler.go | 33 - .../category/getCategoryListHandler.go | 33 - .../handler/category/updateCategoryHandler.go | 33 - .../handler/channel/createChannelHandler.go | 33 - .../handler/channel/deleteChannelHandler.go | 33 - .../channel/getChannelDetailHandler.go | 33 - .../handler/channel/getChannelListHandler.go | 33 - .../handler/channel/updateChannelHandler.go | 33 - .../interaction/commentProgramHandler.go | 33 - .../interaction/getFavoriteListHandler.go | 33 - .../interaction/getHistoryListHandler.go | 33 - .../interaction/recordHistoryHandler.go | 33 - .../interaction/toggleFavoriteHandler.go | 33 - .../handler/interaction/toggleLikeHandler.go | 33 - .../handler/pay/createPayOrderHandler.go | 33 - .../handler/program/createProgramHandler.go | 33 - .../handler/program/deleteProgramHandler.go | 33 - .../handler/program/generateTtsHandler.go | 33 - .../program/getProgramDetailHandler.go | 33 - .../handler/program/getProgramListHandler.go | 33 - .../handler/program/updateProgramHandler.go | 33 - app/radio/api/internal/handler/routes.go | 291 -- .../subscription/getMySubscriptionsHandler.go | 25 - .../handler/vip/getMyVipInfoHandler.go | 25 - .../handler/vip/getVipConfigListHandler.go | 33 - .../handler/voice/createVoiceHandler.go | 33 - .../handler/voice/deleteVoiceHandler.go | 33 - .../handler/voice/getVoiceListHandler.go | 33 - .../handler/voice/updateVoiceHandler.go | 33 - .../analytics/getAnalyticsOverviewLogic.go | 34 - .../analytics/getChannelAnalyticsLogic.go | 34 - .../logic/analytics/getUserAnalyticsLogic.go | 34 - .../logic/callback/wechatPayCallbackLogic.go | 32 - .../logic/category/createCategoryLogic.go | 34 - .../logic/category/deleteCategoryLogic.go | 34 - .../logic/category/getCategoryListLogic.go | 34 - .../logic/category/updateCategoryLogic.go | 34 - .../logic/channel/createChannelLogic.go | 34 - .../logic/channel/deleteChannelLogic.go | 34 - .../logic/channel/getChannelDetailLogic.go | 34 - .../logic/channel/getChannelListLogic.go | 34 - .../logic/channel/updateChannelLogic.go | 34 - .../logic/interaction/commentProgramLogic.go | 34 - .../logic/interaction/getFavoriteListLogic.go | 34 - .../logic/interaction/getHistoryListLogic.go | 34 - .../logic/interaction/recordHistoryLogic.go | 34 - .../logic/interaction/toggleFavoriteLogic.go | 34 - .../logic/interaction/toggleLikeLogic.go | 34 - .../internal/logic/pay/createPayOrderLogic.go | 34 - .../logic/program/createProgramLogic.go | 34 - .../logic/program/deleteProgramLogic.go | 34 - .../logic/program/generateTtsLogic.go | 34 - .../logic/program/getProgramDetailLogic.go | 34 - .../logic/program/getProgramListLogic.go | 34 - .../logic/program/updateProgramLogic.go | 34 - .../subscription/getMySubscriptionsLogic.go | 32 - .../internal/logic/vip/getMyVipInfoLogic.go | 32 - .../logic/vip/getVipConfigListLogic.go | 34 - .../internal/logic/voice/createVoiceLogic.go | 34 - .../internal/logic/voice/deleteVoiceLogic.go | 34 - .../internal/logic/voice/getVoiceListLogic.go | 34 - .../internal/logic/voice/updateVoiceLogic.go | 34 - app/radio/api/internal/svc/serviceContext.go | 29 - app/radio/api/internal/types/types.go | 180 - app/radio/api/radio.api | 377 -- app/radio/api/radio.go | 34 - app/radio/model/radio_model.go | 230 -- app/radio/rpc/internal/config/config.go | 10 - .../rpc/internal/logic/commentProgramLogic.go | 30 - .../rpc/internal/logic/createCategoryLogic.go | 31 - .../rpc/internal/logic/createChannelLogic.go | 31 - .../rpc/internal/logic/createPayOrderLogic.go | 30 - .../rpc/internal/logic/createProgramLogic.go | 31 - .../rpc/internal/logic/createVoiceLogic.go | 31 - .../rpc/internal/logic/deleteCategoryLogic.go | 30 - .../rpc/internal/logic/deleteChannelLogic.go | 30 - .../rpc/internal/logic/deleteProgramLogic.go | 30 - .../rpc/internal/logic/deleteVoiceLogic.go | 30 - .../logic/getAnalyticsOverviewLogic.go | 31 - .../internal/logic/getCategoryListLogic.go | 30 - .../logic/getChannelAnalyticsLogic.go | 30 - .../internal/logic/getChannelDetailLogic.go | 30 - .../rpc/internal/logic/getChannelListLogic.go | 30 - .../internal/logic/getFavoriteListLogic.go | 30 - .../rpc/internal/logic/getHistoryListLogic.go | 30 - .../internal/logic/getMySubscriptionsLogic.go | 31 - .../rpc/internal/logic/getMyVipInfoLogic.go | 30 - .../internal/logic/getProgramDetailLogic.go | 30 - .../rpc/internal/logic/getProgramListLogic.go | 30 - .../internal/logic/getUserAnalyticsLogic.go | 30 - .../rpc/internal/logic/getUserProfileLogic.go | 31 - .../internal/logic/getVipConfigListLogic.go | 30 - .../rpc/internal/logic/getVoiceListLogic.go | 30 - .../rpc/internal/logic/recordHistoryLogic.go | 30 - .../rpc/internal/logic/toggleFavoriteLogic.go | 30 - .../rpc/internal/logic/toggleLikeLogic.go | 31 - .../rpc/internal/logic/updateCategoryLogic.go | 30 - .../rpc/internal/logic/updateChannelLogic.go | 30 - .../rpc/internal/logic/updateProgramLogic.go | 30 - .../rpc/internal/logic/updateVoiceLogic.go | 30 - .../rpc/internal/server/radioServiceServer.go | 192 - app/radio/rpc/internal/svc/serviceContext.go | 44 - app/radio/rpc/pb/radio.proto | 397 -- app/radio/rpc/radio.go | 39 - app/radio/rpc/radio/radio.pb.go | 3585 ----------------- app/radio/rpc/radio/radio_grpc.pb.go | 1315 ------ app/radio/rpc/radioservice/radioService.go | 282 -- app/system/api/etc/system-api.yaml | 2 +- app/system/api/internal/handler/routes.go | 56 +- .../handler/user/createUserHandler.go | 27 + .../handler/user/deleteUserHandler.go | 14 +- .../handler/user/getUserListHandler.go | 15 +- .../handler/user/resetPasswordHandler.go | 27 + .../handler/user/updateUserHandler.go | 27 + .../internal/logic/user/createUserLogic.go | 31 + .../internal/logic/user/deleteUserLogic.go | 20 +- .../internal/logic/user/getUserListLogic.go | 46 + .../internal/logic/user/resetPasswordLogic.go | 29 + .../internal/logic/user/updateUserLogic.go | 32 + app/system/api/internal/svc/serviceContext.go | 3 - app/system/api/internal/types/types.go | 30 + app/system/api/system.api | 72 +- app/system/api/system.go | 2 + app/system/model/system_model.go | 47 +- .../logic/createOperationRecordLogic.go | 45 + .../rpc/internal/logic/createRoleLogic.go | 27 +- .../rpc/internal/logic/createUserLogic.go | 62 + .../rpc/internal/logic/deleteMenuLogic.go | 19 +- .../rpc/internal/logic/deleteRoleLogic.go | 19 +- .../rpc/internal/logic/deleteUserLogic.go | 39 + .../rpc/internal/logic/getClientByIdLogic.go | 6 +- .../rpc/internal/logic/getMenuListLogic.go | 7 +- .../internal/logic/getMenusByRoleIdLogic.go | 3 +- .../logic/getOperationRecordListLogic.go | 18 +- .../rpc/internal/logic/getUserByIdLogic.go | 36 + .../internal/logic/getUserByOpenIdLogic.go | 36 + .../rpc/internal/logic/getUserListLogic.go | 51 + .../rpc/internal/logic/loginByAccountLogic.go | 48 + .../rpc/internal/logic/resetPasswordLogic.go | 30 + .../rpc/internal/logic/updateRoleLogic.go | 34 +- .../rpc/internal/logic/updateUserLogic.go | 44 + app/system/rpc/internal/logic/userHelper.go | 31 + .../internal/server/systemServiceServer.go | 46 + app/system/rpc/internal/svc/serviceContext.go | 26 +- app/system/rpc/pb/system.proto | 141 +- app/system/rpc/system.go | 2 + app/system/rpc/system/system.pb.go | 1476 ++++++- app/system/rpc/system/system_grpc.pb.go | 344 ++ app/system/rpc/systemservice/systemService.go | 133 +- .../api/internal/logic/auth/loginLogic.go | 68 - .../internal/logic/user/getUserInfoLogic.go | 55 - .../internal/logic/user/getUserListLogic.go | 34 - app/user/api/internal/svc/serviceContext.go | 23 - app/user/rpc/etc/user.yaml | 29 - app/user/rpc/internal/config/config.go | 23 - .../rpc/internal/logic/createUserLogic.go | 81 - .../rpc/internal/logic/getUserByIdLogic.go | 70 - .../internal/logic/getUserByOpenIdLogic.go | 45 - .../rpc/internal/logic/updateUserLogic.go | 64 - .../rpc/internal/logic/verifyTokenLogic.go | 52 - .../rpc/internal/server/userServiceServer.go | 54 - app/user/rpc/internal/svc/serviceContext.go | 52 - app/user/rpc/pb/user.proto | 106 - app/user/rpc/user.go | 39 - app/user/rpc/user/user.pb.go | 943 ----- app/user/rpc/user/user_grpc.pb.go | 283 -- app/user/rpc/userservice/userService.go | 81 - app/zero-gateway/etc/zero-gateway.yaml | 231 ++ app/zero-gateway/internal/config/config.go | 27 + app/zero-gateway/internal/middleware/auth.go | 142 + app/zero-gateway/internal/middleware/cors.go | 57 + .../internal/middleware/operationLog.go | 168 + app/zero-gateway/zero-gateway.go | 68 + common/utils/captcha/captcha.go | 66 + common/utils/jwt/jwt.go | 2 +- deploy/Dockerfile | 18 + deploy/build-origin.sh | 114 + deploy/build.sh | 106 + deploy/deploy-dev.sh | 66 + deploy/dev/auth-api.yaml | 23 + deploy/dev/docker-compose.yml | 61 + deploy/dev/gateway.yaml | 49 + .../dev/system-api.yaml | 11 +- .../radio.yaml => deploy/dev/system-rpc.yaml | 7 +- docs/API_DOCS.md | 1272 ++++-- go.mod | 14 + go.sum | 88 + scripts/seed_rbac.sql | 118 + scripts/start.sh | 25 +- 250 files changed, 6314 insertions(+), 13072 deletions(-) create mode 100644 .dockerignore create mode 100644 .idea/go.imports.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/sundynix-micro-go.iml create mode 100644 .idea/vcs.xml create mode 100644 .run/auth-api.run.xml create mode 100644 .run/file-api.run.xml create mode 100644 .run/file-rpc.run.xml create mode 100644 .run/gateway.run.xml create mode 100644 .run/plant-api.run.xml create mode 100644 .run/plant-rpc.run.xml create mode 100644 .run/system-api.run.xml create mode 100644 .run/system-rpc.run.xml create mode 100644 .run/zero-gateway.run.xml rename app/{user/api/user.api => auth/api/auth.api} (80%) rename app/{user/api/user.go => auth/api/auth.go} (62%) create mode 100644 app/auth/api/etc/auth-api.yaml rename app/{user => auth}/api/internal/config/config.go (64%) create mode 100644 app/auth/api/internal/handler/auth/getCaptchaHandler.go rename app/{user => auth}/api/internal/handler/auth/loginByPhoneHandler.go (81%) rename app/{user => auth}/api/internal/handler/auth/loginHandler.go (71%) rename app/{user => auth}/api/internal/handler/auth/miniLoginHandler.go (80%) rename app/{user => auth}/api/internal/handler/routes.go (72%) rename app/{user => auth}/api/internal/handler/user/changePasswordHandler.go (80%) rename app/{user => auth}/api/internal/handler/user/getLocationHandler.go (80%) rename app/{user => auth}/api/internal/handler/user/getUserInfoHandler.go (82%) rename app/{user => auth}/api/internal/handler/user/getWeatherHandler.go (80%) rename app/{user => auth}/api/internal/handler/user/updateUserHandler.go (80%) create mode 100644 app/auth/api/internal/logic/auth/getCaptchaLogic.go rename app/{user => auth}/api/internal/logic/auth/loginByPhoneLogic.go (68%) create mode 100644 app/auth/api/internal/logic/auth/loginLogic.go rename app/{user => auth}/api/internal/logic/auth/miniLoginLogic.go (74%) rename app/{user => auth}/api/internal/logic/user/changePasswordLogic.go (86%) rename app/{user => auth}/api/internal/logic/user/getLocationLogic.go (86%) create mode 100644 app/auth/api/internal/logic/user/getUserInfoLogic.go rename app/{user => auth}/api/internal/logic/user/getWeatherLogic.go (85%) rename app/{user => auth}/api/internal/logic/user/updateUserLogic.go (80%) create mode 100644 app/auth/api/internal/svc/serviceContext.go rename app/{user => auth}/api/internal/types/types.go (83%) rename app/{user => auth}/model/user_model.go (100%) create mode 100644 app/gateway/internal/middleware/auth.go create mode 100644 app/gateway/internal/middleware/operationLog.go delete mode 100644 app/radio/api/etc/radio-api.yaml delete mode 100644 app/radio/api/internal/config/config.go delete mode 100644 app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go delete mode 100644 app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go delete mode 100644 app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go delete mode 100644 app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go delete mode 100644 app/radio/api/internal/handler/category/createCategoryHandler.go delete mode 100644 app/radio/api/internal/handler/category/deleteCategoryHandler.go delete mode 100644 app/radio/api/internal/handler/category/getCategoryListHandler.go delete mode 100644 app/radio/api/internal/handler/category/updateCategoryHandler.go delete mode 100644 app/radio/api/internal/handler/channel/createChannelHandler.go delete mode 100644 app/radio/api/internal/handler/channel/deleteChannelHandler.go delete mode 100644 app/radio/api/internal/handler/channel/getChannelDetailHandler.go delete mode 100644 app/radio/api/internal/handler/channel/getChannelListHandler.go delete mode 100644 app/radio/api/internal/handler/channel/updateChannelHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/commentProgramHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/getFavoriteListHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/getHistoryListHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/recordHistoryHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go delete mode 100644 app/radio/api/internal/handler/interaction/toggleLikeHandler.go delete mode 100644 app/radio/api/internal/handler/pay/createPayOrderHandler.go delete mode 100644 app/radio/api/internal/handler/program/createProgramHandler.go delete mode 100644 app/radio/api/internal/handler/program/deleteProgramHandler.go delete mode 100644 app/radio/api/internal/handler/program/generateTtsHandler.go delete mode 100644 app/radio/api/internal/handler/program/getProgramDetailHandler.go delete mode 100644 app/radio/api/internal/handler/program/getProgramListHandler.go delete mode 100644 app/radio/api/internal/handler/program/updateProgramHandler.go delete mode 100644 app/radio/api/internal/handler/routes.go delete mode 100644 app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go delete mode 100644 app/radio/api/internal/handler/vip/getMyVipInfoHandler.go delete mode 100644 app/radio/api/internal/handler/vip/getVipConfigListHandler.go delete mode 100644 app/radio/api/internal/handler/voice/createVoiceHandler.go delete mode 100644 app/radio/api/internal/handler/voice/deleteVoiceHandler.go delete mode 100644 app/radio/api/internal/handler/voice/getVoiceListHandler.go delete mode 100644 app/radio/api/internal/handler/voice/updateVoiceHandler.go delete mode 100644 app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go delete mode 100644 app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go delete mode 100644 app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go delete mode 100644 app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go delete mode 100644 app/radio/api/internal/logic/category/createCategoryLogic.go delete mode 100644 app/radio/api/internal/logic/category/deleteCategoryLogic.go delete mode 100644 app/radio/api/internal/logic/category/getCategoryListLogic.go delete mode 100644 app/radio/api/internal/logic/category/updateCategoryLogic.go delete mode 100644 app/radio/api/internal/logic/channel/createChannelLogic.go delete mode 100644 app/radio/api/internal/logic/channel/deleteChannelLogic.go delete mode 100644 app/radio/api/internal/logic/channel/getChannelDetailLogic.go delete mode 100644 app/radio/api/internal/logic/channel/getChannelListLogic.go delete mode 100644 app/radio/api/internal/logic/channel/updateChannelLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/commentProgramLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/getFavoriteListLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/getHistoryListLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/recordHistoryLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go delete mode 100644 app/radio/api/internal/logic/interaction/toggleLikeLogic.go delete mode 100644 app/radio/api/internal/logic/pay/createPayOrderLogic.go delete mode 100644 app/radio/api/internal/logic/program/createProgramLogic.go delete mode 100644 app/radio/api/internal/logic/program/deleteProgramLogic.go delete mode 100644 app/radio/api/internal/logic/program/generateTtsLogic.go delete mode 100644 app/radio/api/internal/logic/program/getProgramDetailLogic.go delete mode 100644 app/radio/api/internal/logic/program/getProgramListLogic.go delete mode 100644 app/radio/api/internal/logic/program/updateProgramLogic.go delete mode 100644 app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go delete mode 100644 app/radio/api/internal/logic/vip/getMyVipInfoLogic.go delete mode 100644 app/radio/api/internal/logic/vip/getVipConfigListLogic.go delete mode 100644 app/radio/api/internal/logic/voice/createVoiceLogic.go delete mode 100644 app/radio/api/internal/logic/voice/deleteVoiceLogic.go delete mode 100644 app/radio/api/internal/logic/voice/getVoiceListLogic.go delete mode 100644 app/radio/api/internal/logic/voice/updateVoiceLogic.go delete mode 100644 app/radio/api/internal/svc/serviceContext.go delete mode 100644 app/radio/api/internal/types/types.go delete mode 100644 app/radio/api/radio.api delete mode 100644 app/radio/api/radio.go delete mode 100644 app/radio/model/radio_model.go delete mode 100755 app/radio/rpc/internal/config/config.go delete mode 100644 app/radio/rpc/internal/logic/commentProgramLogic.go delete mode 100644 app/radio/rpc/internal/logic/createCategoryLogic.go delete mode 100644 app/radio/rpc/internal/logic/createChannelLogic.go delete mode 100644 app/radio/rpc/internal/logic/createPayOrderLogic.go delete mode 100644 app/radio/rpc/internal/logic/createProgramLogic.go delete mode 100644 app/radio/rpc/internal/logic/createVoiceLogic.go delete mode 100644 app/radio/rpc/internal/logic/deleteCategoryLogic.go delete mode 100644 app/radio/rpc/internal/logic/deleteChannelLogic.go delete mode 100644 app/radio/rpc/internal/logic/deleteProgramLogic.go delete mode 100644 app/radio/rpc/internal/logic/deleteVoiceLogic.go delete mode 100644 app/radio/rpc/internal/logic/getAnalyticsOverviewLogic.go delete mode 100644 app/radio/rpc/internal/logic/getCategoryListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getChannelAnalyticsLogic.go delete mode 100644 app/radio/rpc/internal/logic/getChannelDetailLogic.go delete mode 100644 app/radio/rpc/internal/logic/getChannelListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getFavoriteListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getHistoryListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getMySubscriptionsLogic.go delete mode 100644 app/radio/rpc/internal/logic/getMyVipInfoLogic.go delete mode 100644 app/radio/rpc/internal/logic/getProgramDetailLogic.go delete mode 100644 app/radio/rpc/internal/logic/getProgramListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getUserAnalyticsLogic.go delete mode 100644 app/radio/rpc/internal/logic/getUserProfileLogic.go delete mode 100644 app/radio/rpc/internal/logic/getVipConfigListLogic.go delete mode 100644 app/radio/rpc/internal/logic/getVoiceListLogic.go delete mode 100644 app/radio/rpc/internal/logic/recordHistoryLogic.go delete mode 100644 app/radio/rpc/internal/logic/toggleFavoriteLogic.go delete mode 100644 app/radio/rpc/internal/logic/toggleLikeLogic.go delete mode 100644 app/radio/rpc/internal/logic/updateCategoryLogic.go delete mode 100644 app/radio/rpc/internal/logic/updateChannelLogic.go delete mode 100644 app/radio/rpc/internal/logic/updateProgramLogic.go delete mode 100644 app/radio/rpc/internal/logic/updateVoiceLogic.go delete mode 100644 app/radio/rpc/internal/server/radioServiceServer.go delete mode 100644 app/radio/rpc/internal/svc/serviceContext.go delete mode 100644 app/radio/rpc/pb/radio.proto delete mode 100644 app/radio/rpc/radio.go delete mode 100644 app/radio/rpc/radio/radio.pb.go delete mode 100644 app/radio/rpc/radio/radio_grpc.pb.go delete mode 100644 app/radio/rpc/radioservice/radioService.go create mode 100644 app/system/api/internal/handler/user/createUserHandler.go rename app/{user => system}/api/internal/handler/user/deleteUserHandler.go (63%) rename app/{user => system}/api/internal/handler/user/getUserListHandler.go (64%) create mode 100644 app/system/api/internal/handler/user/resetPasswordHandler.go create mode 100644 app/system/api/internal/handler/user/updateUserHandler.go create mode 100644 app/system/api/internal/logic/user/createUserLogic.go rename app/{user => system}/api/internal/logic/user/deleteUserLogic.go (50%) create mode 100644 app/system/api/internal/logic/user/getUserListLogic.go create mode 100644 app/system/api/internal/logic/user/resetPasswordLogic.go create mode 100644 app/system/api/internal/logic/user/updateUserLogic.go create mode 100644 app/system/rpc/internal/logic/createOperationRecordLogic.go create mode 100644 app/system/rpc/internal/logic/createUserLogic.go create mode 100644 app/system/rpc/internal/logic/deleteUserLogic.go create mode 100644 app/system/rpc/internal/logic/getUserByIdLogic.go create mode 100644 app/system/rpc/internal/logic/getUserByOpenIdLogic.go create mode 100644 app/system/rpc/internal/logic/getUserListLogic.go create mode 100644 app/system/rpc/internal/logic/loginByAccountLogic.go create mode 100644 app/system/rpc/internal/logic/resetPasswordLogic.go create mode 100644 app/system/rpc/internal/logic/updateUserLogic.go create mode 100644 app/system/rpc/internal/logic/userHelper.go delete mode 100644 app/user/api/internal/logic/auth/loginLogic.go delete mode 100644 app/user/api/internal/logic/user/getUserInfoLogic.go delete mode 100644 app/user/api/internal/logic/user/getUserListLogic.go delete mode 100644 app/user/api/internal/svc/serviceContext.go delete mode 100644 app/user/rpc/etc/user.yaml delete mode 100755 app/user/rpc/internal/config/config.go delete mode 100644 app/user/rpc/internal/logic/createUserLogic.go delete mode 100644 app/user/rpc/internal/logic/getUserByIdLogic.go delete mode 100644 app/user/rpc/internal/logic/getUserByOpenIdLogic.go delete mode 100644 app/user/rpc/internal/logic/updateUserLogic.go delete mode 100644 app/user/rpc/internal/logic/verifyTokenLogic.go delete mode 100644 app/user/rpc/internal/server/userServiceServer.go delete mode 100644 app/user/rpc/internal/svc/serviceContext.go delete mode 100644 app/user/rpc/pb/user.proto delete mode 100644 app/user/rpc/user.go delete mode 100644 app/user/rpc/user/user.pb.go delete mode 100644 app/user/rpc/user/user_grpc.pb.go delete mode 100644 app/user/rpc/userservice/userService.go create mode 100644 app/zero-gateway/etc/zero-gateway.yaml create mode 100644 app/zero-gateway/internal/config/config.go create mode 100644 app/zero-gateway/internal/middleware/auth.go create mode 100644 app/zero-gateway/internal/middleware/cors.go create mode 100644 app/zero-gateway/internal/middleware/operationLog.go create mode 100644 app/zero-gateway/zero-gateway.go create mode 100644 common/utils/captcha/captcha.go create mode 100644 deploy/Dockerfile create mode 100755 deploy/build-origin.sh create mode 100755 deploy/build.sh create mode 100755 deploy/deploy-dev.sh create mode 100644 deploy/dev/auth-api.yaml create mode 100644 deploy/dev/docker-compose.yml create mode 100644 deploy/dev/gateway.yaml rename app/user/api/etc/user-api.yaml => deploy/dev/system-api.yaml (60%) rename app/radio/rpc/etc/radio.yaml => deploy/dev/system-rpc.yaml (73%) create mode 100644 scripts/seed_rbac.sql diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eead2b9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitignore +.idea +.vscode +deploy +docs +*.md +*.yaml +*.yml diff --git a/.idea/go.imports.xml b/.idea/go.imports.xml new file mode 100644 index 0000000..644cdf0 --- /dev/null +++ b/.idea/go.imports.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..684d969 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sundynix-micro-go.iml b/.idea/sundynix-micro-go.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/sundynix-micro-go.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.run/auth-api.run.xml b/.run/auth-api.run.xml new file mode 100644 index 0000000..61b1b93 --- /dev/null +++ b/.run/auth-api.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/file-api.run.xml b/.run/file-api.run.xml new file mode 100644 index 0000000..ac42353 --- /dev/null +++ b/.run/file-api.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/file-rpc.run.xml b/.run/file-rpc.run.xml new file mode 100644 index 0000000..7577e42 --- /dev/null +++ b/.run/file-rpc.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/gateway.run.xml b/.run/gateway.run.xml new file mode 100644 index 0000000..0ae51cf --- /dev/null +++ b/.run/gateway.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/plant-api.run.xml b/.run/plant-api.run.xml new file mode 100644 index 0000000..9232625 --- /dev/null +++ b/.run/plant-api.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/plant-rpc.run.xml b/.run/plant-rpc.run.xml new file mode 100644 index 0000000..1720f01 --- /dev/null +++ b/.run/plant-rpc.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/system-api.run.xml b/.run/system-api.run.xml new file mode 100644 index 0000000..ec5134c --- /dev/null +++ b/.run/system-api.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/system-rpc.run.xml b/.run/system-rpc.run.xml new file mode 100644 index 0000000..9dac35d --- /dev/null +++ b/.run/system-rpc.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.run/zero-gateway.run.xml b/.run/zero-gateway.run.xml new file mode 100644 index 0000000..f857250 --- /dev/null +++ b/.run/zero-gateway.run.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/user/api/user.api b/app/auth/api/auth.api similarity index 80% rename from app/user/api/user.api rename to app/auth/api/auth.api index 200efae..cc737a4 100644 --- a/app/user/api/user.api +++ b/app/auth/api/auth.api @@ -21,8 +21,15 @@ type ( } // 账号密码登录 LoginReq { - Account string `json:"account"` - Password string `json:"password"` + Account string `json:"account"` + Password string `json:"password"` + CaptchaId string `json:"captchaId"` + Captcha string `json:"captcha"` + } + // 验证码响应 + CaptchaResp { + CaptchaId string `json:"captchaId"` + CaptchaImg string `json:"captchaImg"` } // 登录响应 LoginResp { @@ -70,10 +77,10 @@ type ( // ========== 无需鉴权的接口 ========== @server ( - prefix: /api/user + prefix: /api/auth group: auth ) -service user-api { +service auth-api { @doc "微信小程序登录" @handler MiniLogin post /miniLogin (MiniLoginReq) returns (LoginResp) @@ -85,34 +92,30 @@ service user-api { @doc "账号密码登录" @handler Login post /login (LoginReq) returns (LoginResp) + + @doc "获取图形验证码" + @handler GetCaptcha + get /captcha returns (CaptchaResp) } // ========== 需要鉴权的接口 ========== @server ( - prefix: /api/user + prefix: /api/auth group: user jwt: Auth ) -service user-api { +service auth-api { @doc "获取当前用户信息" @handler GetUserInfo get /info returns (LoginResp) - @doc "更新用户信息" + @doc "更新个人信息" @handler UpdateUser - put /update (UpdateUserReq) + post /update (UpdateUserReq) @doc "修改密码" @handler ChangePassword - put /changePassword (ChangePasswordReq) - - @doc "用户列表" - @handler GetUserList - post /list (UserListReq) - - @doc "删除用户" - @handler DeleteUser - delete /delete (IdsReq) + post /changePassword (ChangePasswordReq) @doc "获取位置信息" @handler GetLocation diff --git a/app/user/api/user.go b/app/auth/api/auth.go similarity index 62% rename from app/user/api/user.go rename to app/auth/api/auth.go index 958ee3d..7d1399b 100644 --- a/app/user/api/user.go +++ b/app/auth/api/auth.go @@ -7,18 +7,20 @@ import ( "flag" "fmt" - "sundynix-micro-go/app/user/api/internal/config" - "sundynix-micro-go/app/user/api/internal/handler" - "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/config" + "sundynix-micro-go/app/auth/api/internal/handler" + "sundynix-micro-go/app/auth/api/internal/svc" "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/rest" ) -var configFile = flag.String("f", "etc/user-api.yaml", "the config file") +var configFile = flag.String("f", "etc/auth-api.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() //去掉state日志 var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/auth/api/etc/auth-api.yaml b/app/auth/api/etc/auth-api.yaml new file mode 100644 index 0000000..30b79d0 --- /dev/null +++ b/app/auth/api/etc/auth-api.yaml @@ -0,0 +1,23 @@ +Name: auth-api + +Log: + Encoding: plain +Host: 0.0.0.0 +Port: 9001 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# system-rpc(统一管理用户/角色/菜单/客户端等) +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# Redis(验证码存储,DB2) +Redis: + Host: 192.168.100.127:6379 + Pass: sundynix + DB: 2 diff --git a/app/user/api/internal/config/config.go b/app/auth/api/internal/config/config.go similarity index 64% rename from app/user/api/internal/config/config.go rename to app/auth/api/internal/config/config.go index 33305c0..bdb7a31 100644 --- a/app/user/api/internal/config/config.go +++ b/app/auth/api/internal/config/config.go @@ -1,6 +1,3 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package config import ( @@ -14,5 +11,10 @@ type Config struct { AccessSecret string AccessExpire int64 } - UserRpc zrpc.RpcClientConf + SystemRpc zrpc.RpcClientConf + Redis struct { + Host string + Pass string + DB int `json:",optional"` + } } diff --git a/app/auth/api/internal/handler/auth/getCaptchaHandler.go b/app/auth/api/internal/handler/auth/getCaptchaHandler.go new file mode 100644 index 0000000..9ccf995 --- /dev/null +++ b/app/auth/api/internal/handler/auth/getCaptchaHandler.go @@ -0,0 +1,22 @@ +package auth + +import ( + "net/http" + + "sundynix-micro-go/app/auth/api/internal/logic/auth" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 获取图形验证码 +func GetCaptchaHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := auth.NewGetCaptchaLogic(r.Context(), svcCtx) + resp, err := l.GetCaptcha() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/user/api/internal/handler/auth/loginByPhoneHandler.go b/app/auth/api/internal/handler/auth/loginByPhoneHandler.go similarity index 81% rename from app/user/api/internal/handler/auth/loginByPhoneHandler.go rename to app/auth/api/internal/handler/auth/loginByPhoneHandler.go index dbdb1c7..da5c91f 100644 --- a/app/user/api/internal/handler/auth/loginByPhoneHandler.go +++ b/app/auth/api/internal/handler/auth/loginByPhoneHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/auth" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/auth" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/auth/loginHandler.go b/app/auth/api/internal/handler/auth/loginHandler.go similarity index 71% rename from app/user/api/internal/handler/auth/loginHandler.go rename to app/auth/api/internal/handler/auth/loginHandler.go index fc33ee2..bb3d5c3 100644 --- a/app/user/api/internal/handler/auth/loginHandler.go +++ b/app/auth/api/internal/handler/auth/loginHandler.go @@ -1,15 +1,12 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package auth import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/auth" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/auth" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) @@ -23,6 +20,7 @@ func LoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { } l := auth.NewLoginLogic(r.Context(), svcCtx) + l.SetRequest(r) // 注入 http.Request 以便取 X-Client-Id 请求头 resp, err := l.Login(&req) if err != nil { response.Fail(w, err.Error()) diff --git a/app/user/api/internal/handler/auth/miniLoginHandler.go b/app/auth/api/internal/handler/auth/miniLoginHandler.go similarity index 80% rename from app/user/api/internal/handler/auth/miniLoginHandler.go rename to app/auth/api/internal/handler/auth/miniLoginHandler.go index 5c7f195..6f2b0dc 100644 --- a/app/user/api/internal/handler/auth/miniLoginHandler.go +++ b/app/auth/api/internal/handler/auth/miniLoginHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/auth" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/auth" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/routes.go b/app/auth/api/internal/handler/routes.go similarity index 72% rename from app/user/api/internal/handler/routes.go rename to app/auth/api/internal/handler/routes.go index 189f3e5..25777ee 100644 --- a/app/user/api/internal/handler/routes.go +++ b/app/auth/api/internal/handler/routes.go @@ -6,9 +6,9 @@ package handler import ( "net/http" - auth "sundynix-micro-go/app/user/api/internal/handler/auth" - user "sundynix-micro-go/app/user/api/internal/handler/user" - "sundynix-micro-go/app/user/api/internal/svc" + auth "sundynix-micro-go/app/auth/api/internal/handler/auth" + user "sundynix-micro-go/app/auth/api/internal/handler/user" + "sundynix-micro-go/app/auth/api/internal/svc" "github.com/zeromicro/go-zero/rest" ) @@ -16,6 +16,12 @@ import ( func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ + { + // 获取图形验证码 + Method: http.MethodGet, + Path: "/captcha", + Handler: auth.GetCaptchaHandler(serverCtx), + }, { // 账号密码登录 Method: http.MethodPost, @@ -35,35 +41,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Handler: auth.MiniLoginHandler(serverCtx), }, }, - rest.WithPrefix("/api/user"), + rest.WithPrefix("/api/auth"), ) server.AddRoutes( []rest.Route{ { // 修改密码 - Method: http.MethodPut, + Method: http.MethodPost, Path: "/changePassword", Handler: user.ChangePasswordHandler(serverCtx), }, - { - // 删除用户 - Method: http.MethodDelete, - Path: "/delete", - Handler: user.DeleteUserHandler(serverCtx), - }, { // 获取当前用户信息 Method: http.MethodGet, Path: "/info", Handler: user.GetUserInfoHandler(serverCtx), }, - { - // 用户列表 - Method: http.MethodPost, - Path: "/list", - Handler: user.GetUserListHandler(serverCtx), - }, { // 获取位置信息 Method: http.MethodGet, @@ -71,8 +65,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Handler: user.GetLocationHandler(serverCtx), }, { - // 更新用户信息 - Method: http.MethodPut, + // 更新个人信息 + Method: http.MethodPost, Path: "/update", Handler: user.UpdateUserHandler(serverCtx), }, @@ -84,6 +78,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, }, rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/user"), + rest.WithPrefix("/api/auth"), ) } diff --git a/app/user/api/internal/handler/user/changePasswordHandler.go b/app/auth/api/internal/handler/user/changePasswordHandler.go similarity index 80% rename from app/user/api/internal/handler/user/changePasswordHandler.go rename to app/auth/api/internal/handler/user/changePasswordHandler.go index aba68eb..56fd559 100644 --- a/app/user/api/internal/handler/user/changePasswordHandler.go +++ b/app/auth/api/internal/handler/user/changePasswordHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/user" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/user/getLocationHandler.go b/app/auth/api/internal/handler/user/getLocationHandler.go similarity index 80% rename from app/user/api/internal/handler/user/getLocationHandler.go rename to app/auth/api/internal/handler/user/getLocationHandler.go index 2889ead..a7c6602 100644 --- a/app/user/api/internal/handler/user/getLocationHandler.go +++ b/app/auth/api/internal/handler/user/getLocationHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/user" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/user/getUserInfoHandler.go b/app/auth/api/internal/handler/user/getUserInfoHandler.go similarity index 82% rename from app/user/api/internal/handler/user/getUserInfoHandler.go rename to app/auth/api/internal/handler/user/getUserInfoHandler.go index afb6640..3582975 100644 --- a/app/user/api/internal/handler/user/getUserInfoHandler.go +++ b/app/auth/api/internal/handler/user/getUserInfoHandler.go @@ -6,8 +6,8 @@ package user import ( "net/http" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/logic/user" + "sundynix-micro-go/app/auth/api/internal/svc" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/user/getWeatherHandler.go b/app/auth/api/internal/handler/user/getWeatherHandler.go similarity index 80% rename from app/user/api/internal/handler/user/getWeatherHandler.go rename to app/auth/api/internal/handler/user/getWeatherHandler.go index 00064d1..5f254c9 100644 --- a/app/user/api/internal/handler/user/getWeatherHandler.go +++ b/app/auth/api/internal/handler/user/getWeatherHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/user" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/user/api/internal/handler/user/updateUserHandler.go b/app/auth/api/internal/handler/user/updateUserHandler.go similarity index 80% rename from app/user/api/internal/handler/user/updateUserHandler.go rename to app/auth/api/internal/handler/user/updateUserHandler.go index f4e0d7d..349b018 100644 --- a/app/user/api/internal/handler/user/updateUserHandler.go +++ b/app/auth/api/internal/handler/user/updateUserHandler.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/logic/user" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "sundynix-micro-go/common/response" ) diff --git a/app/auth/api/internal/logic/auth/getCaptchaLogic.go b/app/auth/api/internal/logic/auth/getCaptchaLogic.go new file mode 100644 index 0000000..fe750a1 --- /dev/null +++ b/app/auth/api/internal/logic/auth/getCaptchaLogic.go @@ -0,0 +1,33 @@ +package auth + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" + "sundynix-micro-go/common/utils/captcha" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetCaptchaLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetCaptchaLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCaptchaLogic { + return &GetCaptchaLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetCaptchaLogic) GetCaptcha() (resp *types.CaptchaResp, err error) { + id, b64s, err := captcha.Generate() + if err != nil { + return nil, fmt.Errorf("生成验证码失败") + } + return &types.CaptchaResp{ + CaptchaId: id, + CaptchaImg: b64s, + }, nil +} diff --git a/app/user/api/internal/logic/auth/loginByPhoneLogic.go b/app/auth/api/internal/logic/auth/loginByPhoneLogic.go similarity index 68% rename from app/user/api/internal/logic/auth/loginByPhoneLogic.go rename to app/auth/api/internal/logic/auth/loginByPhoneLogic.go index 63280a4..4ab02f8 100644 --- a/app/user/api/internal/logic/auth/loginByPhoneLogic.go +++ b/app/auth/api/internal/logic/auth/loginByPhoneLogic.go @@ -10,14 +10,11 @@ import ( "io" "net/http" "net/url" - "time" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - "sundynix-micro-go/app/user/rpc/user" - jwtUtil "sundynix-micro-go/common/utils/jwt" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" + sysPb "sundynix-micro-go/app/system/rpc/system" - jwtv5 "github.com/golang-jwt/jwt/v5" "github.com/zeromicro/go-zero/core/logx" ) @@ -58,7 +55,7 @@ func (l *LoginByPhoneLogic) LoginByPhone(req *types.LoginByPhoneReq) (resp *type _ = url.Values{} // 2. 通过 user-rpc 查询用户 - userResp, err := l.svcCtx.UserRpc.GetUserByOpenId(l.ctx, &user.GetUserByOpenIdReq{ + userResp, err := l.svcCtx.SystemRpc.GetUserByOpenId(l.ctx, &sysPb.GetUserByOpenIdReq{ OpenId: req.OpenId, }) if err != nil { @@ -70,7 +67,7 @@ func (l *LoginByPhoneLogic) LoginByPhone(req *types.LoginByPhoneReq) (resp *type if ok { phoneNumber, _ := phoneInfo["phoneNumber"].(string) if phoneNumber != "" && userResp.User.Phone == "" { - _, _ = l.svcCtx.UserRpc.UpdateUser(l.ctx, &user.UpdateUserReq{ + _, _ = l.svcCtx.SystemRpc.UpdateUser(l.ctx, &sysPb.UpdateUserReq{ Id: userResp.User.Id, Phone: phoneNumber, }) @@ -78,20 +75,11 @@ func (l *LoginByPhoneLogic) LoginByPhone(req *types.LoginByPhoneReq) (resp *type } } - // 4. 生成Token - j := jwtUtil.NewJWT(l.svcCtx.Config.Auth.AccessSecret) - claims := jwtUtil.CustomClaims{ - BaseClaims: jwtUtil.BaseClaims{ - ID: userResp.User.Id, - Account: userResp.User.Account, - }, - BufferTime: 3600, - RegisteredClaims: jwtv5.RegisteredClaims{ - ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(l.svcCtx.Config.Auth.AccessExpire) * time.Second)), - Issuer: "sundynix", - }, + // 4. 生成Token(复用统一的 generateToken 函数) + token, err := generateToken(l.svcCtx.Config.Auth.AccessSecret, l.svcCtx.Config.Auth.AccessExpire, userResp.User) + if err != nil { + return nil, fmt.Errorf("生成Token失败") } - token, _ := j.CreateToken(claims) return &types.LoginResp{ Token: token, diff --git a/app/auth/api/internal/logic/auth/loginLogic.go b/app/auth/api/internal/logic/auth/loginLogic.go new file mode 100644 index 0000000..9b0b6fc --- /dev/null +++ b/app/auth/api/internal/logic/auth/loginLogic.go @@ -0,0 +1,115 @@ +package auth + +import ( + "context" + "fmt" + "net/http" + "time" + + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" + sysPb "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/common/utils/captcha" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" +) + +type LoginLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext + r *http.Request +} + +func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic { + return &LoginLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +// SetRequest 注入 http.Request 以便从请求头取 clientId +func (l *LoginLogic) SetRequest(r *http.Request) { + l.r = r +} + +func (l *LoginLogic) Login(req *types.LoginReq) (resp *types.LoginResp, err error) { + // 1. 校验验证码 + if !captcha.Verify(req.CaptchaId, req.Captcha) { + return nil, fmt.Errorf("验证码错误") + } + + // 2. 从请求头获取 clientId + clientId := "" + if l.r != nil { + clientId = l.r.Header.Get("X-Client-Id") + } + if clientId == "" { + return nil, fmt.Errorf("缺少客户端标识") + } + + // 3. 查询 Client 信息,获取 token 过期时间 + clientResp, err := l.svcCtx.SystemRpc.GetClientById(l.ctx, &sysPb.GetClientByIdReq{ClientId: clientId}) + if err != nil { + l.Errorf("[Login] ❌ 查询客户端失败 | clientId=%s | err=%v", clientId, err) + return nil, fmt.Errorf("无效的客户端标识,请确认 X-Client-Id 请求头是否正确") + } + activeTimeout := clientResp.Client.ActiveTimeout + if activeTimeout <= 0 { + activeTimeout = 7200 + } + + // 4. 调用 system-rpc 验证账号密码 + rpcResp, err := l.svcCtx.SystemRpc.LoginByAccount(l.ctx, &sysPb.LoginByAccountReq{ + Account: req.Account, + Password: req.Password, + }) + if err != nil { + l.Errorf("[Login] ❌ 账号验证失败 | account=%s | err=%v", req.Account, err) + return nil, err + } + + // 5. 签发 JWT Token + token, err := generateToken(l.svcCtx.Config.Auth.AccessSecret, activeTimeout, rpcResp.User) + if err != nil { + l.Errorf("[Login] ❌ 生成 Token 失败 | userId=%s | err=%v", rpcResp.User.Id, err) + return nil, err + } + + l.Infof("[Login] ✅ 登录成功 | account=%s | userId=%s | clientId=%s | tokenExpire=%ds", + req.Account, rpcResp.User.Id, clientId, activeTimeout) + + return &types.LoginResp{ + Token: token, + UserInfo: map[string]interface{}{ + "id": rpcResp.User.Id, + "name": rpcResp.User.Name, + "account": rpcResp.User.Account, + "nickName": rpcResp.User.NickName, + "phone": rpcResp.User.Phone, + "avatarId": rpcResp.User.AvatarId, + "gender": rpcResp.User.Gender, + }, + }, nil +} + +func generateToken(accessSecret string, activeTimeout int64, userInfo *sysPb.UserInfo) (string, error) { + j := jwtUtil.NewJWT(accessSecret) + claims := jwtUtil.CustomClaims{ + BaseClaims: jwtUtil.BaseClaims{ + ID: userInfo.Id, + Account: userInfo.Account, + }, + BufferTime: 3600, + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: jwtv5.ClaimStrings{"sundynix"}, + NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(activeTimeout) * time.Second)), + Issuer: "sundynix", + }, + } + token, err := j.CreateToken(claims) + if err != nil { + return "", fmt.Errorf("生成Token失败: %w", err) + } + return token, nil +} diff --git a/app/user/api/internal/logic/auth/miniLoginLogic.go b/app/auth/api/internal/logic/auth/miniLoginLogic.go similarity index 74% rename from app/user/api/internal/logic/auth/miniLoginLogic.go rename to app/auth/api/internal/logic/auth/miniLoginLogic.go index bb7e41c..ffaee44 100644 --- a/app/user/api/internal/logic/auth/miniLoginLogic.go +++ b/app/auth/api/internal/logic/auth/miniLoginLogic.go @@ -10,14 +10,11 @@ import ( "io" "net/http" "net/url" - "time" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - "sundynix-micro-go/app/user/rpc/user" - jwtUtil "sundynix-micro-go/common/utils/jwt" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" + sysPb "sundynix-micro-go/app/system/rpc/system" - jwtv5 "github.com/golang-jwt/jwt/v5" "github.com/zeromicro/go-zero/core/logx" ) @@ -87,7 +84,7 @@ func (l *MiniLoginLogic) MiniLogin(req *types.MiniLoginReq) (resp *types.LoginRe } // 2. 通过 user-rpc 创建或获取用户 - createResp, err := l.svcCtx.UserRpc.CreateUser(l.ctx, &user.CreateUserReq{ + createResp, err := l.svcCtx.SystemRpc.CreateUser(l.ctx, &sysPb.CreateUserReq{ Name: "", OpenId: wxResp.Openid, SessionKey: wxResp.SessionKey, @@ -98,22 +95,8 @@ func (l *MiniLoginLogic) MiniLogin(req *types.MiniLoginReq) (resp *types.LoginRe return nil, fmt.Errorf("登录失败") } - // 3. 生成JWT Token - j := jwtUtil.NewJWT(l.svcCtx.Config.Auth.AccessSecret) - claims := jwtUtil.CustomClaims{ - BaseClaims: jwtUtil.BaseClaims{ - ID: createResp.User.Id, - Account: createResp.User.Account, - }, - BufferTime: 3600, - RegisteredClaims: jwtv5.RegisteredClaims{ - Audience: jwtv5.ClaimStrings{"sundynix"}, - NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), - ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(l.svcCtx.Config.Auth.AccessExpire) * time.Second)), - Issuer: "sundynix", - }, - } - token, err := j.CreateToken(claims) + // 3. 生成JWT Token(复用统一的 generateToken 函数) + token, err := generateToken(l.svcCtx.Config.Auth.AccessSecret, l.svcCtx.Config.Auth.AccessExpire, createResp.User) if err != nil { l.Errorf("生成Token失败: %v", err) return nil, fmt.Errorf("登录失败") diff --git a/app/user/api/internal/logic/user/changePasswordLogic.go b/app/auth/api/internal/logic/user/changePasswordLogic.go similarity index 86% rename from app/user/api/internal/logic/user/changePasswordLogic.go rename to app/auth/api/internal/logic/user/changePasswordLogic.go index 869c5cc..a24ae7f 100644 --- a/app/user/api/internal/logic/user/changePasswordLogic.go +++ b/app/auth/api/internal/logic/user/changePasswordLogic.go @@ -6,8 +6,8 @@ package user import ( "context" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) diff --git a/app/user/api/internal/logic/user/getLocationLogic.go b/app/auth/api/internal/logic/user/getLocationLogic.go similarity index 86% rename from app/user/api/internal/logic/user/getLocationLogic.go rename to app/auth/api/internal/logic/user/getLocationLogic.go index 1d2df51..39203ba 100644 --- a/app/user/api/internal/logic/user/getLocationLogic.go +++ b/app/auth/api/internal/logic/user/getLocationLogic.go @@ -6,8 +6,8 @@ package user import ( "context" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) diff --git a/app/auth/api/internal/logic/user/getUserInfoLogic.go b/app/auth/api/internal/logic/user/getUserInfoLogic.go new file mode 100644 index 0000000..091a22b --- /dev/null +++ b/app/auth/api/internal/logic/user/getUserInfoLogic.go @@ -0,0 +1,114 @@ +package user + +import ( + "context" + "fmt" + "sort" + + "sundynix-micro-go/app/auth/api/internal/svc" + sysPb "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserInfoLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { + return &GetUserInfoLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetUserInfoLogic) GetUserInfo() (resp interface{}, err error) { + // 1. 从 JWT claims 中获取 userId + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + if userId == "" || userId == "" { + return nil, fmt.Errorf("用户未登录") + } + + // 2. 调用 system-rpc 获取用户基础信息 + userResp, err := l.svcCtx.SystemRpc.GetUserById(l.ctx, &sysPb.GetUserByIdReq{Id: userId}) + if err != nil { + l.Errorf("[GetUserInfo] ❌ 获取用户信息失败 | userId=%s | err=%v", userId, err) + return nil, fmt.Errorf("获取用户信息失败") + } + + // 3. 获取用户角色列表 + rolesResp, err := l.svcCtx.SystemRpc.GetRolesByUserId(l.ctx, &sysPb.GetRolesByUserIdReq{UserId: userId}) + if err != nil { + l.Errorf("[GetUserInfo] ⚠️ 获取用户角色失败(已降级返回空角色) | userId=%s | err=%v", userId, err) + rolesResp = &sysPb.GetRolesByUserIdResp{Roles: []*sysPb.RoleInfo{}} + } + + // 4. 根据角色获取菜单权限(合并所有角色的菜单) + menuMap := make(map[string]interface{}) + var allMenus []interface{} + var roleCodes []string + + for _, role := range rolesResp.Roles { + roleCodes = append(roleCodes, role.Code) + + menusResp, err := l.svcCtx.SystemRpc.GetMenusByRoleId(l.ctx, &sysPb.GetMenusByRoleIdReq{RoleId: role.Id}) + if err != nil { + l.Errorf("获取角色[%s]菜单失败: %v", role.Name, err) + continue + } + for _, m := range menusResp.Menus { + if _, exists := menuMap[m.Id]; !exists { + menuMap[m.Id] = true + allMenus = append(allMenus, convertMenuInfo(m)) + } + } + } + + // 5. 对顶层菜单进行重新排序,防止不同角色的合并打乱顺序 + sort.Slice(allMenus, func(i, j int) bool { + m1 := allMenus[i].(map[string]interface{}) + m2 := allMenus[j].(map[string]interface{}) + s1 := m1["sort"].(int32) + s2 := m2["sort"].(int32) + return s1 < s2 + }) + + // 5. 组装完整的用户信息返回 + u := userResp.User + return map[string]interface{}{ + "id": u.Id, + "name": u.Name, + "account": u.Account, + "nickName": u.NickName, + "phone": u.Phone, + "avatarId": u.AvatarId, + "gender": u.Gender, + "roles": roleCodes, + "menus": allMenus, + "createdAt": u.CreatedAt, + }, nil +} + +// convertMenuInfo 将proto MenuInfo转为map +func convertMenuInfo(m *sysPb.MenuInfo) map[string]interface{} { + menu := map[string]interface{}{ + "id": m.Id, + "parentId": m.ParentId, + "category": m.Category, + "name": m.Name, + "title": m.Title, + "code": m.Code, + "path": m.Path, + "permission": m.Permission, + "locale": m.Locale, + "icon": m.Icon, + "sort": m.Sort, + } + if len(m.Children) > 0 { + var children []map[string]interface{} + for _, child := range m.Children { + children = append(children, convertMenuInfo(child)) + } + menu["children"] = children + } + return menu +} diff --git a/app/user/api/internal/logic/user/getWeatherLogic.go b/app/auth/api/internal/logic/user/getWeatherLogic.go similarity index 85% rename from app/user/api/internal/logic/user/getWeatherLogic.go rename to app/auth/api/internal/logic/user/getWeatherLogic.go index 312964d..795c6bc 100644 --- a/app/user/api/internal/logic/user/getWeatherLogic.go +++ b/app/auth/api/internal/logic/user/getWeatherLogic.go @@ -6,8 +6,8 @@ package user import ( "context" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) diff --git a/app/user/api/internal/logic/user/updateUserLogic.go b/app/auth/api/internal/logic/user/updateUserLogic.go similarity index 80% rename from app/user/api/internal/logic/user/updateUserLogic.go rename to app/auth/api/internal/logic/user/updateUserLogic.go index 761e610..53cdcec 100644 --- a/app/user/api/internal/logic/user/updateUserLogic.go +++ b/app/auth/api/internal/logic/user/updateUserLogic.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - pb "sundynix-micro-go/app/user/rpc/user" + "sundynix-micro-go/app/auth/api/internal/svc" + "sundynix-micro-go/app/auth/api/internal/types" + sysPb "sundynix-micro-go/app/system/rpc/system" "github.com/zeromicro/go-zero/core/logx" ) @@ -34,7 +34,7 @@ func (l *UpdateUserLogic) UpdateUser(req *types.UpdateUserReq) error { return fmt.Errorf("用户未登录") } - _, err := l.svcCtx.UserRpc.UpdateUser(l.ctx, &pb.UpdateUserReq{ + _, err := l.svcCtx.SystemRpc.UpdateUser(l.ctx, &sysPb.UpdateUserReq{ Id: userId, Name: req.Name, Account: req.Account, diff --git a/app/auth/api/internal/svc/serviceContext.go b/app/auth/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..dfe127b --- /dev/null +++ b/app/auth/api/internal/svc/serviceContext.go @@ -0,0 +1,32 @@ +package svc + +import ( + "sundynix-micro-go/app/auth/api/internal/config" + "sundynix-micro-go/app/system/rpc/systemservice" + "sundynix-micro-go/common/utils/captcha" + + "github.com/redis/go-redis/v9" + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" +) + +type ServiceContext struct { + Config config.Config + SystemRpc systemservice.SystemService +} + +func NewServiceContext(c config.Config) *ServiceContext { + // 初始化 Redis 并注入验证码存储 + rdb := redis.NewClient(&redis.Options{ + Addr: c.Redis.Host, + Password: c.Redis.Pass, + DB: c.Redis.DB, + }) + captcha.InitWithRedis(rdb) + logx.Infof("验证码存储已切换至 Redis (DB%d)", c.Redis.DB) + + return &ServiceContext{ + Config: c, + SystemRpc: systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)), + } +} diff --git a/app/user/api/internal/types/types.go b/app/auth/api/internal/types/types.go similarity index 83% rename from app/user/api/internal/types/types.go rename to app/auth/api/internal/types/types.go index 6eb033e..ab1e69c 100644 --- a/app/user/api/internal/types/types.go +++ b/app/auth/api/internal/types/types.go @@ -3,6 +3,11 @@ package types +type CaptchaResp struct { + CaptchaId string `json:"captchaId"` + CaptchaImg string `json:"captchaImg"` +} + type ChangePasswordReq struct { OldPassword string `json:"oldPassword"` NewPassword string `json:"newPassword"` @@ -28,8 +33,10 @@ type LoginByPhoneReq struct { } type LoginReq struct { - Account string `json:"account"` - Password string `json:"password"` + Account string `json:"account"` + Password string `json:"password"` + CaptchaId string `json:"captchaId"` + Captcha string `json:"captcha"` } type LoginResp struct { diff --git a/app/user/model/user_model.go b/app/auth/model/user_model.go similarity index 100% rename from app/user/model/user_model.go rename to app/auth/model/user_model.go diff --git a/app/file/api/file.api b/app/file/api/file.api index b96414c..7c2b6c1 100644 --- a/app/file/api/file.api +++ b/app/file/api/file.api @@ -47,7 +47,7 @@ service file-api { @doc "删除文件" @handler DeleteFile - delete /delete (IdsReq) + post /delete (IdsReq) @doc "文件列表" @handler GetFileList diff --git a/app/file/api/file.go b/app/file/api/file.go index b37e311..ca8a12b 100644 --- a/app/file/api/file.go +++ b/app/file/api/file.go @@ -12,6 +12,7 @@ import ( "sundynix-micro-go/app/file/api/internal/svc" "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/rest" ) @@ -19,6 +20,7 @@ var configFile = flag.String("f", "etc/file-api.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/file/rpc/file.go b/app/file/rpc/file.go index 8599cc3..76c72b5 100644 --- a/app/file/rpc/file.go +++ b/app/file/rpc/file.go @@ -11,6 +11,7 @@ import ( "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/zrpc" "google.golang.org/grpc" "google.golang.org/grpc/reflection" @@ -20,6 +21,7 @@ var configFile = flag.String("f", "etc/file.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/gateway/etc/gateway.yaml b/app/gateway/etc/gateway.yaml index 61fb68e..6a9e195 100644 --- a/app/gateway/etc/gateway.yaml +++ b/app/gateway/etc/gateway.yaml @@ -21,16 +21,33 @@ Cors: - Content-Type - Authorization - X-Requested-With + - X-Client-Id + +# system-rpc 连接(用于写入操作日志) +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# JWT 密钥(与 user-api 的 Auth.AccessSecret 一致,用于解析 token 获取 userId) +JwtSecret: "9149f2eb-d517-4a50-a03a-231dbcf0d872" + +# 鉴权白名单(无需 Token 的路径,精确匹配或 /* 前缀通配) +AuthWhitelist: + - /api/auth/login + - /api/auth/loginByPhone + - /api/auth/miniLogin + - /api/auth/captcha + - /api/plant/callback/wechatpay # 上游服务路由表 Upstreams: - - Prefix: /api/user - Target: http://127.0.0.1:9001 + - Prefix: /api/auth + Target: http://192.168.100.2:9001 - Prefix: /api/file - Target: http://127.0.0.1:9002 + Target: http://192.168.100.2:9002 - Prefix: /api/sys - Target: http://127.0.0.1:9003 + Target: http://192.168.100.2:9003 - Prefix: /api/plant - Target: http://127.0.0.1:9004 - - Prefix: /api/radio - Target: http://127.0.0.1:9005 + Target: http://192.168.100.2:9004 diff --git a/app/gateway/gateway.go b/app/gateway/gateway.go index 4636447..2fd91ef 100644 --- a/app/gateway/gateway.go +++ b/app/gateway/gateway.go @@ -8,23 +8,34 @@ import ( "sundynix-micro-go/app/gateway/internal/config" "sundynix-micro-go/app/gateway/internal/handler" "sundynix-micro-go/app/gateway/internal/middleware" + "sundynix-micro-go/app/system/rpc/systemservice" "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/core/stat" + "github.com/zeromicro/go-zero/zrpc" ) var configFile = flag.String("f", "etc/gateway.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) + // 手动初始化日志(自定义 gateway 没用 rest.MustNewServer,需要显式设置) + logx.MustSetup(c.Log) + + // 初始化 system-rpc 客户端(用于写操作日志) + systemRpc := systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)) + // 构建反向代理路由器 proxyRouter := handler.NewProxyRouter(c.Upstreams) - // 构建请求处理链 + // 构建中间件链(执行顺序:操作日志 → 鉴权 → CORS → 代理) + // 注意:由于是外层包内层,实际请求流程是:OpLog → Auth → CORS → Proxy → CORS → Auth → OpLog var finalHandler http.Handler = proxyRouter // 注入 CORS 中间件 @@ -35,6 +46,14 @@ func main() { })) } + // 注入 JWT 鉴权中间件(含滑动窗口续期) + authMiddleware := middleware.NewAuthMiddleware(c.JwtSecret, c.AuthWhitelist) + finalHandler = authMiddleware.Handle(finalHandler) + + // 注入操作日志中间件(在最外层,记录完整的请求-响应周期,含鉴权状态) + opLogMiddleware := middleware.NewOperationLogMiddleware(systemRpc, c.JwtSecret) + finalHandler = opLogMiddleware.Handle(finalHandler) + // 健康检查 mux := http.NewServeMux() mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { @@ -50,6 +69,8 @@ func main() { for _, u := range c.Upstreams { logx.Infof(" %s -> %s", u.Prefix, u.Target) } + logx.Infof("中间件: CORS | JWT鉴权(滑动续期) | 操作日志→system-rpc") + logx.Infof("鉴权白名单: %d 条", len(c.AuthWhitelist)) logx.Infof("================================") if err := http.ListenAndServe(addr, mux); err != nil { diff --git a/app/gateway/internal/config/config.go b/app/gateway/internal/config/config.go index 1e1f4a6..d79fa68 100644 --- a/app/gateway/internal/config/config.go +++ b/app/gateway/internal/config/config.go @@ -1,6 +1,9 @@ package config -import "github.com/zeromicro/go-zero/rest" +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) type Config struct { rest.RestConf @@ -13,6 +16,15 @@ type Config struct { } Upstreams []Upstream + + // system-rpc 连接(用于写入操作日志) + SystemRpc zrpc.RpcClientConf + + // JWT 密钥(用于解析 Token 获取 userId,与 user-api 的 Auth.AccessSecret 保持一致) + JwtSecret string `json:",optional"` + + // 无需鉴权的路径白名单 + AuthWhitelist []string `json:",optional"` } type Upstream struct { diff --git a/app/gateway/internal/handler/proxy.go b/app/gateway/internal/handler/proxy.go index 3589442..3e1546c 100644 --- a/app/gateway/internal/handler/proxy.go +++ b/app/gateway/internal/handler/proxy.go @@ -1,7 +1,9 @@ package handler import ( + "bytes" "fmt" + "io" "net/http" "net/http/httputil" "net/url" @@ -49,19 +51,38 @@ func NewProxyRouter(upstreams []config.Upstream) *ProxyRouter { // 自定义 Transport:超时控制 proxy.Transport = &http.Transport{ - MaxIdleConns: 100, - MaxIdleConnsPerHost: 20, - IdleConnTimeout: 90 * time.Second, + MaxIdleConns: 100, + MaxIdleConnsPerHost: 20, + IdleConnTimeout: 90 * time.Second, + ResponseHeaderTimeout: 30 * time.Second, // 上游响应头超时,超出则触发 ErrorHandler } - // 错误处理 prefix := u.Prefix targetAddr := u.Target + + // ErrorHandler:处理网络层错误(连接失败、超时等) proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { - logx.Errorf("代理请求失败 [%s%s -> %s]: %v", prefix, r.URL.Path, targetAddr, err) + logx.Errorf("[Gateway] ❌ 上游连接失败 | %s %s -> %s | 错误: %v", + r.Method, r.URL.Path, targetAddr, err) w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusBadGateway) - fmt.Fprintf(w, `{"code":502,"msg":"上游服务不可用: %s"}`, prefix) + fmt.Fprintf(w, `{"code":502,"msg":"上游服务不可用,请检查 %s 是否正常运行"}`, prefix) + } + + // ModifyResponse:捕获上游返回的 4xx/5xx 并记录日志(网络层正常但业务异常) + proxy.ModifyResponse = func(resp *http.Response) error { + if resp.StatusCode >= 500 { + // 读取响应体用于日志(最多 1KB,读完后要写回) + body, _ := io.ReadAll(io.LimitReader(resp.Body, 1024)) + resp.Body = io.NopCloser(bytes.NewBuffer(body)) + logx.Errorf("[Gateway] ⚠️ 上游服务异常 | %s %s -> %s | 状态码: %d | 响应: %s", + resp.Request.Method, resp.Request.URL.Path, targetAddr, + resp.StatusCode, string(body)) + } else if resp.StatusCode >= 400 { + logx.Infof("[Gateway] ℹ️ 上游返回客户端错误 | %s %s | 状态码: %d", + resp.Request.Method, resp.Request.URL.Path, resp.StatusCode) + } + return nil } router.routes = append(router.routes, &route{ @@ -82,13 +103,14 @@ func (pr *ProxyRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { for _, rt := range pr.routes { if strings.HasPrefix(path, rt.prefix) { - logx.Infof("[Gateway] %s %s -> %s", r.Method, path, rt.target) + logx.Infof("[Gateway] → %s %s -> %s", r.Method, path, rt.target) rt.proxy.ServeHTTP(w, r) return } } // 没有匹配的路由 + logx.Errorf("[Gateway] ❌ 路由未找到: %s %s", r.Method, path) w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, `{"code":404,"msg":"路由未找到: %s"}`, path) diff --git a/app/gateway/internal/middleware/auth.go b/app/gateway/internal/middleware/auth.go new file mode 100644 index 0000000..a8024ac --- /dev/null +++ b/app/gateway/internal/middleware/auth.go @@ -0,0 +1,140 @@ +package middleware + +import ( + "encoding/json" + "net/http" + "strings" + "time" + + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" +) + +// RefreshTokenHeader 续期后新 Token 放在此响应头里,前端读取后静默替换 +const RefreshTokenHeader = "X-Refresh-Token" + +// AuthMiddleware 网关鉴权 + 自动续期中间件 +type AuthMiddleware struct { + jwtSecret string + whitelist map[string]bool +} + +func NewAuthMiddleware(jwtSecret string, whitelist []string) *AuthMiddleware { + wl := make(map[string]bool, len(whitelist)) + for _, p := range whitelist { + wl[p] = true + } + return &AuthMiddleware{ + jwtSecret: jwtSecret, + whitelist: wl, + } +} + +// Handle 适配 http.Handler 链(自定义 gateway 使用 http.Handler 链式调用) +func (m *AuthMiddleware) Handle(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // OPTIONS 预检直接放行 + if r.Method == http.MethodOptions { + next.ServeHTTP(w, r) + return + } + + // 白名单路径放行(支持精确匹配和 /* 前缀通配) + if m.isWhitelisted(r.URL.Path) { + next.ServeHTTP(w, r) + return + } + + // 解析 Authorization 头 + authHeader := r.Header.Get("Authorization") + if authHeader == "" { + writeUnauthorized(w, "缺少 Authorization 请求头") + return + } + tokenStr := jwtUtil.GetTokenFromHeader(authHeader) + if tokenStr == "" { + writeUnauthorized(w, "Token 格式错误") + return + } + + j := jwtUtil.NewJWT(m.jwtSecret) + claims, err := j.ParseToken(tokenStr) + if err != nil { + logx.Infof("[gateway] JWT 解析失败: %v, path: %s", err, r.URL.Path) + writeUnauthorized(w, err.Error()) + return + } + + // 将用户信息透传到上游,避免上游重复解析 JWT + r.Header.Set("X-User-Id", claims.BaseClaims.ID) + r.Header.Set("X-User-Account", claims.BaseClaims.Account) + + // ---- 滑动窗口续期 ---- + if newToken, ok := m.tryRefresh(j, claims); ok { + w.Header().Set(RefreshTokenHeader, newToken) + logx.Infof("[gateway] Token 已续期, userId: %s", claims.BaseClaims.ID) + } + + next.ServeHTTP(w, r) + }) +} + +// tryRefresh 判断是否需要续期,需要则签发新 Token 并返回 +// 续期规则:剩余有效时间 < BufferTime → 以原始有效时长(ExpiresAt - NotBefore)重新签发 +func (m *AuthMiddleware) tryRefresh(j *jwtUtil.JWT, claims *jwtUtil.CustomClaims) (string, bool) { + bufferTime := time.Duration(claims.BufferTime) * time.Second + expiresAt := claims.RegisteredClaims.ExpiresAt.Time + remaining := time.Until(expiresAt) + + // 未进入缓冲窗口,无需续期 + if remaining >= bufferTime { + return "", false + } + + // 计算原始有效时长:ExpiresAt - NotBefore ≈ 当初登录时配置的 activeTimeout + notBefore := claims.RegisteredClaims.NotBefore.Time + originalDuration := expiresAt.Sub(notBefore) + + newClaims := jwtUtil.CustomClaims{ + BaseClaims: claims.BaseClaims, + BufferTime: claims.BufferTime, + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: claims.RegisteredClaims.Audience, + Issuer: claims.RegisteredClaims.Issuer, + NotBefore: jwtv5.NewNumericDate(time.Now()), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(originalDuration)), + }, + } + + newToken, err := j.CreateToken(newClaims) + if err != nil { + logx.Errorf("[gateway] Token 续期失败: %v", err) + return "", false + } + return newToken, true +} + +// isWhitelisted 支持精确匹配和 /* 前缀通配 +func (m *AuthMiddleware) isWhitelisted(path string) bool { + if m.whitelist[path] { + return true + } + for p := range m.whitelist { + if strings.HasSuffix(p, "/*") && strings.HasPrefix(path, strings.TrimSuffix(p, "*")) { + return true + } + } + return false +} + +// writeUnauthorized 返回统一的 401 响应 +func writeUnauthorized(w http.ResponseWriter, msg string) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(http.StatusUnauthorized) + _ = json.NewEncoder(w).Encode(map[string]interface{}{ + "code": 401, + "msg": msg, + }) +} diff --git a/app/gateway/internal/middleware/cors.go b/app/gateway/internal/middleware/cors.go index 209280a..a9e8c1b 100644 --- a/app/gateway/internal/middleware/cors.go +++ b/app/gateway/internal/middleware/cors.go @@ -42,6 +42,8 @@ func (m *CorsMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { w.Header().Set("Access-Control-Allow-Headers", strings.Join(m.allowHeaders, ", ")) w.Header().Set("Access-Control-Allow-Credentials", "true") w.Header().Set("Access-Control-Max-Age", "3600") + // 允许前端 JS 读取自定义响应头(用于 Token 自动续期) + w.Header().Set("Access-Control-Expose-Headers", "X-Refresh-Token") } // 预检请求直接返回 diff --git a/app/gateway/internal/middleware/operationLog.go b/app/gateway/internal/middleware/operationLog.go new file mode 100644 index 0000000..16e50ff --- /dev/null +++ b/app/gateway/internal/middleware/operationLog.go @@ -0,0 +1,172 @@ +package middleware + +import ( + "bytes" + "context" + "io" + "net/http" + "strings" + "time" + + "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/app/system/rpc/systemservice" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + "github.com/zeromicro/go-zero/core/logx" +) + +// OperationLogMiddleware 操作日志中间件 +type OperationLogMiddleware struct { + systemRpc systemservice.SystemService + jwtSecret string + logChan chan *system.CreateOperationRecordReq +} + +// NewOperationLogMiddleware 创建操作日志中间件 +func NewOperationLogMiddleware(systemRpc systemservice.SystemService, jwtSecret string) *OperationLogMiddleware { + m := &OperationLogMiddleware{ + systemRpc: systemRpc, + jwtSecret: jwtSecret, + logChan: make(chan *system.CreateOperationRecordReq, 500), + } + // 启动异步消费者,避免阻塞请求 + go m.consumer() + return m +} + +// Handle 中间件处理函数 +func (m *OperationLogMiddleware) Handle(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // 跳过健康检查、OPTIONS 预检 + if r.URL.Path == "/health" || r.Method == http.MethodOptions { + next.ServeHTTP(w, r) + return + } + + startTime := time.Now() + + // 读取请求体(限制大小,跳过文件上传) + var bodyStr string + if r.Body != nil && !strings.HasPrefix(r.Header.Get("Content-Type"), "multipart/form-data") { + bodyBytes, _ := io.ReadAll(io.LimitReader(r.Body, 2048)) + bodyStr = string(bodyBytes) + r.Body = io.NopCloser(bytes.NewBuffer(bodyBytes)) + } + + clientId := r.Header.Get("X-Client-Id") + userId := m.extractUserId(r) + clientIP := getClientIP(r) + + // 包装 ResponseWriter 捕获响应 + rw := &responseCapture{ResponseWriter: w, statusCode: http.StatusOK} + + // 执行后续 handler + next.ServeHTTP(rw, r) + + latency := time.Since(startTime) + + // 构建日志请求 + record := &system.CreateOperationRecordReq{ + ClientId: clientId, + Ip: clientIP, + Method: r.Method, + Path: r.URL.Path, + Status: int32(rw.statusCode), + Latency: latency.Nanoseconds(), + Agent: truncate(r.UserAgent(), 500), + ErrorMessage: rw.errorMsg(), + Body: truncate(bodyStr, 2000), + Resp: truncate(rw.body.String(), 2000), + UserId: userId, + } + + // 异步发送,不阻塞响应 + select { + case m.logChan <- record: + default: + logx.Error("操作日志缓冲区满,丢弃日志") + } + }) +} + +// consumer 异步消费日志并通过 system-rpc 写入 +func (m *OperationLogMiddleware) consumer() { + for record := range m.logChan { + _, err := m.systemRpc.CreateOperationRecord(context.Background(), record) + if err != nil { + logx.Errorf("写入操作日志失败: %v", err) + } + } +} + +// extractUserId 从请求中获取 userId +// 优先从鉴权中间件注入的 X-User-Id 头获取(避免重复解析 JWT) +func (m *OperationLogMiddleware) extractUserId(r *http.Request) string { + if uid := r.Header.Get("X-User-Id"); uid != "" { + return uid + } + // fallback: 自己解析 JWT + authHeader := r.Header.Get("Authorization") + if authHeader == "" { + return "" + } + tokenStr := jwtUtil.GetTokenFromHeader(authHeader) + if tokenStr == "" { + return "" + } + j := jwtUtil.NewJWT(m.jwtSecret) + claims, err := j.ParseToken(tokenStr) + if err != nil { + return "" + } + return claims.BaseClaims.ID +} + +// responseCapture 捕获响应状态码和响应体 +type responseCapture struct { + http.ResponseWriter + statusCode int + body bytes.Buffer +} + +func (rc *responseCapture) WriteHeader(code int) { + rc.statusCode = code + rc.ResponseWriter.WriteHeader(code) +} + +func (rc *responseCapture) Write(b []byte) (int, error) { + if rc.body.Len() < 2048 { + rc.body.Write(b) + } + return rc.ResponseWriter.Write(b) +} + +func (rc *responseCapture) errorMsg() string { + if rc.statusCode >= 400 { + return rc.body.String() + } + return "" +} + +// getClientIP 获取真实客户端 IP +func getClientIP(r *http.Request) string { + if ip := r.Header.Get("X-Forwarded-For"); ip != "" { + return strings.Split(ip, ",")[0] + } + if ip := r.Header.Get("X-Real-Ip"); ip != "" { + return ip + } + addr := r.RemoteAddr + if idx := strings.LastIndex(addr, ":"); idx != -1 { + return addr[:idx] + } + return addr +} + +// truncate 截断字符串 +func truncate(s string, maxLen int) string { + if len(s) > maxLen { + return s[:maxLen] + "..." + } + return s +} diff --git a/app/plant/api/internal/svc/serviceContext.go b/app/plant/api/internal/svc/serviceContext.go index e63ca12..5824465 100644 --- a/app/plant/api/internal/svc/serviceContext.go +++ b/app/plant/api/internal/svc/serviceContext.go @@ -7,7 +7,7 @@ import ( "sundynix-micro-go/app/file/rpc/fileservice" "sundynix-micro-go/app/plant/api/internal/config" "sundynix-micro-go/app/plant/rpc/plantservice" - "sundynix-micro-go/app/user/rpc/userservice" + "sundynix-micro-go/app/system/rpc/systemservice" "github.com/zeromicro/go-zero/zrpc" ) @@ -15,7 +15,7 @@ import ( type ServiceContext struct { Config config.Config PlantRpc plantservice.PlantService - UserRpc userservice.UserService + UserRpc systemservice.SystemService FileRpc fileservice.FileService } @@ -23,7 +23,7 @@ func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, PlantRpc: plantservice.NewPlantService(zrpc.MustNewClient(c.PlantRpc)), - UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), + UserRpc: systemservice.NewSystemService(zrpc.MustNewClient(c.UserRpc)), FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)), } } diff --git a/app/plant/api/plant.api b/app/plant/api/plant.api index 5389b98..c4b3e35 100644 --- a/app/plant/api/plant.api +++ b/app/plant/api/plant.api @@ -166,11 +166,11 @@ service plant-api { @doc "更新植物" @handler UpdatePlant - put /my/update (UpdatePlantReq) + post /my/update (UpdatePlantReq) @doc "删除植物" @handler DeletePlant - delete /my/delete (IdsReq) + post /my/delete (IdsReq) @doc "我的植物列表" @handler GetMyPlantList @@ -240,7 +240,7 @@ service plant-api { @doc "删除帖子" @handler DeletePost - delete /post/delete (IdsReq) + post /post/delete (IdsReq) @doc "评论帖子" @handler CommentPost @@ -267,7 +267,7 @@ service plant-api { @doc "删除话题" @handler DeleteTopic - delete /topic/delete (IdsReq) + post /topic/delete (IdsReq) } @server ( @@ -323,7 +323,7 @@ service plant-api { @doc "更新用户资料" @handler UpdateUserProfile - put /profile/update (UpdateProfileReq) + post /profile/update (UpdateProfileReq) } @server ( diff --git a/app/plant/api/plant.go b/app/plant/api/plant.go index 63db6b2..91770c7 100644 --- a/app/plant/api/plant.go +++ b/app/plant/api/plant.go @@ -12,6 +12,7 @@ import ( "sundynix-micro-go/app/plant/api/internal/svc" "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/rest" ) @@ -19,6 +20,7 @@ var configFile = flag.String("f", "etc/plant-api.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/plant/rpc/plant.go b/app/plant/rpc/plant.go index b53e7c8..ca5a98b 100644 --- a/app/plant/rpc/plant.go +++ b/app/plant/rpc/plant.go @@ -11,6 +11,7 @@ import ( "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/zrpc" "google.golang.org/grpc" "google.golang.org/grpc/reflection" @@ -20,6 +21,7 @@ var configFile = flag.String("f", "etc/plant.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/radio/api/etc/radio-api.yaml b/app/radio/api/etc/radio-api.yaml deleted file mode 100644 index ba9573c..0000000 --- a/app/radio/api/etc/radio-api.yaml +++ /dev/null @@ -1,28 +0,0 @@ -Name: radio-api - -Log: - Encoding: plain -Host: 0.0.0.0 -Port: 9005 - -Auth: - AccessSecret: sundynix-jwt-secret-2024 - AccessExpire: 604800 - -RadioRpc: - Etcd: - Hosts: - - 192.168.100.127:2379 - Key: radio.rpc - -UserRpc: - Etcd: - Hosts: - - 192.168.100.127:2379 - Key: user.rpc - -FileRpc: - Etcd: - Hosts: - - 192.168.100.127:2379 - Key: file.rpc diff --git a/app/radio/api/internal/config/config.go b/app/radio/api/internal/config/config.go deleted file mode 100644 index bf43961..0000000 --- a/app/radio/api/internal/config/config.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package config - -import ( - "github.com/zeromicro/go-zero/rest" - "github.com/zeromicro/go-zero/zrpc" -) - -type Config struct { - rest.RestConf - Auth struct { - AccessSecret string - AccessExpire int64 - } - RadioRpc zrpc.RpcClientConf - UserRpc zrpc.RpcClientConf - FileRpc zrpc.RpcClientConf -} diff --git a/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go b/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go deleted file mode 100644 index 8c4e605..0000000 --- a/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/analytics" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 数据概览 -func GetAnalyticsOverviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AnalyticsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := analytics.NewGetAnalyticsOverviewLogic(r.Context(), svcCtx) - err := l.GetAnalyticsOverview(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go b/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go deleted file mode 100644 index fe30c5a..0000000 --- a/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/analytics" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 频道数据 -func GetChannelAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AnalyticsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := analytics.NewGetChannelAnalyticsLogic(r.Context(), svcCtx) - err := l.GetChannelAnalytics(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go b/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go deleted file mode 100644 index 8d92047..0000000 --- a/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/analytics" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 用户数据 -func GetUserAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AnalyticsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := analytics.NewGetUserAnalyticsLogic(r.Context(), svcCtx) - err := l.GetUserAnalytics(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go b/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go deleted file mode 100644 index 193d351..0000000 --- a/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package callback - -import ( - "net/http" - - "sundynix-micro-go/app/radio/api/internal/logic/callback" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/common/response" -) - -// 微信支付回调 -func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := callback.NewWechatPayCallbackLogic(r.Context(), svcCtx) - err := l.WechatPayCallback() - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/category/createCategoryHandler.go b/app/radio/api/internal/handler/category/createCategoryHandler.go deleted file mode 100644 index 3f1b76f..0000000 --- a/app/radio/api/internal/handler/category/createCategoryHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/category" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 创建分类 -func CreateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CategoryReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := category.NewCreateCategoryLogic(r.Context(), svcCtx) - err := l.CreateCategory(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/category/deleteCategoryHandler.go b/app/radio/api/internal/handler/category/deleteCategoryHandler.go deleted file mode 100644 index b71a830..0000000 --- a/app/radio/api/internal/handler/category/deleteCategoryHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/category" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 删除分类 -func DeleteCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := category.NewDeleteCategoryLogic(r.Context(), svcCtx) - err := l.DeleteCategory(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/category/getCategoryListHandler.go b/app/radio/api/internal/handler/category/getCategoryListHandler.go deleted file mode 100644 index ba49c30..0000000 --- a/app/radio/api/internal/handler/category/getCategoryListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/category" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 分类列表 -func GetCategoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CategoryListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := category.NewGetCategoryListLogic(r.Context(), svcCtx) - err := l.GetCategoryList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/category/updateCategoryHandler.go b/app/radio/api/internal/handler/category/updateCategoryHandler.go deleted file mode 100644 index 410fec1..0000000 --- a/app/radio/api/internal/handler/category/updateCategoryHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/category" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 更新分类 -func UpdateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CategoryUpdateReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := category.NewUpdateCategoryLogic(r.Context(), svcCtx) - err := l.UpdateCategory(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/channel/createChannelHandler.go b/app/radio/api/internal/handler/channel/createChannelHandler.go deleted file mode 100644 index 675b7dc..0000000 --- a/app/radio/api/internal/handler/channel/createChannelHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/channel" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 创建频道 -func CreateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ChannelReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := channel.NewCreateChannelLogic(r.Context(), svcCtx) - err := l.CreateChannel(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/channel/deleteChannelHandler.go b/app/radio/api/internal/handler/channel/deleteChannelHandler.go deleted file mode 100644 index 3e9d943..0000000 --- a/app/radio/api/internal/handler/channel/deleteChannelHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/channel" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 删除频道 -func DeleteChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := channel.NewDeleteChannelLogic(r.Context(), svcCtx) - err := l.DeleteChannel(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/channel/getChannelDetailHandler.go b/app/radio/api/internal/handler/channel/getChannelDetailHandler.go deleted file mode 100644 index a80a9e2..0000000 --- a/app/radio/api/internal/handler/channel/getChannelDetailHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/channel" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 频道详情 -func GetChannelDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdPathReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := channel.NewGetChannelDetailLogic(r.Context(), svcCtx) - err := l.GetChannelDetail(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/channel/getChannelListHandler.go b/app/radio/api/internal/handler/channel/getChannelListHandler.go deleted file mode 100644 index 7963a15..0000000 --- a/app/radio/api/internal/handler/channel/getChannelListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/channel" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 频道列表 -func GetChannelListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ChannelListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := channel.NewGetChannelListLogic(r.Context(), svcCtx) - err := l.GetChannelList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/channel/updateChannelHandler.go b/app/radio/api/internal/handler/channel/updateChannelHandler.go deleted file mode 100644 index a3710ea..0000000 --- a/app/radio/api/internal/handler/channel/updateChannelHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/channel" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 更新频道 -func UpdateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ChannelUpdateReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := channel.NewUpdateChannelLogic(r.Context(), svcCtx) - err := l.UpdateChannel(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/commentProgramHandler.go b/app/radio/api/internal/handler/interaction/commentProgramHandler.go deleted file mode 100644 index 197a8d6..0000000 --- a/app/radio/api/internal/handler/interaction/commentProgramHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 评论节目 -func CommentProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommentReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewCommentProgramLogic(r.Context(), svcCtx) - err := l.CommentProgram(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go b/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go deleted file mode 100644 index b72cfb7..0000000 --- a/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 我的收藏列表 -func GetFavoriteListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.HistoryListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewGetFavoriteListLogic(r.Context(), svcCtx) - err := l.GetFavoriteList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/getHistoryListHandler.go b/app/radio/api/internal/handler/interaction/getHistoryListHandler.go deleted file mode 100644 index 85a1d36..0000000 --- a/app/radio/api/internal/handler/interaction/getHistoryListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 播放历史列表 -func GetHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.HistoryListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewGetHistoryListLogic(r.Context(), svcCtx) - err := l.GetHistoryList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/recordHistoryHandler.go b/app/radio/api/internal/handler/interaction/recordHistoryHandler.go deleted file mode 100644 index ff598c4..0000000 --- a/app/radio/api/internal/handler/interaction/recordHistoryHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 记录播放历史 -func RecordHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.HistoryReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewRecordHistoryLogic(r.Context(), svcCtx) - err := l.RecordHistory(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go b/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go deleted file mode 100644 index 9777f30..0000000 --- a/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 收藏/取消收藏 -func ToggleFavoriteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.FavoriteReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewToggleFavoriteLogic(r.Context(), svcCtx) - err := l.ToggleFavorite(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/interaction/toggleLikeHandler.go b/app/radio/api/internal/handler/interaction/toggleLikeHandler.go deleted file mode 100644 index 76e8872..0000000 --- a/app/radio/api/internal/handler/interaction/toggleLikeHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/interaction" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 点赞/取消点赞 -func ToggleLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.LikeReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := interaction.NewToggleLikeLogic(r.Context(), svcCtx) - err := l.ToggleLike(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/pay/createPayOrderHandler.go b/app/radio/api/internal/handler/pay/createPayOrderHandler.go deleted file mode 100644 index 35ad0d2..0000000 --- a/app/radio/api/internal/handler/pay/createPayOrderHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package pay - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/pay" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 创建支付订单 -func CreatePayOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreatePayOrderReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := pay.NewCreatePayOrderLogic(r.Context(), svcCtx) - err := l.CreatePayOrder(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/createProgramHandler.go b/app/radio/api/internal/handler/program/createProgramHandler.go deleted file mode 100644 index 680eaf4..0000000 --- a/app/radio/api/internal/handler/program/createProgramHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 创建节目 -func CreateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ProgramReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewCreateProgramLogic(r.Context(), svcCtx) - err := l.CreateProgram(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/deleteProgramHandler.go b/app/radio/api/internal/handler/program/deleteProgramHandler.go deleted file mode 100644 index bb5f9bf..0000000 --- a/app/radio/api/internal/handler/program/deleteProgramHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 删除节目 -func DeleteProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewDeleteProgramLogic(r.Context(), svcCtx) - err := l.DeleteProgram(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/generateTtsHandler.go b/app/radio/api/internal/handler/program/generateTtsHandler.go deleted file mode 100644 index 2920203..0000000 --- a/app/radio/api/internal/handler/program/generateTtsHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// TTS生成音频 -func GenerateTtsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.TtsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewGenerateTtsLogic(r.Context(), svcCtx) - err := l.GenerateTts(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/getProgramDetailHandler.go b/app/radio/api/internal/handler/program/getProgramDetailHandler.go deleted file mode 100644 index 7baa7a5..0000000 --- a/app/radio/api/internal/handler/program/getProgramDetailHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 节目详情 -func GetProgramDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdPathReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewGetProgramDetailLogic(r.Context(), svcCtx) - err := l.GetProgramDetail(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/getProgramListHandler.go b/app/radio/api/internal/handler/program/getProgramListHandler.go deleted file mode 100644 index 76e3ae2..0000000 --- a/app/radio/api/internal/handler/program/getProgramListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 节目列表 -func GetProgramListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ProgramListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewGetProgramListLogic(r.Context(), svcCtx) - err := l.GetProgramList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/program/updateProgramHandler.go b/app/radio/api/internal/handler/program/updateProgramHandler.go deleted file mode 100644 index ffc9ffe..0000000 --- a/app/radio/api/internal/handler/program/updateProgramHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/program" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 更新节目 -func UpdateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ProgramUpdateReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := program.NewUpdateProgramLogic(r.Context(), svcCtx) - err := l.UpdateProgram(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/routes.go b/app/radio/api/internal/handler/routes.go deleted file mode 100644 index 9e5c8c2..0000000 --- a/app/radio/api/internal/handler/routes.go +++ /dev/null @@ -1,291 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 - -package handler - -import ( - "net/http" - - analytics "sundynix-micro-go/app/radio/api/internal/handler/analytics" - callback "sundynix-micro-go/app/radio/api/internal/handler/callback" - category "sundynix-micro-go/app/radio/api/internal/handler/category" - channel "sundynix-micro-go/app/radio/api/internal/handler/channel" - interaction "sundynix-micro-go/app/radio/api/internal/handler/interaction" - pay "sundynix-micro-go/app/radio/api/internal/handler/pay" - program "sundynix-micro-go/app/radio/api/internal/handler/program" - subscription "sundynix-micro-go/app/radio/api/internal/handler/subscription" - vip "sundynix-micro-go/app/radio/api/internal/handler/vip" - voice "sundynix-micro-go/app/radio/api/internal/handler/voice" - "sundynix-micro-go/app/radio/api/internal/svc" - - "github.com/zeromicro/go-zero/rest" -) - -func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { - server.AddRoutes( - []rest.Route{ - { - // 频道数据 - Method: http.MethodPost, - Path: "/analytics/channel", - Handler: analytics.GetChannelAnalyticsHandler(serverCtx), - }, - { - // 数据概览 - Method: http.MethodPost, - Path: "/analytics/overview", - Handler: analytics.GetAnalyticsOverviewHandler(serverCtx), - }, - { - // 用户数据 - Method: http.MethodPost, - Path: "/analytics/user", - Handler: analytics.GetUserAnalyticsHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 微信支付回调 - Method: http.MethodPost, - Path: "/callback/wechatpay", - Handler: callback.WechatPayCallbackHandler(serverCtx), - }, - }, - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 创建分类 - Method: http.MethodPost, - Path: "/category/create", - Handler: category.CreateCategoryHandler(serverCtx), - }, - { - // 删除分类 - Method: http.MethodDelete, - Path: "/category/delete", - Handler: category.DeleteCategoryHandler(serverCtx), - }, - { - // 分类列表 - Method: http.MethodPost, - Path: "/category/list", - Handler: category.GetCategoryListHandler(serverCtx), - }, - { - // 更新分类 - Method: http.MethodPut, - Path: "/category/update", - Handler: category.UpdateCategoryHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 频道详情 - Method: http.MethodGet, - Path: "/channel/:id", - Handler: channel.GetChannelDetailHandler(serverCtx), - }, - { - // 创建频道 - Method: http.MethodPost, - Path: "/channel/create", - Handler: channel.CreateChannelHandler(serverCtx), - }, - { - // 删除频道 - Method: http.MethodDelete, - Path: "/channel/delete", - Handler: channel.DeleteChannelHandler(serverCtx), - }, - { - // 频道列表 - Method: http.MethodPost, - Path: "/channel/list", - Handler: channel.GetChannelListHandler(serverCtx), - }, - { - // 更新频道 - Method: http.MethodPut, - Path: "/channel/update", - Handler: channel.UpdateChannelHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 评论节目 - Method: http.MethodPost, - Path: "/interaction/comment", - Handler: interaction.CommentProgramHandler(serverCtx), - }, - { - // 收藏/取消收藏 - Method: http.MethodPost, - Path: "/interaction/favorite", - Handler: interaction.ToggleFavoriteHandler(serverCtx), - }, - { - // 我的收藏列表 - Method: http.MethodPost, - Path: "/interaction/favorite/list", - Handler: interaction.GetFavoriteListHandler(serverCtx), - }, - { - // 记录播放历史 - Method: http.MethodPost, - Path: "/interaction/history", - Handler: interaction.RecordHistoryHandler(serverCtx), - }, - { - // 播放历史列表 - Method: http.MethodPost, - Path: "/interaction/history/list", - Handler: interaction.GetHistoryListHandler(serverCtx), - }, - { - // 点赞/取消点赞 - Method: http.MethodPost, - Path: "/interaction/like", - Handler: interaction.ToggleLikeHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 创建支付订单 - Method: http.MethodPost, - Path: "/pay/create", - Handler: pay.CreatePayOrderHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 节目详情 - Method: http.MethodGet, - Path: "/program/:id", - Handler: program.GetProgramDetailHandler(serverCtx), - }, - { - // 创建节目 - Method: http.MethodPost, - Path: "/program/create", - Handler: program.CreateProgramHandler(serverCtx), - }, - { - // 删除节目 - Method: http.MethodDelete, - Path: "/program/delete", - Handler: program.DeleteProgramHandler(serverCtx), - }, - { - // 节目列表 - Method: http.MethodPost, - Path: "/program/list", - Handler: program.GetProgramListHandler(serverCtx), - }, - { - // TTS生成音频 - Method: http.MethodPost, - Path: "/program/tts", - Handler: program.GenerateTtsHandler(serverCtx), - }, - { - // 更新节目 - Method: http.MethodPut, - Path: "/program/update", - Handler: program.UpdateProgramHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 我的订阅列表 - Method: http.MethodGet, - Path: "/subscription/list", - Handler: subscription.GetMySubscriptionsHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 我的VIP信息 - Method: http.MethodGet, - Path: "/vip/info", - Handler: vip.GetMyVipInfoHandler(serverCtx), - }, - { - // VIP配置列表 - Method: http.MethodPost, - Path: "/vip/list", - Handler: vip.GetVipConfigListHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) - - server.AddRoutes( - []rest.Route{ - { - // 创建音色 - Method: http.MethodPost, - Path: "/voice/create", - Handler: voice.CreateVoiceHandler(serverCtx), - }, - { - // 删除音色 - Method: http.MethodDelete, - Path: "/voice/delete", - Handler: voice.DeleteVoiceHandler(serverCtx), - }, - { - // 音色列表 - Method: http.MethodPost, - Path: "/voice/list", - Handler: voice.GetVoiceListHandler(serverCtx), - }, - { - // 更新音色 - Method: http.MethodPut, - Path: "/voice/update", - Handler: voice.UpdateVoiceHandler(serverCtx), - }, - }, - rest.WithJwt(serverCtx.Config.Auth.AccessSecret), - rest.WithPrefix("/api/radio"), - ) -} diff --git a/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go b/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go deleted file mode 100644 index f95e067..0000000 --- a/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package subscription - -import ( - "net/http" - - "sundynix-micro-go/app/radio/api/internal/logic/subscription" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/common/response" -) - -// 我的订阅列表 -func GetMySubscriptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := subscription.NewGetMySubscriptionsLogic(r.Context(), svcCtx) - err := l.GetMySubscriptions() - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go b/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go deleted file mode 100644 index b4f7a2d..0000000 --- a/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package vip - -import ( - "net/http" - - "sundynix-micro-go/app/radio/api/internal/logic/vip" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/common/response" -) - -// 我的VIP信息 -func GetMyVipInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := vip.NewGetMyVipInfoLogic(r.Context(), svcCtx) - err := l.GetMyVipInfo() - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/vip/getVipConfigListHandler.go b/app/radio/api/internal/handler/vip/getVipConfigListHandler.go deleted file mode 100644 index ef8c2c1..0000000 --- a/app/radio/api/internal/handler/vip/getVipConfigListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package vip - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/vip" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// VIP配置列表 -func GetVipConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.VipConfigListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := vip.NewGetVipConfigListLogic(r.Context(), svcCtx) - err := l.GetVipConfigList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/voice/createVoiceHandler.go b/app/radio/api/internal/handler/voice/createVoiceHandler.go deleted file mode 100644 index 491b8be..0000000 --- a/app/radio/api/internal/handler/voice/createVoiceHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/voice" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 创建音色 -func CreateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.VoiceReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := voice.NewCreateVoiceLogic(r.Context(), svcCtx) - err := l.CreateVoice(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/voice/deleteVoiceHandler.go b/app/radio/api/internal/handler/voice/deleteVoiceHandler.go deleted file mode 100644 index 5f9fdf0..0000000 --- a/app/radio/api/internal/handler/voice/deleteVoiceHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/voice" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 删除音色 -func DeleteVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.IdsReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := voice.NewDeleteVoiceLogic(r.Context(), svcCtx) - err := l.DeleteVoice(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/voice/getVoiceListHandler.go b/app/radio/api/internal/handler/voice/getVoiceListHandler.go deleted file mode 100644 index 3a9d8c9..0000000 --- a/app/radio/api/internal/handler/voice/getVoiceListHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/voice" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 音色列表 -func GetVoiceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.VoiceListReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := voice.NewGetVoiceListLogic(r.Context(), svcCtx) - err := l.GetVoiceList(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/handler/voice/updateVoiceHandler.go b/app/radio/api/internal/handler/voice/updateVoiceHandler.go deleted file mode 100644 index 9b131b1..0000000 --- a/app/radio/api/internal/handler/voice/updateVoiceHandler.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/radio/api/internal/logic/voice" - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - "sundynix-micro-go/common/response" -) - -// 更新音色 -func UpdateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.VoiceUpdateReq - if err := httpx.Parse(r, &req); err != nil { - response.Fail(w, err.Error()) - return - } - - l := voice.NewUpdateVoiceLogic(r.Context(), svcCtx) - err := l.UpdateVoice(&req) - if err != nil { - response.Fail(w, err.Error()) - } else { - response.Ok(w) - } - } -} diff --git a/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go b/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go deleted file mode 100644 index 89d0238..0000000 --- a/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetAnalyticsOverviewLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 数据概览 -func NewGetAnalyticsOverviewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnalyticsOverviewLogic { - return &GetAnalyticsOverviewLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetAnalyticsOverviewLogic) GetAnalyticsOverview(req *types.AnalyticsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go b/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go deleted file mode 100644 index 43aaf2b..0000000 --- a/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelAnalyticsLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 频道数据 -func NewGetChannelAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelAnalyticsLogic { - return &GetChannelAnalyticsLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetChannelAnalyticsLogic) GetChannelAnalytics(req *types.AnalyticsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go b/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go deleted file mode 100644 index a51ba66..0000000 --- a/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package analytics - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetUserAnalyticsLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 用户数据 -func NewGetUserAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAnalyticsLogic { - return &GetUserAnalyticsLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetUserAnalyticsLogic) GetUserAnalytics(req *types.AnalyticsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go b/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go deleted file mode 100644 index b2e4b43..0000000 --- a/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package callback - -import ( - "context" - - "github.com/zeromicro/go-zero/core/logx" - "sundynix-micro-go/app/radio/api/internal/svc" -) - -type WechatPayCallbackLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 微信支付回调 -func NewWechatPayCallbackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WechatPayCallbackLogic { - return &WechatPayCallbackLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *WechatPayCallbackLogic) WechatPayCallback() error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/category/createCategoryLogic.go b/app/radio/api/internal/logic/category/createCategoryLogic.go deleted file mode 100644 index 6687b98..0000000 --- a/app/radio/api/internal/logic/category/createCategoryLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateCategoryLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 创建分类 -func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic { - return &CreateCategoryLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CreateCategoryLogic) CreateCategory(req *types.CategoryReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/category/deleteCategoryLogic.go b/app/radio/api/internal/logic/category/deleteCategoryLogic.go deleted file mode 100644 index 71c6fe6..0000000 --- a/app/radio/api/internal/logic/category/deleteCategoryLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteCategoryLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 删除分类 -func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic { - return &DeleteCategoryLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *DeleteCategoryLogic) DeleteCategory(req *types.IdsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/category/getCategoryListLogic.go b/app/radio/api/internal/logic/category/getCategoryListLogic.go deleted file mode 100644 index 07b5d82..0000000 --- a/app/radio/api/internal/logic/category/getCategoryListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetCategoryListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 分类列表 -func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic { - return &GetCategoryListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetCategoryListLogic) GetCategoryList(req *types.CategoryListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/category/updateCategoryLogic.go b/app/radio/api/internal/logic/category/updateCategoryLogic.go deleted file mode 100644 index 87a0199..0000000 --- a/app/radio/api/internal/logic/category/updateCategoryLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package category - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateCategoryLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 更新分类 -func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateCategoryLogic { - return &UpdateCategoryLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *UpdateCategoryLogic) UpdateCategory(req *types.CategoryUpdateReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/channel/createChannelLogic.go b/app/radio/api/internal/logic/channel/createChannelLogic.go deleted file mode 100644 index b7e04e7..0000000 --- a/app/radio/api/internal/logic/channel/createChannelLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateChannelLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 创建频道 -func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic { - return &CreateChannelLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CreateChannelLogic) CreateChannel(req *types.ChannelReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/channel/deleteChannelLogic.go b/app/radio/api/internal/logic/channel/deleteChannelLogic.go deleted file mode 100644 index 3ee1c99..0000000 --- a/app/radio/api/internal/logic/channel/deleteChannelLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteChannelLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 删除频道 -func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic { - return &DeleteChannelLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *DeleteChannelLogic) DeleteChannel(req *types.IdsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/channel/getChannelDetailLogic.go b/app/radio/api/internal/logic/channel/getChannelDetailLogic.go deleted file mode 100644 index 5da5de4..0000000 --- a/app/radio/api/internal/logic/channel/getChannelDetailLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelDetailLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 频道详情 -func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic { - return &GetChannelDetailLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetChannelDetailLogic) GetChannelDetail(req *types.IdPathReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/channel/getChannelListLogic.go b/app/radio/api/internal/logic/channel/getChannelListLogic.go deleted file mode 100644 index a912191..0000000 --- a/app/radio/api/internal/logic/channel/getChannelListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 频道列表 -func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic { - return &GetChannelListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetChannelListLogic) GetChannelList(req *types.ChannelListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/channel/updateChannelLogic.go b/app/radio/api/internal/logic/channel/updateChannelLogic.go deleted file mode 100644 index 9ed5ad5..0000000 --- a/app/radio/api/internal/logic/channel/updateChannelLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package channel - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateChannelLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 更新频道 -func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateChannelLogic { - return &UpdateChannelLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *UpdateChannelLogic) UpdateChannel(req *types.ChannelUpdateReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/commentProgramLogic.go b/app/radio/api/internal/logic/interaction/commentProgramLogic.go deleted file mode 100644 index 30f13db..0000000 --- a/app/radio/api/internal/logic/interaction/commentProgramLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CommentProgramLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 评论节目 -func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic { - return &CommentProgramLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CommentProgramLogic) CommentProgram(req *types.CommentReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go b/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go deleted file mode 100644 index b8d6b21..0000000 --- a/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetFavoriteListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 我的收藏列表 -func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic { - return &GetFavoriteListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetFavoriteListLogic) GetFavoriteList(req *types.HistoryListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/getHistoryListLogic.go b/app/radio/api/internal/logic/interaction/getHistoryListLogic.go deleted file mode 100644 index 87de32a..0000000 --- a/app/radio/api/internal/logic/interaction/getHistoryListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetHistoryListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 播放历史列表 -func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic { - return &GetHistoryListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetHistoryListLogic) GetHistoryList(req *types.HistoryListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/recordHistoryLogic.go b/app/radio/api/internal/logic/interaction/recordHistoryLogic.go deleted file mode 100644 index 62cb478..0000000 --- a/app/radio/api/internal/logic/interaction/recordHistoryLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type RecordHistoryLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 记录播放历史 -func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic { - return &RecordHistoryLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *RecordHistoryLogic) RecordHistory(req *types.HistoryReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go b/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go deleted file mode 100644 index 07a54a5..0000000 --- a/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type ToggleFavoriteLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 收藏/取消收藏 -func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic { - return &ToggleFavoriteLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *ToggleFavoriteLogic) ToggleFavorite(req *types.FavoriteReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/interaction/toggleLikeLogic.go b/app/radio/api/internal/logic/interaction/toggleLikeLogic.go deleted file mode 100644 index f399e8d..0000000 --- a/app/radio/api/internal/logic/interaction/toggleLikeLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package interaction - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type ToggleLikeLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 点赞/取消点赞 -func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleLikeLogic { - return &ToggleLikeLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *ToggleLikeLogic) ToggleLike(req *types.LikeReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/pay/createPayOrderLogic.go b/app/radio/api/internal/logic/pay/createPayOrderLogic.go deleted file mode 100644 index 6bec0f4..0000000 --- a/app/radio/api/internal/logic/pay/createPayOrderLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package pay - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreatePayOrderLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 创建支付订单 -func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic { - return &CreatePayOrderLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CreatePayOrderLogic) CreatePayOrder(req *types.CreatePayOrderReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/createProgramLogic.go b/app/radio/api/internal/logic/program/createProgramLogic.go deleted file mode 100644 index 57bf1db..0000000 --- a/app/radio/api/internal/logic/program/createProgramLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateProgramLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 创建节目 -func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic { - return &CreateProgramLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CreateProgramLogic) CreateProgram(req *types.ProgramReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/deleteProgramLogic.go b/app/radio/api/internal/logic/program/deleteProgramLogic.go deleted file mode 100644 index e790b44..0000000 --- a/app/radio/api/internal/logic/program/deleteProgramLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteProgramLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 删除节目 -func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic { - return &DeleteProgramLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *DeleteProgramLogic) DeleteProgram(req *types.IdsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/generateTtsLogic.go b/app/radio/api/internal/logic/program/generateTtsLogic.go deleted file mode 100644 index 126550d..0000000 --- a/app/radio/api/internal/logic/program/generateTtsLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GenerateTtsLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// TTS生成音频 -func NewGenerateTtsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GenerateTtsLogic { - return &GenerateTtsLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GenerateTtsLogic) GenerateTts(req *types.TtsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/getProgramDetailLogic.go b/app/radio/api/internal/logic/program/getProgramDetailLogic.go deleted file mode 100644 index 2cab661..0000000 --- a/app/radio/api/internal/logic/program/getProgramDetailLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetProgramDetailLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 节目详情 -func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic { - return &GetProgramDetailLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetProgramDetailLogic) GetProgramDetail(req *types.IdPathReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/getProgramListLogic.go b/app/radio/api/internal/logic/program/getProgramListLogic.go deleted file mode 100644 index eb3a7d2..0000000 --- a/app/radio/api/internal/logic/program/getProgramListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetProgramListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 节目列表 -func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic { - return &GetProgramListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetProgramListLogic) GetProgramList(req *types.ProgramListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/program/updateProgramLogic.go b/app/radio/api/internal/logic/program/updateProgramLogic.go deleted file mode 100644 index 5cafcc6..0000000 --- a/app/radio/api/internal/logic/program/updateProgramLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package program - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateProgramLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 更新节目 -func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProgramLogic { - return &UpdateProgramLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *UpdateProgramLogic) UpdateProgram(req *types.ProgramUpdateReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go b/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go deleted file mode 100644 index fda38c9..0000000 --- a/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package subscription - -import ( - "context" - - "github.com/zeromicro/go-zero/core/logx" - "sundynix-micro-go/app/radio/api/internal/svc" -) - -type GetMySubscriptionsLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 我的订阅列表 -func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic { - return &GetMySubscriptionsLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetMySubscriptionsLogic) GetMySubscriptions() error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go b/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go deleted file mode 100644 index 24a9c9c..0000000 --- a/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package vip - -import ( - "context" - - "github.com/zeromicro/go-zero/core/logx" - "sundynix-micro-go/app/radio/api/internal/svc" -) - -type GetMyVipInfoLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 我的VIP信息 -func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic { - return &GetMyVipInfoLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetMyVipInfoLogic) GetMyVipInfo() error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/vip/getVipConfigListLogic.go b/app/radio/api/internal/logic/vip/getVipConfigListLogic.go deleted file mode 100644 index 3560f8a..0000000 --- a/app/radio/api/internal/logic/vip/getVipConfigListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package vip - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetVipConfigListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// VIP配置列表 -func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic { - return &GetVipConfigListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetVipConfigListLogic) GetVipConfigList(req *types.VipConfigListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/voice/createVoiceLogic.go b/app/radio/api/internal/logic/voice/createVoiceLogic.go deleted file mode 100644 index 89a61cc..0000000 --- a/app/radio/api/internal/logic/voice/createVoiceLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateVoiceLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 创建音色 -func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic { - return &CreateVoiceLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *CreateVoiceLogic) CreateVoice(req *types.VoiceReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/voice/deleteVoiceLogic.go b/app/radio/api/internal/logic/voice/deleteVoiceLogic.go deleted file mode 100644 index 1cb8f09..0000000 --- a/app/radio/api/internal/logic/voice/deleteVoiceLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteVoiceLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 删除音色 -func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic { - return &DeleteVoiceLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *DeleteVoiceLogic) DeleteVoice(req *types.IdsReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/voice/getVoiceListLogic.go b/app/radio/api/internal/logic/voice/getVoiceListLogic.go deleted file mode 100644 index ba5ff45..0000000 --- a/app/radio/api/internal/logic/voice/getVoiceListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetVoiceListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 音色列表 -func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic { - return &GetVoiceListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetVoiceListLogic) GetVoiceList(req *types.VoiceListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/logic/voice/updateVoiceLogic.go b/app/radio/api/internal/logic/voice/updateVoiceLogic.go deleted file mode 100644 index 7e239b0..0000000 --- a/app/radio/api/internal/logic/voice/updateVoiceLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package voice - -import ( - "context" - - "sundynix-micro-go/app/radio/api/internal/svc" - "sundynix-micro-go/app/radio/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateVoiceLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 更新音色 -func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVoiceLogic { - return &UpdateVoiceLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *UpdateVoiceLogic) UpdateVoice(req *types.VoiceUpdateReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/radio/api/internal/svc/serviceContext.go b/app/radio/api/internal/svc/serviceContext.go deleted file mode 100644 index 5bbbdf9..0000000 --- a/app/radio/api/internal/svc/serviceContext.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package svc - -import ( - "sundynix-micro-go/app/file/rpc/fileservice" - "sundynix-micro-go/app/radio/api/internal/config" - "sundynix-micro-go/app/radio/rpc/radioservice" - "sundynix-micro-go/app/user/rpc/userservice" - - "github.com/zeromicro/go-zero/zrpc" -) - -type ServiceContext struct { - Config config.Config - RadioRpc radioservice.RadioService - UserRpc userservice.UserService - FileRpc fileservice.FileService -} - -func NewServiceContext(c config.Config) *ServiceContext { - return &ServiceContext{ - Config: c, - RadioRpc: radioservice.NewRadioService(zrpc.MustNewClient(c.RadioRpc)), - UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), - FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)), - } -} diff --git a/app/radio/api/internal/types/types.go b/app/radio/api/internal/types/types.go deleted file mode 100644 index 19e587e..0000000 --- a/app/radio/api/internal/types/types.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 - -package types - -type AnalyticsReq struct { - StartDate string `json:"startDate,optional"` - EndDate string `json:"endDate,optional"` -} - -type CategoryListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - Name string `json:"name,optional"` -} - -type CategoryReq struct { - Name string `json:"name"` - Icon string `json:"icon,optional"` - Sort int `json:"sort,optional"` -} - -type CategoryUpdateReq struct { - Id string `json:"id"` - Name string `json:"name,optional"` - Icon string `json:"icon,optional"` - Sort int `json:"sort,optional"` -} - -type ChannelListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - CategoryId string `json:"categoryId,optional"` - Name string `json:"name,optional"` -} - -type ChannelReq struct { - CategoryId string `json:"categoryId"` - Name string `json:"name"` - Description string `json:"description,optional"` - IsFree int `json:"isFree,optional"` - IsVipOnly int `json:"isVipOnly,optional"` - MonthlyPrice int `json:"monthlyPrice,optional"` - QuarterlyPrice int `json:"quarterlyPrice,optional"` - AnnualPrice int `json:"annualPrice,optional"` - Cover string `json:"cover,optional"` - Tags string `json:"tags,optional"` - Sort int `json:"sort,optional"` -} - -type ChannelUpdateReq struct { - Id string `json:"id"` - CategoryId string `json:"categoryId,optional"` - Name string `json:"name,optional"` - Description string `json:"description,optional"` - IsFree int `json:"isFree,optional"` - IsVipOnly int `json:"isVipOnly,optional"` - MonthlyPrice int `json:"monthlyPrice,optional"` - QuarterlyPrice int `json:"quarterlyPrice,optional"` - AnnualPrice int `json:"annualPrice,optional"` - Cover string `json:"cover,optional"` - Tags string `json:"tags,optional"` - Sort int `json:"sort,optional"` - Status int `json:"status,optional"` -} - -type CommentReq struct { - ProgramId string `json:"programId"` - Content string `json:"content"` - ParentId string `json:"parentId,optional"` -} - -type CreatePayOrderReq struct { - ChannelId string `json:"channelId,optional"` - PlanType string `json:"planType"` - OrderType string `json:"orderType"` -} - -type FavoriteReq struct { - ProgramId string `json:"programId"` -} - -type HistoryListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` -} - -type HistoryReq struct { - ProgramId string `json:"programId"` - Duration int `json:"duration,optional"` -} - -type IdPathReq struct { - Id string `path:"id"` -} - -type IdReq struct { - Id string `json:"id"` -} - -type IdsReq struct { - Ids []string `json:"ids"` -} - -type LikeReq struct { - ProgramId string `json:"programId"` -} - -type ProgramListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - ChannelId string `json:"channelId,optional"` - Title string `json:"title,optional"` -} - -type ProgramReq struct { - ChannelId string `json:"channelId"` - Title string `json:"title"` - Description string `json:"description,optional"` - Content string `json:"content,optional"` - Cover string `json:"cover,optional"` - AudioId string `json:"audioId,optional"` - Tags string `json:"tags,optional"` -} - -type ProgramUpdateReq struct { - Id string `json:"id"` - ChannelId string `json:"channelId,optional"` - Title string `json:"title,optional"` - Description string `json:"description,optional"` - Content string `json:"content,optional"` - Cover string `json:"cover,optional"` - AudioId string `json:"audioId,optional"` - Tags string `json:"tags,optional"` - Status int `json:"status,optional"` -} - -type SubscribeReq struct { - ChannelId string `json:"channelId"` - PlanType string `json:"planType"` -} - -type TtsReq struct { - Text string `json:"text"` - SpeakerId string `json:"speakerId,optional"` -} - -type VipConfigListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` -} - -type VoiceListReq struct { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - Gender string `json:"gender,optional"` -} - -type VoiceReq struct { - SpeakerId string `json:"speakerId"` - Name string `json:"name"` - Description string `json:"description,optional"` - Gender string `json:"gender,optional"` - Icon string `json:"icon,optional"` - AudioId string `json:"audioId,optional"` - Sort int `json:"sort,optional"` - IsDefault int `json:"isDefault,optional"` -} - -type VoiceUpdateReq struct { - Id string `json:"id"` - Name string `json:"name,optional"` - Description string `json:"description,optional"` - Gender string `json:"gender,optional"` - Icon string `json:"icon,optional"` - AudioId string `json:"audioId,optional"` - Sort int `json:"sort,optional"` - IsDefault int `json:"isDefault,optional"` - Status int `json:"status,optional"` -} diff --git a/app/radio/api/radio.api b/app/radio/api/radio.api deleted file mode 100644 index 5506cf8..0000000 --- a/app/radio/api/radio.api +++ /dev/null @@ -1,377 +0,0 @@ -syntax = "v1" - -info ( - title: "电台业务服务API" - desc: "频道、节目、订阅、互动、支付、VIP、音色等HTTP接口" - author: "sundynix" - version: "v1.0.0" -) - -type ( - // ---------- 通用 ---------- - IdReq { - Id string `json:"id"` - } - IdPathReq { - Id string `path:"id"` - } - IdsReq { - Ids []string `json:"ids"` - } - // ---------- 分类 ---------- - CategoryReq { - Name string `json:"name"` - Icon string `json:"icon,optional"` - Sort int `json:"sort,optional"` - } - CategoryUpdateReq { - Id string `json:"id"` - Name string `json:"name,optional"` - Icon string `json:"icon,optional"` - Sort int `json:"sort,optional"` - } - CategoryListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - Name string `json:"name,optional"` - } - // ---------- 频道 ---------- - ChannelReq { - CategoryId string `json:"categoryId"` - Name string `json:"name"` - Description string `json:"description,optional"` - IsFree int `json:"isFree,optional"` - IsVipOnly int `json:"isVipOnly,optional"` - MonthlyPrice int `json:"monthlyPrice,optional"` - QuarterlyPrice int `json:"quarterlyPrice,optional"` - AnnualPrice int `json:"annualPrice,optional"` - Cover string `json:"cover,optional"` - Tags string `json:"tags,optional"` - Sort int `json:"sort,optional"` - } - ChannelUpdateReq { - Id string `json:"id"` - CategoryId string `json:"categoryId,optional"` - Name string `json:"name,optional"` - Description string `json:"description,optional"` - IsFree int `json:"isFree,optional"` - IsVipOnly int `json:"isVipOnly,optional"` - MonthlyPrice int `json:"monthlyPrice,optional"` - QuarterlyPrice int `json:"quarterlyPrice,optional"` - AnnualPrice int `json:"annualPrice,optional"` - Cover string `json:"cover,optional"` - Tags string `json:"tags,optional"` - Sort int `json:"sort,optional"` - Status int `json:"status,optional"` - } - ChannelListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - CategoryId string `json:"categoryId,optional"` - Name string `json:"name,optional"` - } - // ---------- 节目 ---------- - ProgramReq { - ChannelId string `json:"channelId"` - Title string `json:"title"` - Description string `json:"description,optional"` - Content string `json:"content,optional"` - Cover string `json:"cover,optional"` - AudioId string `json:"audioId,optional"` - Tags string `json:"tags,optional"` - } - ProgramUpdateReq { - Id string `json:"id"` - ChannelId string `json:"channelId,optional"` - Title string `json:"title,optional"` - Description string `json:"description,optional"` - Content string `json:"content,optional"` - Cover string `json:"cover,optional"` - AudioId string `json:"audioId,optional"` - Tags string `json:"tags,optional"` - Status int `json:"status,optional"` - } - ProgramListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - ChannelId string `json:"channelId,optional"` - Title string `json:"title,optional"` - } - // ---------- 音色 ---------- - VoiceReq { - SpeakerId string `json:"speakerId"` - Name string `json:"name"` - Description string `json:"description,optional"` - Gender string `json:"gender,optional"` - Icon string `json:"icon,optional"` - AudioId string `json:"audioId,optional"` - Sort int `json:"sort,optional"` - IsDefault int `json:"isDefault,optional"` - } - VoiceUpdateReq { - Id string `json:"id"` - Name string `json:"name,optional"` - Description string `json:"description,optional"` - Gender string `json:"gender,optional"` - Icon string `json:"icon,optional"` - AudioId string `json:"audioId,optional"` - Sort int `json:"sort,optional"` - IsDefault int `json:"isDefault,optional"` - Status int `json:"status,optional"` - } - VoiceListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - Gender string `json:"gender,optional"` - } - // ---------- 订阅 ---------- - SubscribeReq { - ChannelId string `json:"channelId"` - PlanType string `json:"planType"` - } - // ---------- 互动 ---------- - LikeReq { - ProgramId string `json:"programId"` - } - FavoriteReq { - ProgramId string `json:"programId"` - } - CommentReq { - ProgramId string `json:"programId"` - Content string `json:"content"` - ParentId string `json:"parentId,optional"` - } - HistoryReq { - ProgramId string `json:"programId"` - Duration int `json:"duration,optional"` - } - HistoryListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - } - // ---------- 支付 ---------- - CreatePayOrderReq { - ChannelId string `json:"channelId,optional"` - PlanType string `json:"planType"` - OrderType string `json:"orderType"` - } - // ---------- VIP ---------- - VipConfigListReq { - Current int `json:"current,optional"` - PageSize int `json:"pageSize,optional"` - } - // ---------- 数据分析 ---------- - AnalyticsReq { - StartDate string `json:"startDate,optional"` - EndDate string `json:"endDate,optional"` - } - // ---------- TTS ---------- - TtsReq { - Text string `json:"text"` - SpeakerId string `json:"speakerId,optional"` - } -) - -// ========== 无需鉴权 ========== -@server ( - prefix: /api/radio - group: callback -) -service radio-api { - @doc "微信支付回调" - @handler WechatPayCallback - post /callback/wechatpay -} - -// ========== 需要鉴权 ========== -@server ( - prefix: /api/radio - group: category - jwt: Auth -) -service radio-api { - @doc "创建分类" - @handler CreateCategory - post /category/create (CategoryReq) - - @doc "更新分类" - @handler UpdateCategory - put /category/update (CategoryUpdateReq) - - @doc "删除分类" - @handler DeleteCategory - delete /category/delete (IdsReq) - - @doc "分类列表" - @handler GetCategoryList - post /category/list (CategoryListReq) -} - -@server ( - prefix: /api/radio - group: channel - jwt: Auth -) -service radio-api { - @doc "创建频道" - @handler CreateChannel - post /channel/create (ChannelReq) - - @doc "更新频道" - @handler UpdateChannel - put /channel/update (ChannelUpdateReq) - - @doc "删除频道" - @handler DeleteChannel - delete /channel/delete (IdsReq) - - @doc "频道列表" - @handler GetChannelList - post /channel/list (ChannelListReq) - - @doc "频道详情" - @handler GetChannelDetail - get /channel/:id (IdPathReq) -} - -@server ( - prefix: /api/radio - group: program - jwt: Auth -) -service radio-api { - @doc "创建节目" - @handler CreateProgram - post /program/create (ProgramReq) - - @doc "更新节目" - @handler UpdateProgram - put /program/update (ProgramUpdateReq) - - @doc "删除节目" - @handler DeleteProgram - delete /program/delete (IdsReq) - - @doc "节目列表" - @handler GetProgramList - post /program/list (ProgramListReq) - - @doc "节目详情" - @handler GetProgramDetail - get /program/:id (IdPathReq) - - @doc "TTS生成音频" - @handler GenerateTts - post /program/tts (TtsReq) -} - -@server ( - prefix: /api/radio - group: voice - jwt: Auth -) -service radio-api { - @doc "创建音色" - @handler CreateVoice - post /voice/create (VoiceReq) - - @doc "更新音色" - @handler UpdateVoice - put /voice/update (VoiceUpdateReq) - - @doc "删除音色" - @handler DeleteVoice - delete /voice/delete (IdsReq) - - @doc "音色列表" - @handler GetVoiceList - post /voice/list (VoiceListReq) -} - -@server ( - prefix: /api/radio - group: subscription - jwt: Auth -) -service radio-api { - @doc "我的订阅列表" - @handler GetMySubscriptions - get /subscription/list -} - -@server ( - prefix: /api/radio - group: interaction - jwt: Auth -) -service radio-api { - @doc "点赞/取消点赞" - @handler ToggleLike - post /interaction/like (LikeReq) - - @doc "收藏/取消收藏" - @handler ToggleFavorite - post /interaction/favorite (FavoriteReq) - - @doc "评论节目" - @handler CommentProgram - post /interaction/comment (CommentReq) - - @doc "记录播放历史" - @handler RecordHistory - post /interaction/history (HistoryReq) - - @doc "播放历史列表" - @handler GetHistoryList - post /interaction/history/list (HistoryListReq) - - @doc "我的收藏列表" - @handler GetFavoriteList - post /interaction/favorite/list (HistoryListReq) -} - -@server ( - prefix: /api/radio - group: pay - jwt: Auth -) -service radio-api { - @doc "创建支付订单" - @handler CreatePayOrder - post /pay/create (CreatePayOrderReq) -} - -@server ( - prefix: /api/radio - group: vip - jwt: Auth -) -service radio-api { - @doc "VIP配置列表" - @handler GetVipConfigList - post /vip/list (VipConfigListReq) - - @doc "我的VIP信息" - @handler GetMyVipInfo - get /vip/info -} - -@server ( - prefix: /api/radio - group: analytics - jwt: Auth -) -service radio-api { - @doc "数据概览" - @handler GetAnalyticsOverview - post /analytics/overview (AnalyticsReq) - - @doc "频道数据" - @handler GetChannelAnalytics - post /analytics/channel (AnalyticsReq) - - @doc "用户数据" - @handler GetUserAnalytics - post /analytics/user (AnalyticsReq) -} - diff --git a/app/radio/api/radio.go b/app/radio/api/radio.go deleted file mode 100644 index 58743eb..0000000 --- a/app/radio/api/radio.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package main - -import ( - "flag" - "fmt" - - "sundynix-micro-go/app/radio/api/internal/config" - "sundynix-micro-go/app/radio/api/internal/handler" - "sundynix-micro-go/app/radio/api/internal/svc" - - "github.com/zeromicro/go-zero/core/conf" - "github.com/zeromicro/go-zero/rest" -) - -var configFile = flag.String("f", "etc/radio-api.yaml", "the config file") - -func main() { - flag.Parse() - - var c config.Config - conf.MustLoad(*configFile, &c) - - server := rest.MustNewServer(c.RestConf) - defer server.Stop() - - ctx := svc.NewServiceContext(c) - handler.RegisterHandlers(server, ctx) - - fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) - server.Start() -} diff --git a/app/radio/model/radio_model.go b/app/radio/model/radio_model.go deleted file mode 100644 index dcfee1f..0000000 --- a/app/radio/model/radio_model.go +++ /dev/null @@ -1,230 +0,0 @@ -package model - -import ( - "sundynix-micro-go/common/model" - "time" -) - -// ========== 用户扩展表(radio业务特有字段) ========== - -// SundynixRadioUserProfile 电台服务用户扩展表 -type SundynixRadioUserProfile struct { - model.BaseModel - UserID string `gorm:"size:50;uniqueIndex;column:user_id" json:"userId"` - NickName string `gorm:"size:100;column:nick_name" json:"nickName"` - AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"` - IsVip int `gorm:"default:0;column:is_vip" json:"isVip"` - VipExpireAt *time.Time `gorm:"column:vip_expire_at" json:"vipExpireAt"` - VipLevel int `gorm:"default:0;column:vip_level" json:"vipLevel"` -} - -func (SundynixRadioUserProfile) TableName() string { - return "sundynix_radio_user_profile" -} - -// ========== 分类 ========== - -// SundynixRadioCategory 电台分类 -type SundynixRadioCategory struct { - model.BaseModel - Name string `gorm:"size:50;column:name" json:"name"` - Icon string `gorm:"size:255;column:icon" json:"icon"` - Sort int `gorm:"default:0;column:sort" json:"sort"` -} - -func (SundynixRadioCategory) TableName() string { - return "sundynix_radio_category" -} - -// ========== 频道 ========== - -// SundynixRadioChannel 电台频道 -type SundynixRadioChannel struct { - model.BaseModel - CategoryID string `gorm:"size:50;index;column:category_id" json:"categoryId"` - Name string `gorm:"size:50;column:name" json:"name"` - Description string `gorm:"size:500;column:description" json:"description"` - IsFree int `gorm:"default:0;column:is_free" json:"isFree"` - IsVipOnly int `gorm:"default:0;column:is_vip_only" json:"isVipOnly"` - MonthlyPrice int `gorm:"default:0;column:monthly_price" json:"monthlyPrice"` - QuarterlyPrice int `gorm:"default:0;column:quarterly_price" json:"quarterlyPrice"` - AnnualPrice int `gorm:"default:0;column:annual_price" json:"annualPrice"` - Cover string `gorm:"size:100;column:cover" json:"cover"` - Tags string `gorm:"size:255;column:tags" json:"tags"` - Sort int `gorm:"default:0;column:sort" json:"sort"` - Status int `gorm:"default:1;column:status" json:"status"` -} - -func (SundynixRadioChannel) TableName() string { - return "sundynix_radio_channel" -} - -// ========== 节目 ========== - -// SundynixRadioProgram 电台节目 -type SundynixRadioProgram struct { - model.BaseModel - ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` - Title string `gorm:"size:100;column:title" json:"title"` - Description string `gorm:"size:500;column:description" json:"description"` - Content string `gorm:"type:text;column:content" json:"content"` - Cover string `gorm:"size:100;column:cover" json:"cover"` - AudioID string `gorm:"size:50;column:audio_id" json:"audioId"` - AudioStatus int `gorm:"default:0;column:audio_status" json:"audioStatus"` - Duration int `gorm:"default:0;column:duration" json:"duration"` - Tags string `gorm:"size:255;column:tags" json:"tags"` - PlayCount int `gorm:"default:0;column:play_count" json:"playCount"` - LikeCount int `gorm:"default:0;column:like_count" json:"likeCount"` - Status int `gorm:"default:1;column:status" json:"status"` -} - -func (SundynixRadioProgram) TableName() string { - return "sundynix_radio_program" -} - -// ========== 音色 ========== - -// SundynixRadioVoice 音色管理 -type SundynixRadioVoice struct { - model.BaseModel - SpeakerID string `gorm:"size:50;uniqueIndex;column:speaker_id" json:"speakerId"` - Name string `gorm:"size:50;column:name" json:"name"` - Description string `gorm:"size:255;column:description" json:"description"` - Gender string `gorm:"size:10;column:gender" json:"gender"` - Icon string `gorm:"size:255;column:icon" json:"icon"` - AudioID string `gorm:"size:50;column:audio_id" json:"audioId"` - Sort int `gorm:"default:0;column:sort" json:"sort"` - Status int `gorm:"default:1;column:status" json:"status"` - IsDefault int `gorm:"default:0;column:is_default" json:"isDefault"` - UseCount int `gorm:"default:0;column:use_count" json:"useCount"` -} - -func (SundynixRadioVoice) TableName() string { - return "sundynix_radio_voice" -} - -// ========== 互动 ========== - -// SundynixRadioLike 节目点赞 -type SundynixRadioLike struct { - model.BaseModel - ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` -} - -func (SundynixRadioLike) TableName() string { - return "sundynix_radio_like" -} - -// SundynixRadioFavorite 节目收藏 -type SundynixRadioFavorite struct { - model.BaseModel - ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` -} - -func (SundynixRadioFavorite) TableName() string { - return "sundynix_radio_favorite" -} - -// SundynixRadioComment 节目评论 -type SundynixRadioComment struct { - model.BaseModel - ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` - UserID string `gorm:"size:50;column:user_id" json:"userId"` - Content string `gorm:"size:500;column:content" json:"content"` - ParentID string `gorm:"size:50;column:parent_id" json:"parentId"` -} - -func (SundynixRadioComment) TableName() string { - return "sundynix_radio_comment" -} - -// SundynixRadioHistory 播放历史 -type SundynixRadioHistory struct { - model.BaseModel - ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` - Duration int `gorm:"default:0;column:duration" json:"duration"` -} - -func (SundynixRadioHistory) TableName() string { - return "sundynix_radio_history" -} - -// ========== 订阅/支付 ========== - -// SundynixRadioSubscription 用户订阅 -type SundynixRadioSubscription struct { - model.BaseModel - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` - ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` - ExpiredAt time.Time `gorm:"index;column:expired_at" json:"expiredAt"` - Status int `gorm:"default:1;column:status" json:"status"` -} - -func (SundynixRadioSubscription) TableName() string { - return "sundynix_radio_subscription" -} - -// SundynixRadioSubscriptionOrder 订阅订单 -type SundynixRadioSubscriptionOrder struct { - model.BaseModel - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` - ChannelID string `gorm:"size:50;column:channel_id" json:"channelId"` - OrderNo string `gorm:"size:50;uniqueIndex;column:order_no" json:"orderNo"` - PlanType string `gorm:"size:20;column:plan_type" json:"planType"` - Amount int `gorm:"column:amount" json:"amount"` - Status int `gorm:"default:0;column:status" json:"status"` - PayType string `gorm:"size:20;column:pay_type" json:"payType"` - PrepayID string `gorm:"size:100;column:prepay_id" json:"prepayId"` -} - -func (SundynixRadioSubscriptionOrder) TableName() string { - return "sundynix_radio_subscription_order" -} - -// SundynixRadioPayNotify 支付回调记录 -type SundynixRadioPayNotify struct { - model.BaseModel - OrderNo string `gorm:"size:50;column:order_no" json:"orderNo"` - TransactionID string `gorm:"size:50;column:transaction_id" json:"transactionId"` - TradeState string `gorm:"size:20;column:trade_state" json:"tradeState"` - RawData string `gorm:"type:text;column:raw_data" json:"rawData"` -} - -func (SundynixRadioPayNotify) TableName() string { - return "sundynix_radio_pay_notify" -} - -// ========== VIP配置 ========== - -// SundynixRadioVipConfig VIP配置 -type SundynixRadioVipConfig struct { - model.BaseModel - Name string `gorm:"size:50;column:name" json:"name"` - PlanType string `gorm:"size:20;column:plan_type" json:"planType"` - Price int `gorm:"column:price" json:"price"` - OriginalPrice int `gorm:"column:original_price" json:"originalPrice"` - Duration int `gorm:"column:duration" json:"duration"` - Desc string `gorm:"size:200;column:desc" json:"desc"` - Sort int `gorm:"default:0;column:sort" json:"sort"` - Status int `gorm:"default:1;column:status" json:"status"` -} - -func (SundynixRadioVipConfig) TableName() string { - return "sundynix_radio_vip_config" -} - -// SundynixRadioListenLog 收听日志(数据分析用) -type SundynixRadioListenLog struct { - model.BaseModel - UserID string `gorm:"size:50;index;column:user_id" json:"userId"` - ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` - ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` - Duration int `gorm:"column:duration" json:"duration"` -} - -func (SundynixRadioListenLog) TableName() string { - return "sundynix_radio_listen_log" -} diff --git a/app/radio/rpc/internal/config/config.go b/app/radio/rpc/internal/config/config.go deleted file mode 100755 index 897b703..0000000 --- a/app/radio/rpc/internal/config/config.go +++ /dev/null @@ -1,10 +0,0 @@ -package config - -import "github.com/zeromicro/go-zero/zrpc" - -type Config struct { - zrpc.RpcServerConf - DB struct { - DataSource string - } -} diff --git a/app/radio/rpc/internal/logic/commentProgramLogic.go b/app/radio/rpc/internal/logic/commentProgramLogic.go deleted file mode 100644 index 69a8776..0000000 --- a/app/radio/rpc/internal/logic/commentProgramLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CommentProgramLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic { - return &CommentProgramLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *CommentProgramLogic) CommentProgram(in *radio.CommentReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/createCategoryLogic.go b/app/radio/rpc/internal/logic/createCategoryLogic.go deleted file mode 100644 index 8c522a8..0000000 --- a/app/radio/rpc/internal/logic/createCategoryLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateCategoryLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic { - return &CreateCategoryLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 分类 -func (l *CreateCategoryLogic) CreateCategory(in *radio.CategoryReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/createChannelLogic.go b/app/radio/rpc/internal/logic/createChannelLogic.go deleted file mode 100644 index 3a5efc9..0000000 --- a/app/radio/rpc/internal/logic/createChannelLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateChannelLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic { - return &CreateChannelLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 频道 -func (l *CreateChannelLogic) CreateChannel(in *radio.CreateChannelReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/createPayOrderLogic.go b/app/radio/rpc/internal/logic/createPayOrderLogic.go deleted file mode 100644 index a2446c0..0000000 --- a/app/radio/rpc/internal/logic/createPayOrderLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreatePayOrderLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic { - return &CreatePayOrderLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *CreatePayOrderLogic) CreatePayOrder(in *radio.CreatePayOrderReq) (*radio.CreatePayOrderResp, error) { - // todo: add your logic here and delete this line - - return &radio.CreatePayOrderResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/createProgramLogic.go b/app/radio/rpc/internal/logic/createProgramLogic.go deleted file mode 100644 index 4644637..0000000 --- a/app/radio/rpc/internal/logic/createProgramLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateProgramLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic { - return &CreateProgramLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 节目 -func (l *CreateProgramLogic) CreateProgram(in *radio.CreateProgramReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/createVoiceLogic.go b/app/radio/rpc/internal/logic/createVoiceLogic.go deleted file mode 100644 index 9dcbfe6..0000000 --- a/app/radio/rpc/internal/logic/createVoiceLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type CreateVoiceLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic { - return &CreateVoiceLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 音色 -func (l *CreateVoiceLogic) CreateVoice(in *radio.CreateVoiceReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/deleteCategoryLogic.go b/app/radio/rpc/internal/logic/deleteCategoryLogic.go deleted file mode 100644 index a0ee7ae..0000000 --- a/app/radio/rpc/internal/logic/deleteCategoryLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteCategoryLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic { - return &DeleteCategoryLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *DeleteCategoryLogic) DeleteCategory(in *radio.IdsReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/deleteChannelLogic.go b/app/radio/rpc/internal/logic/deleteChannelLogic.go deleted file mode 100644 index cecc8ca..0000000 --- a/app/radio/rpc/internal/logic/deleteChannelLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteChannelLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic { - return &DeleteChannelLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *DeleteChannelLogic) DeleteChannel(in *radio.IdsReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/deleteProgramLogic.go b/app/radio/rpc/internal/logic/deleteProgramLogic.go deleted file mode 100644 index 8f4e2bd..0000000 --- a/app/radio/rpc/internal/logic/deleteProgramLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteProgramLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic { - return &DeleteProgramLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *DeleteProgramLogic) DeleteProgram(in *radio.IdsReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/deleteVoiceLogic.go b/app/radio/rpc/internal/logic/deleteVoiceLogic.go deleted file mode 100644 index 07ff6c9..0000000 --- a/app/radio/rpc/internal/logic/deleteVoiceLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type DeleteVoiceLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic { - return &DeleteVoiceLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *DeleteVoiceLogic) DeleteVoice(in *radio.IdsReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getAnalyticsOverviewLogic.go b/app/radio/rpc/internal/logic/getAnalyticsOverviewLogic.go deleted file mode 100644 index 48b4fa7..0000000 --- a/app/radio/rpc/internal/logic/getAnalyticsOverviewLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetAnalyticsOverviewLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetAnalyticsOverviewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnalyticsOverviewLogic { - return &GetAnalyticsOverviewLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 数据分析 -func (l *GetAnalyticsOverviewLogic) GetAnalyticsOverview(in *radio.AnalyticsReq) (*radio.AnalyticsOverviewResp, error) { - // todo: add your logic here and delete this line - - return &radio.AnalyticsOverviewResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getCategoryListLogic.go b/app/radio/rpc/internal/logic/getCategoryListLogic.go deleted file mode 100644 index 216abf2..0000000 --- a/app/radio/rpc/internal/logic/getCategoryListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetCategoryListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic { - return &GetCategoryListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetCategoryListLogic) GetCategoryList(in *radio.CategoryListReq) (*radio.CategoryListResp, error) { - // todo: add your logic here and delete this line - - return &radio.CategoryListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getChannelAnalyticsLogic.go b/app/radio/rpc/internal/logic/getChannelAnalyticsLogic.go deleted file mode 100644 index 3cdd449..0000000 --- a/app/radio/rpc/internal/logic/getChannelAnalyticsLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelAnalyticsLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetChannelAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelAnalyticsLogic { - return &GetChannelAnalyticsLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetChannelAnalyticsLogic) GetChannelAnalytics(in *radio.AnalyticsReq) (*radio.ChannelAnalyticsResp, error) { - // todo: add your logic here and delete this line - - return &radio.ChannelAnalyticsResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getChannelDetailLogic.go b/app/radio/rpc/internal/logic/getChannelDetailLogic.go deleted file mode 100644 index 926e054..0000000 --- a/app/radio/rpc/internal/logic/getChannelDetailLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelDetailLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic { - return &GetChannelDetailLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetChannelDetailLogic) GetChannelDetail(in *radio.IdReq) (*radio.ChannelInfo, error) { - // todo: add your logic here and delete this line - - return &radio.ChannelInfo{}, nil -} diff --git a/app/radio/rpc/internal/logic/getChannelListLogic.go b/app/radio/rpc/internal/logic/getChannelListLogic.go deleted file mode 100644 index 309bc1d..0000000 --- a/app/radio/rpc/internal/logic/getChannelListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetChannelListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic { - return &GetChannelListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetChannelListLogic) GetChannelList(in *radio.ChannelListReq) (*radio.ChannelListResp, error) { - // todo: add your logic here and delete this line - - return &radio.ChannelListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getFavoriteListLogic.go b/app/radio/rpc/internal/logic/getFavoriteListLogic.go deleted file mode 100644 index b43c117..0000000 --- a/app/radio/rpc/internal/logic/getFavoriteListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetFavoriteListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic { - return &GetFavoriteListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetFavoriteListLogic) GetFavoriteList(in *radio.InteractionListReq) (*radio.FavoriteListResp, error) { - // todo: add your logic here and delete this line - - return &radio.FavoriteListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getHistoryListLogic.go b/app/radio/rpc/internal/logic/getHistoryListLogic.go deleted file mode 100644 index dbdd599..0000000 --- a/app/radio/rpc/internal/logic/getHistoryListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetHistoryListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic { - return &GetHistoryListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetHistoryListLogic) GetHistoryList(in *radio.InteractionListReq) (*radio.HistoryListResp, error) { - // todo: add your logic here and delete this line - - return &radio.HistoryListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go b/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go deleted file mode 100644 index 47f34bc..0000000 --- a/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetMySubscriptionsLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic { - return &GetMySubscriptionsLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 订阅/VIP -func (l *GetMySubscriptionsLogic) GetMySubscriptions(in *radio.SubscriptionListReq) (*radio.SubscriptionListResp, error) { - // todo: add your logic here and delete this line - - return &radio.SubscriptionListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getMyVipInfoLogic.go b/app/radio/rpc/internal/logic/getMyVipInfoLogic.go deleted file mode 100644 index 2aee57b..0000000 --- a/app/radio/rpc/internal/logic/getMyVipInfoLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetMyVipInfoLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic { - return &GetMyVipInfoLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetMyVipInfoLogic) GetMyVipInfo(in *radio.GetProfileReq) (*radio.RadioUserProfile, error) { - // todo: add your logic here and delete this line - - return &radio.RadioUserProfile{}, nil -} diff --git a/app/radio/rpc/internal/logic/getProgramDetailLogic.go b/app/radio/rpc/internal/logic/getProgramDetailLogic.go deleted file mode 100644 index 8972695..0000000 --- a/app/radio/rpc/internal/logic/getProgramDetailLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetProgramDetailLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic { - return &GetProgramDetailLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetProgramDetailLogic) GetProgramDetail(in *radio.IdReq) (*radio.ProgramInfo, error) { - // todo: add your logic here and delete this line - - return &radio.ProgramInfo{}, nil -} diff --git a/app/radio/rpc/internal/logic/getProgramListLogic.go b/app/radio/rpc/internal/logic/getProgramListLogic.go deleted file mode 100644 index 35b529c..0000000 --- a/app/radio/rpc/internal/logic/getProgramListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetProgramListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic { - return &GetProgramListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetProgramListLogic) GetProgramList(in *radio.ProgramListReq) (*radio.ProgramListResp, error) { - // todo: add your logic here and delete this line - - return &radio.ProgramListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getUserAnalyticsLogic.go b/app/radio/rpc/internal/logic/getUserAnalyticsLogic.go deleted file mode 100644 index 9fec531..0000000 --- a/app/radio/rpc/internal/logic/getUserAnalyticsLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetUserAnalyticsLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetUserAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAnalyticsLogic { - return &GetUserAnalyticsLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetUserAnalyticsLogic) GetUserAnalytics(in *radio.AnalyticsReq) (*radio.UserAnalyticsResp, error) { - // todo: add your logic here and delete this line - - return &radio.UserAnalyticsResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getUserProfileLogic.go b/app/radio/rpc/internal/logic/getUserProfileLogic.go deleted file mode 100644 index 0f19aa9..0000000 --- a/app/radio/rpc/internal/logic/getUserProfileLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetUserProfileLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProfileLogic { - return &GetUserProfileLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 用户Profile -func (l *GetUserProfileLogic) GetUserProfile(in *radio.GetProfileReq) (*radio.RadioUserProfile, error) { - // todo: add your logic here and delete this line - - return &radio.RadioUserProfile{}, nil -} diff --git a/app/radio/rpc/internal/logic/getVipConfigListLogic.go b/app/radio/rpc/internal/logic/getVipConfigListLogic.go deleted file mode 100644 index 1569dd4..0000000 --- a/app/radio/rpc/internal/logic/getVipConfigListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetVipConfigListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic { - return &GetVipConfigListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetVipConfigListLogic) GetVipConfigList(in *radio.IdReq) (*radio.VipConfigListResp, error) { - // todo: add your logic here and delete this line - - return &radio.VipConfigListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/getVoiceListLogic.go b/app/radio/rpc/internal/logic/getVoiceListLogic.go deleted file mode 100644 index 62bc593..0000000 --- a/app/radio/rpc/internal/logic/getVoiceListLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetVoiceListLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic { - return &GetVoiceListLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *GetVoiceListLogic) GetVoiceList(in *radio.VoiceListReq) (*radio.VoiceListResp, error) { - // todo: add your logic here and delete this line - - return &radio.VoiceListResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/recordHistoryLogic.go b/app/radio/rpc/internal/logic/recordHistoryLogic.go deleted file mode 100644 index ab74693..0000000 --- a/app/radio/rpc/internal/logic/recordHistoryLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type RecordHistoryLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic { - return &RecordHistoryLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *RecordHistoryLogic) RecordHistory(in *radio.RecordHistoryReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/toggleFavoriteLogic.go b/app/radio/rpc/internal/logic/toggleFavoriteLogic.go deleted file mode 100644 index 0434b30..0000000 --- a/app/radio/rpc/internal/logic/toggleFavoriteLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type ToggleFavoriteLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic { - return &ToggleFavoriteLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *ToggleFavoriteLogic) ToggleFavorite(in *radio.ToggleFavoriteReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/toggleLikeLogic.go b/app/radio/rpc/internal/logic/toggleLikeLogic.go deleted file mode 100644 index bcd4b48..0000000 --- a/app/radio/rpc/internal/logic/toggleLikeLogic.go +++ /dev/null @@ -1,31 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type ToggleLikeLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleLikeLogic { - return &ToggleLikeLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 互动 -func (l *ToggleLikeLogic) ToggleLike(in *radio.ToggleLikeReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/updateCategoryLogic.go b/app/radio/rpc/internal/logic/updateCategoryLogic.go deleted file mode 100644 index a1582e5..0000000 --- a/app/radio/rpc/internal/logic/updateCategoryLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateCategoryLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateCategoryLogic { - return &UpdateCategoryLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *UpdateCategoryLogic) UpdateCategory(in *radio.CategoryUpdateReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/updateChannelLogic.go b/app/radio/rpc/internal/logic/updateChannelLogic.go deleted file mode 100644 index 0d44db1..0000000 --- a/app/radio/rpc/internal/logic/updateChannelLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateChannelLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateChannelLogic { - return &UpdateChannelLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *UpdateChannelLogic) UpdateChannel(in *radio.UpdateChannelReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/updateProgramLogic.go b/app/radio/rpc/internal/logic/updateProgramLogic.go deleted file mode 100644 index cf976f8..0000000 --- a/app/radio/rpc/internal/logic/updateProgramLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateProgramLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProgramLogic { - return &UpdateProgramLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *UpdateProgramLogic) UpdateProgram(in *radio.UpdateProgramReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/logic/updateVoiceLogic.go b/app/radio/rpc/internal/logic/updateVoiceLogic.go deleted file mode 100644 index 43fa7f8..0000000 --- a/app/radio/rpc/internal/logic/updateVoiceLogic.go +++ /dev/null @@ -1,30 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/logx" -) - -type UpdateVoiceLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVoiceLogic { - return &UpdateVoiceLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -func (l *UpdateVoiceLogic) UpdateVoice(in *radio.UpdateVoiceReq) (*radio.CommonResp, error) { - // todo: add your logic here and delete this line - - return &radio.CommonResp{}, nil -} diff --git a/app/radio/rpc/internal/server/radioServiceServer.go b/app/radio/rpc/internal/server/radioServiceServer.go deleted file mode 100644 index 4db7632..0000000 --- a/app/radio/rpc/internal/server/radioServiceServer.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 -// Source: radio.proto - -package server - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/internal/logic" - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" -) - -type RadioServiceServer struct { - svcCtx *svc.ServiceContext - radio.UnimplementedRadioServiceServer -} - -func NewRadioServiceServer(svcCtx *svc.ServiceContext) *RadioServiceServer { - return &RadioServiceServer{ - svcCtx: svcCtx, - } -} - -// 用户Profile -func (s *RadioServiceServer) GetUserProfile(ctx context.Context, in *radio.GetProfileReq) (*radio.RadioUserProfile, error) { - l := logic.NewGetUserProfileLogic(ctx, s.svcCtx) - return l.GetUserProfile(in) -} - -// 分类 -func (s *RadioServiceServer) CreateCategory(ctx context.Context, in *radio.CategoryReq) (*radio.CommonResp, error) { - l := logic.NewCreateCategoryLogic(ctx, s.svcCtx) - return l.CreateCategory(in) -} - -func (s *RadioServiceServer) UpdateCategory(ctx context.Context, in *radio.CategoryUpdateReq) (*radio.CommonResp, error) { - l := logic.NewUpdateCategoryLogic(ctx, s.svcCtx) - return l.UpdateCategory(in) -} - -func (s *RadioServiceServer) DeleteCategory(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) { - l := logic.NewDeleteCategoryLogic(ctx, s.svcCtx) - return l.DeleteCategory(in) -} - -func (s *RadioServiceServer) GetCategoryList(ctx context.Context, in *radio.CategoryListReq) (*radio.CategoryListResp, error) { - l := logic.NewGetCategoryListLogic(ctx, s.svcCtx) - return l.GetCategoryList(in) -} - -// 频道 -func (s *RadioServiceServer) CreateChannel(ctx context.Context, in *radio.CreateChannelReq) (*radio.CommonResp, error) { - l := logic.NewCreateChannelLogic(ctx, s.svcCtx) - return l.CreateChannel(in) -} - -func (s *RadioServiceServer) UpdateChannel(ctx context.Context, in *radio.UpdateChannelReq) (*radio.CommonResp, error) { - l := logic.NewUpdateChannelLogic(ctx, s.svcCtx) - return l.UpdateChannel(in) -} - -func (s *RadioServiceServer) DeleteChannel(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) { - l := logic.NewDeleteChannelLogic(ctx, s.svcCtx) - return l.DeleteChannel(in) -} - -func (s *RadioServiceServer) GetChannelList(ctx context.Context, in *radio.ChannelListReq) (*radio.ChannelListResp, error) { - l := logic.NewGetChannelListLogic(ctx, s.svcCtx) - return l.GetChannelList(in) -} - -func (s *RadioServiceServer) GetChannelDetail(ctx context.Context, in *radio.IdReq) (*radio.ChannelInfo, error) { - l := logic.NewGetChannelDetailLogic(ctx, s.svcCtx) - return l.GetChannelDetail(in) -} - -// 节目 -func (s *RadioServiceServer) CreateProgram(ctx context.Context, in *radio.CreateProgramReq) (*radio.CommonResp, error) { - l := logic.NewCreateProgramLogic(ctx, s.svcCtx) - return l.CreateProgram(in) -} - -func (s *RadioServiceServer) UpdateProgram(ctx context.Context, in *radio.UpdateProgramReq) (*radio.CommonResp, error) { - l := logic.NewUpdateProgramLogic(ctx, s.svcCtx) - return l.UpdateProgram(in) -} - -func (s *RadioServiceServer) DeleteProgram(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) { - l := logic.NewDeleteProgramLogic(ctx, s.svcCtx) - return l.DeleteProgram(in) -} - -func (s *RadioServiceServer) GetProgramList(ctx context.Context, in *radio.ProgramListReq) (*radio.ProgramListResp, error) { - l := logic.NewGetProgramListLogic(ctx, s.svcCtx) - return l.GetProgramList(in) -} - -func (s *RadioServiceServer) GetProgramDetail(ctx context.Context, in *radio.IdReq) (*radio.ProgramInfo, error) { - l := logic.NewGetProgramDetailLogic(ctx, s.svcCtx) - return l.GetProgramDetail(in) -} - -// 音色 -func (s *RadioServiceServer) CreateVoice(ctx context.Context, in *radio.CreateVoiceReq) (*radio.CommonResp, error) { - l := logic.NewCreateVoiceLogic(ctx, s.svcCtx) - return l.CreateVoice(in) -} - -func (s *RadioServiceServer) UpdateVoice(ctx context.Context, in *radio.UpdateVoiceReq) (*radio.CommonResp, error) { - l := logic.NewUpdateVoiceLogic(ctx, s.svcCtx) - return l.UpdateVoice(in) -} - -func (s *RadioServiceServer) DeleteVoice(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) { - l := logic.NewDeleteVoiceLogic(ctx, s.svcCtx) - return l.DeleteVoice(in) -} - -func (s *RadioServiceServer) GetVoiceList(ctx context.Context, in *radio.VoiceListReq) (*radio.VoiceListResp, error) { - l := logic.NewGetVoiceListLogic(ctx, s.svcCtx) - return l.GetVoiceList(in) -} - -// 互动 -func (s *RadioServiceServer) ToggleLike(ctx context.Context, in *radio.ToggleLikeReq) (*radio.CommonResp, error) { - l := logic.NewToggleLikeLogic(ctx, s.svcCtx) - return l.ToggleLike(in) -} - -func (s *RadioServiceServer) ToggleFavorite(ctx context.Context, in *radio.ToggleFavoriteReq) (*radio.CommonResp, error) { - l := logic.NewToggleFavoriteLogic(ctx, s.svcCtx) - return l.ToggleFavorite(in) -} - -func (s *RadioServiceServer) CommentProgram(ctx context.Context, in *radio.CommentReq) (*radio.CommonResp, error) { - l := logic.NewCommentProgramLogic(ctx, s.svcCtx) - return l.CommentProgram(in) -} - -func (s *RadioServiceServer) RecordHistory(ctx context.Context, in *radio.RecordHistoryReq) (*radio.CommonResp, error) { - l := logic.NewRecordHistoryLogic(ctx, s.svcCtx) - return l.RecordHistory(in) -} - -func (s *RadioServiceServer) GetFavoriteList(ctx context.Context, in *radio.InteractionListReq) (*radio.FavoriteListResp, error) { - l := logic.NewGetFavoriteListLogic(ctx, s.svcCtx) - return l.GetFavoriteList(in) -} - -func (s *RadioServiceServer) GetHistoryList(ctx context.Context, in *radio.InteractionListReq) (*radio.HistoryListResp, error) { - l := logic.NewGetHistoryListLogic(ctx, s.svcCtx) - return l.GetHistoryList(in) -} - -// 订阅/VIP -func (s *RadioServiceServer) GetMySubscriptions(ctx context.Context, in *radio.SubscriptionListReq) (*radio.SubscriptionListResp, error) { - l := logic.NewGetMySubscriptionsLogic(ctx, s.svcCtx) - return l.GetMySubscriptions(in) -} - -func (s *RadioServiceServer) CreatePayOrder(ctx context.Context, in *radio.CreatePayOrderReq) (*radio.CreatePayOrderResp, error) { - l := logic.NewCreatePayOrderLogic(ctx, s.svcCtx) - return l.CreatePayOrder(in) -} - -func (s *RadioServiceServer) GetVipConfigList(ctx context.Context, in *radio.IdReq) (*radio.VipConfigListResp, error) { - l := logic.NewGetVipConfigListLogic(ctx, s.svcCtx) - return l.GetVipConfigList(in) -} - -func (s *RadioServiceServer) GetMyVipInfo(ctx context.Context, in *radio.GetProfileReq) (*radio.RadioUserProfile, error) { - l := logic.NewGetMyVipInfoLogic(ctx, s.svcCtx) - return l.GetMyVipInfo(in) -} - -// 数据分析 -func (s *RadioServiceServer) GetAnalyticsOverview(ctx context.Context, in *radio.AnalyticsReq) (*radio.AnalyticsOverviewResp, error) { - l := logic.NewGetAnalyticsOverviewLogic(ctx, s.svcCtx) - return l.GetAnalyticsOverview(in) -} - -func (s *RadioServiceServer) GetChannelAnalytics(ctx context.Context, in *radio.AnalyticsReq) (*radio.ChannelAnalyticsResp, error) { - l := logic.NewGetChannelAnalyticsLogic(ctx, s.svcCtx) - return l.GetChannelAnalytics(in) -} - -func (s *RadioServiceServer) GetUserAnalytics(ctx context.Context, in *radio.AnalyticsReq) (*radio.UserAnalyticsResp, error) { - l := logic.NewGetUserAnalyticsLogic(ctx, s.svcCtx) - return l.GetUserAnalytics(in) -} diff --git a/app/radio/rpc/internal/svc/serviceContext.go b/app/radio/rpc/internal/svc/serviceContext.go deleted file mode 100644 index fb0f535..0000000 --- a/app/radio/rpc/internal/svc/serviceContext.go +++ /dev/null @@ -1,44 +0,0 @@ -package svc - -import ( - radioModel "sundynix-micro-go/app/radio/model" - "sundynix-micro-go/app/radio/rpc/internal/config" - - "github.com/zeromicro/go-zero/core/logx" - "gorm.io/driver/mysql" - "gorm.io/gorm" -) - -type ServiceContext struct { - Config config.Config - DB *gorm.DB -} - -func NewServiceContext(c config.Config) *ServiceContext { - db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) - if err != nil { - logx.Errorf("连接数据库失败: %v", err) - panic(err) - } - - if err := db.AutoMigrate( - &radioModel.SundynixRadioUserProfile{}, - &radioModel.SundynixRadioCategory{}, - &radioModel.SundynixRadioChannel{}, - &radioModel.SundynixRadioProgram{}, - &radioModel.SundynixRadioVoice{}, - &radioModel.SundynixRadioLike{}, - &radioModel.SundynixRadioFavorite{}, - &radioModel.SundynixRadioComment{}, - &radioModel.SundynixRadioHistory{}, - &radioModel.SundynixRadioSubscription{}, - &radioModel.SundynixRadioSubscriptionOrder{}, - &radioModel.SundynixRadioPayNotify{}, - &radioModel.SundynixRadioVipConfig{}, - &radioModel.SundynixRadioListenLog{}, - ); err != nil { - logx.Errorf("数据库迁移失败: %v", err) - } - - return &ServiceContext{Config: c, DB: db} -} diff --git a/app/radio/rpc/pb/radio.proto b/app/radio/rpc/pb/radio.proto deleted file mode 100644 index dac63e9..0000000 --- a/app/radio/rpc/pb/radio.proto +++ /dev/null @@ -1,397 +0,0 @@ -syntax = "proto3"; - -package radio; - -option go_package = "./radio"; - -// ========== 通用 ========== - -message CommonResp { - int64 code = 1; - string msg = 2; -} - -message IdReq { - string id = 1; -} - -message IdsReq { - repeated string ids = 1; -} - -// ========== 用户Profile ========== - -message RadioUserProfile { - string id = 1; - string userId = 2; - string nickName = 3; - string avatarId = 4; - int32 isVip = 5; - int64 vipExpireAt = 6; - int32 vipLevel = 7; -} - -message GetProfileReq { - string userId = 1; -} - -// ========== 分类 ========== - -message CategoryInfo { - string id = 1; - string name = 2; - string icon = 3; - int32 sort = 4; -} - -message CategoryReq { - string name = 1; - string icon = 2; - int32 sort = 3; -} - -message CategoryUpdateReq { - string id = 1; - string name = 2; - string icon = 3; - int32 sort = 4; -} - -message CategoryListResp { - repeated CategoryInfo list = 1; - int64 total = 2; -} - -message CategoryListReq { - int32 current = 1; - int32 pageSize = 2; -} - -// ========== 频道 ========== - -message ChannelInfo { - string id = 1; - string categoryId = 2; - string name = 3; - string description = 4; - int32 isFree = 5; - int32 isVipOnly = 6; - int32 monthlyPrice = 7; - int32 quarterlyPrice = 8; - int32 annualPrice = 9; - string cover = 10; - string tags = 11; - int32 sort = 12; - int32 status = 13; -} - -message CreateChannelReq { - string categoryId = 1; - string name = 2; - string description = 3; - int32 isFree = 4; - int32 isVipOnly = 5; - int32 monthlyPrice = 6; - int32 quarterlyPrice = 7; - int32 annualPrice = 8; - string cover = 9; - string tags = 10; - int32 sort = 11; -} - -message UpdateChannelReq { - string id = 1; - string categoryId = 2; - string name = 3; - string description = 4; - int32 isFree = 5; - int32 isVipOnly = 6; - int32 monthlyPrice = 7; - int32 quarterlyPrice = 8; - int32 annualPrice = 9; - string cover = 10; - string tags = 11; - int32 sort = 12; - int32 status = 13; -} - -message ChannelListReq { - int32 current = 1; - int32 pageSize = 2; - string categoryId = 3; - string userId = 4; -} - -message ChannelListResp { - repeated ChannelInfo list = 1; - int64 total = 2; -} - -// ========== 节目 ========== - -message ProgramInfo { - string id = 1; - string channelId = 2; - string title = 3; - string description = 4; - string content = 5; - string cover = 6; - string audioId = 7; - int32 audioStatus = 8; - int32 duration = 9; - string tags = 10; - int32 playCount = 11; - int32 likeCount = 12; - int32 status = 13; -} - -message CreateProgramReq { - string channelId = 1; - string title = 2; - string description = 3; - string content = 4; - string cover = 5; - string tags = 6; -} - -message UpdateProgramReq { - string id = 1; - string channelId = 2; - string title = 3; - string description = 4; - string content = 5; - string cover = 6; - string audioId = 7; - int32 audioStatus = 8; - int32 duration = 9; - string tags = 10; - int32 status = 11; -} - -message ProgramListReq { - int32 current = 1; - int32 pageSize = 2; - string channelId = 3; - string userId = 4; -} - -message ProgramListResp { - repeated ProgramInfo list = 1; - int64 total = 2; -} - -// ========== 音色 ========== - -message VoiceInfo { - string id = 1; - string speakerId = 2; - string name = 3; - string description = 4; - string gender = 5; - string icon = 6; - string audioId = 7; - int32 sort = 8; - int32 status = 9; - int32 isDefault = 10; -} - -message CreateVoiceReq { - string speakerId = 1; - string name = 2; - string description = 3; - string gender = 4; - string icon = 5; - string audioId = 6; - int32 sort = 7; - int32 isDefault = 8; -} - -message UpdateVoiceReq { - string id = 1; - string speakerId = 2; - string name = 3; - string description = 4; - string gender = 5; - string icon = 6; - string audioId = 7; - int32 sort = 8; - int32 status = 9; - int32 isDefault = 10; -} - -message VoiceListReq { - int32 current = 1; - int32 pageSize = 2; -} - -message VoiceListResp { - repeated VoiceInfo list = 1; - int64 total = 2; -} - -// ========== 互动 ========== - -message ToggleLikeReq { - string userId = 1; - string programId = 2; -} - -message ToggleFavoriteReq { - string userId = 1; - string programId = 2; -} - -message CommentReq { - string userId = 1; - string programId = 2; - string content = 3; - string parentId = 4; -} - -message RecordHistoryReq { - string userId = 1; - string programId = 2; - int32 duration = 3; -} - -message InteractionListReq { - string userId = 1; - int32 current = 2; - int32 pageSize = 3; -} - -message FavoriteListResp { - repeated ProgramInfo list = 1; - int64 total = 2; -} - -message HistoryListResp { - repeated ProgramInfo list = 1; - int64 total = 2; -} - -// ========== 订阅/VIP ========== - -message SubscriptionInfo { - string id = 1; - string channelId = 2; - int64 expiredAt = 3; - int32 status = 4; -} - -message SubscriptionListReq { - string userId = 1; -} - -message SubscriptionListResp { - repeated SubscriptionInfo list = 1; -} - -message CreatePayOrderReq { - string userId = 1; - string channelId = 2; - string planType = 3; -} - -message CreatePayOrderResp { - string orderNo = 1; - string prepayId = 2; -} - -message VipConfigInfo { - string id = 1; - string name = 2; - string planType = 3; - int32 price = 4; - int32 originalPrice = 5; - int32 duration = 6; - string desc = 7; -} - -message VipConfigListResp { - repeated VipConfigInfo list = 1; -} - -// ========== 数据分析 ========== - -message AnalyticsReq { - string startDate = 1; - string endDate = 2; -} - -message AnalyticsOverviewResp { - int64 totalUsers = 1; - int64 totalPlays = 2; - int64 totalChannels = 3; - int64 totalPrograms = 4; -} - -message ChannelAnalyticsResp { - repeated ChannelAnalyticsItem list = 1; -} - -message ChannelAnalyticsItem { - string channelId = 1; - string channelName = 2; - int64 playCount = 3; - int64 likeCount = 4; - int64 subscriberCount = 5; -} - -message UserAnalyticsResp { - int64 newUsers = 1; - int64 activeUsers = 2; - int64 vipUsers = 3; -} - -// ========== 服务定义 ========== - -service RadioService { - // 用户Profile - rpc GetUserProfile(GetProfileReq) returns (RadioUserProfile); - - // 分类 - rpc CreateCategory(CategoryReq) returns (CommonResp); - rpc UpdateCategory(CategoryUpdateReq) returns (CommonResp); - rpc DeleteCategory(IdsReq) returns (CommonResp); - rpc GetCategoryList(CategoryListReq) returns (CategoryListResp); - - // 频道 - rpc CreateChannel(CreateChannelReq) returns (CommonResp); - rpc UpdateChannel(UpdateChannelReq) returns (CommonResp); - rpc DeleteChannel(IdsReq) returns (CommonResp); - rpc GetChannelList(ChannelListReq) returns (ChannelListResp); - rpc GetChannelDetail(IdReq) returns (ChannelInfo); - - // 节目 - rpc CreateProgram(CreateProgramReq) returns (CommonResp); - rpc UpdateProgram(UpdateProgramReq) returns (CommonResp); - rpc DeleteProgram(IdsReq) returns (CommonResp); - rpc GetProgramList(ProgramListReq) returns (ProgramListResp); - rpc GetProgramDetail(IdReq) returns (ProgramInfo); - - // 音色 - rpc CreateVoice(CreateVoiceReq) returns (CommonResp); - rpc UpdateVoice(UpdateVoiceReq) returns (CommonResp); - rpc DeleteVoice(IdsReq) returns (CommonResp); - rpc GetVoiceList(VoiceListReq) returns (VoiceListResp); - - // 互动 - rpc ToggleLike(ToggleLikeReq) returns (CommonResp); - rpc ToggleFavorite(ToggleFavoriteReq) returns (CommonResp); - rpc CommentProgram(CommentReq) returns (CommonResp); - rpc RecordHistory(RecordHistoryReq) returns (CommonResp); - rpc GetFavoriteList(InteractionListReq) returns (FavoriteListResp); - rpc GetHistoryList(InteractionListReq) returns (HistoryListResp); - - // 订阅/VIP - rpc GetMySubscriptions(SubscriptionListReq) returns (SubscriptionListResp); - rpc CreatePayOrder(CreatePayOrderReq) returns (CreatePayOrderResp); - rpc GetVipConfigList(IdReq) returns (VipConfigListResp); - rpc GetMyVipInfo(GetProfileReq) returns (RadioUserProfile); - - // 数据分析 - rpc GetAnalyticsOverview(AnalyticsReq) returns (AnalyticsOverviewResp); - rpc GetChannelAnalytics(AnalyticsReq) returns (ChannelAnalyticsResp); - rpc GetUserAnalytics(AnalyticsReq) returns (UserAnalyticsResp); -} diff --git a/app/radio/rpc/radio.go b/app/radio/rpc/radio.go deleted file mode 100644 index 78c0960..0000000 --- a/app/radio/rpc/radio.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "flag" - "fmt" - - "sundynix-micro-go/app/radio/rpc/internal/config" - "sundynix-micro-go/app/radio/rpc/internal/server" - "sundynix-micro-go/app/radio/rpc/internal/svc" - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/core/conf" - "github.com/zeromicro/go-zero/core/service" - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" - "google.golang.org/grpc/reflection" -) - -var configFile = flag.String("f", "etc/radio.yaml", "the config file") - -func main() { - flag.Parse() - - var c config.Config - conf.MustLoad(*configFile, &c) - ctx := svc.NewServiceContext(c) - - s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { - radio.RegisterRadioServiceServer(grpcServer, server.NewRadioServiceServer(ctx)) - - if c.Mode == service.DevMode || c.Mode == service.TestMode { - reflection.Register(grpcServer) - } - }) - defer s.Stop() - - fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) - s.Start() -} diff --git a/app/radio/rpc/radio/radio.pb.go b/app/radio/rpc/radio/radio.pb.go deleted file mode 100644 index 6d58372..0000000 --- a/app/radio/rpc/radio/radio.pb.go +++ /dev/null @@ -1,3585 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v7.34.1 -// source: pb/radio.proto - -package radio - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CommonResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` - Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CommonResp) Reset() { - *x = CommonResp{} - mi := &file_pb_radio_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CommonResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommonResp) ProtoMessage() {} - -func (x *CommonResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. -func (*CommonResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{0} -} - -func (x *CommonResp) GetCode() int64 { - if x != nil { - return x.Code - } - return 0 -} - -func (x *CommonResp) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -type IdReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *IdReq) Reset() { - *x = IdReq{} - mi := &file_pb_radio_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *IdReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IdReq) ProtoMessage() {} - -func (x *IdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IdReq.ProtoReflect.Descriptor instead. -func (*IdReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{1} -} - -func (x *IdReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type IdsReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *IdsReq) Reset() { - *x = IdsReq{} - mi := &file_pb_radio_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *IdsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IdsReq) ProtoMessage() {} - -func (x *IdsReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IdsReq.ProtoReflect.Descriptor instead. -func (*IdsReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{2} -} - -func (x *IdsReq) GetIds() []string { - if x != nil { - return x.Ids - } - return nil -} - -type RadioUserProfile struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` - NickName string `protobuf:"bytes,3,opt,name=nickName,proto3" json:"nickName,omitempty"` - AvatarId string `protobuf:"bytes,4,opt,name=avatarId,proto3" json:"avatarId,omitempty"` - IsVip int32 `protobuf:"varint,5,opt,name=isVip,proto3" json:"isVip,omitempty"` - VipExpireAt int64 `protobuf:"varint,6,opt,name=vipExpireAt,proto3" json:"vipExpireAt,omitempty"` - VipLevel int32 `protobuf:"varint,7,opt,name=vipLevel,proto3" json:"vipLevel,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RadioUserProfile) Reset() { - *x = RadioUserProfile{} - mi := &file_pb_radio_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RadioUserProfile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RadioUserProfile) ProtoMessage() {} - -func (x *RadioUserProfile) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RadioUserProfile.ProtoReflect.Descriptor instead. -func (*RadioUserProfile) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{3} -} - -func (x *RadioUserProfile) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *RadioUserProfile) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *RadioUserProfile) GetNickName() string { - if x != nil { - return x.NickName - } - return "" -} - -func (x *RadioUserProfile) GetAvatarId() string { - if x != nil { - return x.AvatarId - } - return "" -} - -func (x *RadioUserProfile) GetIsVip() int32 { - if x != nil { - return x.IsVip - } - return 0 -} - -func (x *RadioUserProfile) GetVipExpireAt() int64 { - if x != nil { - return x.VipExpireAt - } - return 0 -} - -func (x *RadioUserProfile) GetVipLevel() int32 { - if x != nil { - return x.VipLevel - } - return 0 -} - -type GetProfileReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetProfileReq) Reset() { - *x = GetProfileReq{} - mi := &file_pb_radio_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetProfileReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetProfileReq) ProtoMessage() {} - -func (x *GetProfileReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetProfileReq.ProtoReflect.Descriptor instead. -func (*GetProfileReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{4} -} - -func (x *GetProfileReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type CategoryInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` - Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CategoryInfo) Reset() { - *x = CategoryInfo{} - mi := &file_pb_radio_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CategoryInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CategoryInfo) ProtoMessage() {} - -func (x *CategoryInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CategoryInfo.ProtoReflect.Descriptor instead. -func (*CategoryInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{5} -} - -func (x *CategoryInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *CategoryInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CategoryInfo) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *CategoryInfo) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -type CategoryReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"` - Sort int32 `protobuf:"varint,3,opt,name=sort,proto3" json:"sort,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CategoryReq) Reset() { - *x = CategoryReq{} - mi := &file_pb_radio_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CategoryReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CategoryReq) ProtoMessage() {} - -func (x *CategoryReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CategoryReq.ProtoReflect.Descriptor instead. -func (*CategoryReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{6} -} - -func (x *CategoryReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CategoryReq) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *CategoryReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -type CategoryUpdateReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` - Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CategoryUpdateReq) Reset() { - *x = CategoryUpdateReq{} - mi := &file_pb_radio_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CategoryUpdateReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CategoryUpdateReq) ProtoMessage() {} - -func (x *CategoryUpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CategoryUpdateReq.ProtoReflect.Descriptor instead. -func (*CategoryUpdateReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{7} -} - -func (x *CategoryUpdateReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *CategoryUpdateReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CategoryUpdateReq) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *CategoryUpdateReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -type CategoryListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*CategoryInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CategoryListResp) Reset() { - *x = CategoryListResp{} - mi := &file_pb_radio_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CategoryListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CategoryListResp) ProtoMessage() {} - -func (x *CategoryListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CategoryListResp.ProtoReflect.Descriptor instead. -func (*CategoryListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{8} -} - -func (x *CategoryListResp) GetList() []*CategoryInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *CategoryListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type CategoryListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CategoryListReq) Reset() { - *x = CategoryListReq{} - mi := &file_pb_radio_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CategoryListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CategoryListReq) ProtoMessage() {} - -func (x *CategoryListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CategoryListReq.ProtoReflect.Descriptor instead. -func (*CategoryListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{9} -} - -func (x *CategoryListReq) GetCurrent() int32 { - if x != nil { - return x.Current - } - return 0 -} - -func (x *CategoryListReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type ChannelInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - CategoryId string `protobuf:"bytes,2,opt,name=categoryId,proto3" json:"categoryId,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - IsFree int32 `protobuf:"varint,5,opt,name=isFree,proto3" json:"isFree,omitempty"` - IsVipOnly int32 `protobuf:"varint,6,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` - MonthlyPrice int32 `protobuf:"varint,7,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - QuarterlyPrice int32 `protobuf:"varint,8,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` - AnnualPrice int32 `protobuf:"varint,9,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` - Cover string `protobuf:"bytes,10,opt,name=cover,proto3" json:"cover,omitempty"` - Tags string `protobuf:"bytes,11,opt,name=tags,proto3" json:"tags,omitempty"` - Sort int32 `protobuf:"varint,12,opt,name=sort,proto3" json:"sort,omitempty"` - Status int32 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChannelInfo) Reset() { - *x = ChannelInfo{} - mi := &file_pb_radio_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChannelInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelInfo) ProtoMessage() {} - -func (x *ChannelInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChannelInfo.ProtoReflect.Descriptor instead. -func (*ChannelInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{10} -} - -func (x *ChannelInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ChannelInfo) GetCategoryId() string { - if x != nil { - return x.CategoryId - } - return "" -} - -func (x *ChannelInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ChannelInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ChannelInfo) GetIsFree() int32 { - if x != nil { - return x.IsFree - } - return 0 -} - -func (x *ChannelInfo) GetIsVipOnly() int32 { - if x != nil { - return x.IsVipOnly - } - return 0 -} - -func (x *ChannelInfo) GetMonthlyPrice() int32 { - if x != nil { - return x.MonthlyPrice - } - return 0 -} - -func (x *ChannelInfo) GetQuarterlyPrice() int32 { - if x != nil { - return x.QuarterlyPrice - } - return 0 -} - -func (x *ChannelInfo) GetAnnualPrice() int32 { - if x != nil { - return x.AnnualPrice - } - return 0 -} - -func (x *ChannelInfo) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *ChannelInfo) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -func (x *ChannelInfo) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -func (x *ChannelInfo) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type CreateChannelReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - CategoryId string `protobuf:"bytes,1,opt,name=categoryId,proto3" json:"categoryId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - IsFree int32 `protobuf:"varint,4,opt,name=isFree,proto3" json:"isFree,omitempty"` - IsVipOnly int32 `protobuf:"varint,5,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` - MonthlyPrice int32 `protobuf:"varint,6,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - QuarterlyPrice int32 `protobuf:"varint,7,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` - AnnualPrice int32 `protobuf:"varint,8,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` - Cover string `protobuf:"bytes,9,opt,name=cover,proto3" json:"cover,omitempty"` - Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` - Sort int32 `protobuf:"varint,11,opt,name=sort,proto3" json:"sort,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateChannelReq) Reset() { - *x = CreateChannelReq{} - mi := &file_pb_radio_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateChannelReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateChannelReq) ProtoMessage() {} - -func (x *CreateChannelReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateChannelReq.ProtoReflect.Descriptor instead. -func (*CreateChannelReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{11} -} - -func (x *CreateChannelReq) GetCategoryId() string { - if x != nil { - return x.CategoryId - } - return "" -} - -func (x *CreateChannelReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CreateChannelReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *CreateChannelReq) GetIsFree() int32 { - if x != nil { - return x.IsFree - } - return 0 -} - -func (x *CreateChannelReq) GetIsVipOnly() int32 { - if x != nil { - return x.IsVipOnly - } - return 0 -} - -func (x *CreateChannelReq) GetMonthlyPrice() int32 { - if x != nil { - return x.MonthlyPrice - } - return 0 -} - -func (x *CreateChannelReq) GetQuarterlyPrice() int32 { - if x != nil { - return x.QuarterlyPrice - } - return 0 -} - -func (x *CreateChannelReq) GetAnnualPrice() int32 { - if x != nil { - return x.AnnualPrice - } - return 0 -} - -func (x *CreateChannelReq) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *CreateChannelReq) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -func (x *CreateChannelReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -type UpdateChannelReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - CategoryId string `protobuf:"bytes,2,opt,name=categoryId,proto3" json:"categoryId,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - IsFree int32 `protobuf:"varint,5,opt,name=isFree,proto3" json:"isFree,omitempty"` - IsVipOnly int32 `protobuf:"varint,6,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` - MonthlyPrice int32 `protobuf:"varint,7,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - QuarterlyPrice int32 `protobuf:"varint,8,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` - AnnualPrice int32 `protobuf:"varint,9,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` - Cover string `protobuf:"bytes,10,opt,name=cover,proto3" json:"cover,omitempty"` - Tags string `protobuf:"bytes,11,opt,name=tags,proto3" json:"tags,omitempty"` - Sort int32 `protobuf:"varint,12,opt,name=sort,proto3" json:"sort,omitempty"` - Status int32 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateChannelReq) Reset() { - *x = UpdateChannelReq{} - mi := &file_pb_radio_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateChannelReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateChannelReq) ProtoMessage() {} - -func (x *UpdateChannelReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateChannelReq.ProtoReflect.Descriptor instead. -func (*UpdateChannelReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{12} -} - -func (x *UpdateChannelReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UpdateChannelReq) GetCategoryId() string { - if x != nil { - return x.CategoryId - } - return "" -} - -func (x *UpdateChannelReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateChannelReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *UpdateChannelReq) GetIsFree() int32 { - if x != nil { - return x.IsFree - } - return 0 -} - -func (x *UpdateChannelReq) GetIsVipOnly() int32 { - if x != nil { - return x.IsVipOnly - } - return 0 -} - -func (x *UpdateChannelReq) GetMonthlyPrice() int32 { - if x != nil { - return x.MonthlyPrice - } - return 0 -} - -func (x *UpdateChannelReq) GetQuarterlyPrice() int32 { - if x != nil { - return x.QuarterlyPrice - } - return 0 -} - -func (x *UpdateChannelReq) GetAnnualPrice() int32 { - if x != nil { - return x.AnnualPrice - } - return 0 -} - -func (x *UpdateChannelReq) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *UpdateChannelReq) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -func (x *UpdateChannelReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -func (x *UpdateChannelReq) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type ChannelListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` - CategoryId string `protobuf:"bytes,3,opt,name=categoryId,proto3" json:"categoryId,omitempty"` - UserId string `protobuf:"bytes,4,opt,name=userId,proto3" json:"userId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChannelListReq) Reset() { - *x = ChannelListReq{} - mi := &file_pb_radio_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChannelListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelListReq) ProtoMessage() {} - -func (x *ChannelListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChannelListReq.ProtoReflect.Descriptor instead. -func (*ChannelListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{13} -} - -func (x *ChannelListReq) GetCurrent() int32 { - if x != nil { - return x.Current - } - return 0 -} - -func (x *ChannelListReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ChannelListReq) GetCategoryId() string { - if x != nil { - return x.CategoryId - } - return "" -} - -func (x *ChannelListReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type ChannelListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*ChannelInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChannelListResp) Reset() { - *x = ChannelListResp{} - mi := &file_pb_radio_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChannelListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelListResp) ProtoMessage() {} - -func (x *ChannelListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChannelListResp.ProtoReflect.Descriptor instead. -func (*ChannelListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{14} -} - -func (x *ChannelListResp) GetList() []*ChannelInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *ChannelListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type ProgramInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` - Cover string `protobuf:"bytes,6,opt,name=cover,proto3" json:"cover,omitempty"` - AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` - AudioStatus int32 `protobuf:"varint,8,opt,name=audioStatus,proto3" json:"audioStatus,omitempty"` - Duration int32 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"` - Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` - PlayCount int32 `protobuf:"varint,11,opt,name=playCount,proto3" json:"playCount,omitempty"` - LikeCount int32 `protobuf:"varint,12,opt,name=likeCount,proto3" json:"likeCount,omitempty"` - Status int32 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProgramInfo) Reset() { - *x = ProgramInfo{} - mi := &file_pb_radio_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProgramInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProgramInfo) ProtoMessage() {} - -func (x *ProgramInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProgramInfo.ProtoReflect.Descriptor instead. -func (*ProgramInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{15} -} - -func (x *ProgramInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ProgramInfo) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *ProgramInfo) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *ProgramInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ProgramInfo) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *ProgramInfo) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *ProgramInfo) GetAudioId() string { - if x != nil { - return x.AudioId - } - return "" -} - -func (x *ProgramInfo) GetAudioStatus() int32 { - if x != nil { - return x.AudioStatus - } - return 0 -} - -func (x *ProgramInfo) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *ProgramInfo) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -func (x *ProgramInfo) GetPlayCount() int32 { - if x != nil { - return x.PlayCount - } - return 0 -} - -func (x *ProgramInfo) GetLikeCount() int32 { - if x != nil { - return x.LikeCount - } - return 0 -} - -func (x *ProgramInfo) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type CreateProgramReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - ChannelId string `protobuf:"bytes,1,opt,name=channelId,proto3" json:"channelId,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` - Cover string `protobuf:"bytes,5,opt,name=cover,proto3" json:"cover,omitempty"` - Tags string `protobuf:"bytes,6,opt,name=tags,proto3" json:"tags,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateProgramReq) Reset() { - *x = CreateProgramReq{} - mi := &file_pb_radio_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateProgramReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateProgramReq) ProtoMessage() {} - -func (x *CreateProgramReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateProgramReq.ProtoReflect.Descriptor instead. -func (*CreateProgramReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{16} -} - -func (x *CreateProgramReq) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *CreateProgramReq) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *CreateProgramReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *CreateProgramReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *CreateProgramReq) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *CreateProgramReq) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -type UpdateProgramReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` - Cover string `protobuf:"bytes,6,opt,name=cover,proto3" json:"cover,omitempty"` - AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` - AudioStatus int32 `protobuf:"varint,8,opt,name=audioStatus,proto3" json:"audioStatus,omitempty"` - Duration int32 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"` - Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` - Status int32 `protobuf:"varint,11,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateProgramReq) Reset() { - *x = UpdateProgramReq{} - mi := &file_pb_radio_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateProgramReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateProgramReq) ProtoMessage() {} - -func (x *UpdateProgramReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateProgramReq.ProtoReflect.Descriptor instead. -func (*UpdateProgramReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{17} -} - -func (x *UpdateProgramReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UpdateProgramReq) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *UpdateProgramReq) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *UpdateProgramReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *UpdateProgramReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *UpdateProgramReq) GetCover() string { - if x != nil { - return x.Cover - } - return "" -} - -func (x *UpdateProgramReq) GetAudioId() string { - if x != nil { - return x.AudioId - } - return "" -} - -func (x *UpdateProgramReq) GetAudioStatus() int32 { - if x != nil { - return x.AudioStatus - } - return 0 -} - -func (x *UpdateProgramReq) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *UpdateProgramReq) GetTags() string { - if x != nil { - return x.Tags - } - return "" -} - -func (x *UpdateProgramReq) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type ProgramListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` - ChannelId string `protobuf:"bytes,3,opt,name=channelId,proto3" json:"channelId,omitempty"` - UserId string `protobuf:"bytes,4,opt,name=userId,proto3" json:"userId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProgramListReq) Reset() { - *x = ProgramListReq{} - mi := &file_pb_radio_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProgramListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProgramListReq) ProtoMessage() {} - -func (x *ProgramListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProgramListReq.ProtoReflect.Descriptor instead. -func (*ProgramListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{18} -} - -func (x *ProgramListReq) GetCurrent() int32 { - if x != nil { - return x.Current - } - return 0 -} - -func (x *ProgramListReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ProgramListReq) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *ProgramListReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type ProgramListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProgramListResp) Reset() { - *x = ProgramListResp{} - mi := &file_pb_radio_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProgramListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProgramListResp) ProtoMessage() {} - -func (x *ProgramListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProgramListResp.ProtoReflect.Descriptor instead. -func (*ProgramListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{19} -} - -func (x *ProgramListResp) GetList() []*ProgramInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *ProgramListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type VoiceInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SpeakerId string `protobuf:"bytes,2,opt,name=speakerId,proto3" json:"speakerId,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Gender string `protobuf:"bytes,5,opt,name=gender,proto3" json:"gender,omitempty"` - Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` - AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` - Sort int32 `protobuf:"varint,8,opt,name=sort,proto3" json:"sort,omitempty"` - Status int32 `protobuf:"varint,9,opt,name=status,proto3" json:"status,omitempty"` - IsDefault int32 `protobuf:"varint,10,opt,name=isDefault,proto3" json:"isDefault,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VoiceInfo) Reset() { - *x = VoiceInfo{} - mi := &file_pb_radio_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VoiceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VoiceInfo) ProtoMessage() {} - -func (x *VoiceInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VoiceInfo.ProtoReflect.Descriptor instead. -func (*VoiceInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{20} -} - -func (x *VoiceInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *VoiceInfo) GetSpeakerId() string { - if x != nil { - return x.SpeakerId - } - return "" -} - -func (x *VoiceInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *VoiceInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *VoiceInfo) GetGender() string { - if x != nil { - return x.Gender - } - return "" -} - -func (x *VoiceInfo) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *VoiceInfo) GetAudioId() string { - if x != nil { - return x.AudioId - } - return "" -} - -func (x *VoiceInfo) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -func (x *VoiceInfo) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *VoiceInfo) GetIsDefault() int32 { - if x != nil { - return x.IsDefault - } - return 0 -} - -type CreateVoiceReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - SpeakerId string `protobuf:"bytes,1,opt,name=speakerId,proto3" json:"speakerId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Gender string `protobuf:"bytes,4,opt,name=gender,proto3" json:"gender,omitempty"` - Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` - AudioId string `protobuf:"bytes,6,opt,name=audioId,proto3" json:"audioId,omitempty"` - Sort int32 `protobuf:"varint,7,opt,name=sort,proto3" json:"sort,omitempty"` - IsDefault int32 `protobuf:"varint,8,opt,name=isDefault,proto3" json:"isDefault,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateVoiceReq) Reset() { - *x = CreateVoiceReq{} - mi := &file_pb_radio_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateVoiceReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateVoiceReq) ProtoMessage() {} - -func (x *CreateVoiceReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateVoiceReq.ProtoReflect.Descriptor instead. -func (*CreateVoiceReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{21} -} - -func (x *CreateVoiceReq) GetSpeakerId() string { - if x != nil { - return x.SpeakerId - } - return "" -} - -func (x *CreateVoiceReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CreateVoiceReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *CreateVoiceReq) GetGender() string { - if x != nil { - return x.Gender - } - return "" -} - -func (x *CreateVoiceReq) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *CreateVoiceReq) GetAudioId() string { - if x != nil { - return x.AudioId - } - return "" -} - -func (x *CreateVoiceReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -func (x *CreateVoiceReq) GetIsDefault() int32 { - if x != nil { - return x.IsDefault - } - return 0 -} - -type UpdateVoiceReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SpeakerId string `protobuf:"bytes,2,opt,name=speakerId,proto3" json:"speakerId,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Gender string `protobuf:"bytes,5,opt,name=gender,proto3" json:"gender,omitempty"` - Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` - AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` - Sort int32 `protobuf:"varint,8,opt,name=sort,proto3" json:"sort,omitempty"` - Status int32 `protobuf:"varint,9,opt,name=status,proto3" json:"status,omitempty"` - IsDefault int32 `protobuf:"varint,10,opt,name=isDefault,proto3" json:"isDefault,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateVoiceReq) Reset() { - *x = UpdateVoiceReq{} - mi := &file_pb_radio_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateVoiceReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateVoiceReq) ProtoMessage() {} - -func (x *UpdateVoiceReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateVoiceReq.ProtoReflect.Descriptor instead. -func (*UpdateVoiceReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{22} -} - -func (x *UpdateVoiceReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UpdateVoiceReq) GetSpeakerId() string { - if x != nil { - return x.SpeakerId - } - return "" -} - -func (x *UpdateVoiceReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateVoiceReq) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *UpdateVoiceReq) GetGender() string { - if x != nil { - return x.Gender - } - return "" -} - -func (x *UpdateVoiceReq) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *UpdateVoiceReq) GetAudioId() string { - if x != nil { - return x.AudioId - } - return "" -} - -func (x *UpdateVoiceReq) GetSort() int32 { - if x != nil { - return x.Sort - } - return 0 -} - -func (x *UpdateVoiceReq) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *UpdateVoiceReq) GetIsDefault() int32 { - if x != nil { - return x.IsDefault - } - return 0 -} - -type VoiceListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VoiceListReq) Reset() { - *x = VoiceListReq{} - mi := &file_pb_radio_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VoiceListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VoiceListReq) ProtoMessage() {} - -func (x *VoiceListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VoiceListReq.ProtoReflect.Descriptor instead. -func (*VoiceListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{23} -} - -func (x *VoiceListReq) GetCurrent() int32 { - if x != nil { - return x.Current - } - return 0 -} - -func (x *VoiceListReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type VoiceListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*VoiceInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VoiceListResp) Reset() { - *x = VoiceListResp{} - mi := &file_pb_radio_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VoiceListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VoiceListResp) ProtoMessage() {} - -func (x *VoiceListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VoiceListResp.ProtoReflect.Descriptor instead. -func (*VoiceListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{24} -} - -func (x *VoiceListResp) GetList() []*VoiceInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *VoiceListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type ToggleLikeReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ToggleLikeReq) Reset() { - *x = ToggleLikeReq{} - mi := &file_pb_radio_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ToggleLikeReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleLikeReq) ProtoMessage() {} - -func (x *ToggleLikeReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleLikeReq.ProtoReflect.Descriptor instead. -func (*ToggleLikeReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{25} -} - -func (x *ToggleLikeReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *ToggleLikeReq) GetProgramId() string { - if x != nil { - return x.ProgramId - } - return "" -} - -type ToggleFavoriteReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ToggleFavoriteReq) Reset() { - *x = ToggleFavoriteReq{} - mi := &file_pb_radio_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ToggleFavoriteReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleFavoriteReq) ProtoMessage() {} - -func (x *ToggleFavoriteReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleFavoriteReq.ProtoReflect.Descriptor instead. -func (*ToggleFavoriteReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{26} -} - -func (x *ToggleFavoriteReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *ToggleFavoriteReq) GetProgramId() string { - if x != nil { - return x.ProgramId - } - return "" -} - -type CommentReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` - Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` - ParentId string `protobuf:"bytes,4,opt,name=parentId,proto3" json:"parentId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CommentReq) Reset() { - *x = CommentReq{} - mi := &file_pb_radio_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CommentReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommentReq) ProtoMessage() {} - -func (x *CommentReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommentReq.ProtoReflect.Descriptor instead. -func (*CommentReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{27} -} - -func (x *CommentReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *CommentReq) GetProgramId() string { - if x != nil { - return x.ProgramId - } - return "" -} - -func (x *CommentReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *CommentReq) GetParentId() string { - if x != nil { - return x.ParentId - } - return "" -} - -type RecordHistoryReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` - Duration int32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RecordHistoryReq) Reset() { - *x = RecordHistoryReq{} - mi := &file_pb_radio_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RecordHistoryReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RecordHistoryReq) ProtoMessage() {} - -func (x *RecordHistoryReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RecordHistoryReq.ProtoReflect.Descriptor instead. -func (*RecordHistoryReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{28} -} - -func (x *RecordHistoryReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *RecordHistoryReq) GetProgramId() string { - if x != nil { - return x.ProgramId - } - return "" -} - -func (x *RecordHistoryReq) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -type InteractionListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - Current int32 `protobuf:"varint,2,opt,name=current,proto3" json:"current,omitempty"` - PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InteractionListReq) Reset() { - *x = InteractionListReq{} - mi := &file_pb_radio_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InteractionListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InteractionListReq) ProtoMessage() {} - -func (x *InteractionListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InteractionListReq.ProtoReflect.Descriptor instead. -func (*InteractionListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{29} -} - -func (x *InteractionListReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *InteractionListReq) GetCurrent() int32 { - if x != nil { - return x.Current - } - return 0 -} - -func (x *InteractionListReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type FavoriteListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FavoriteListResp) Reset() { - *x = FavoriteListResp{} - mi := &file_pb_radio_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FavoriteListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FavoriteListResp) ProtoMessage() {} - -func (x *FavoriteListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[30] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FavoriteListResp.ProtoReflect.Descriptor instead. -func (*FavoriteListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{30} -} - -func (x *FavoriteListResp) GetList() []*ProgramInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *FavoriteListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type HistoryListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HistoryListResp) Reset() { - *x = HistoryListResp{} - mi := &file_pb_radio_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HistoryListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HistoryListResp) ProtoMessage() {} - -func (x *HistoryListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[31] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HistoryListResp.ProtoReflect.Descriptor instead. -func (*HistoryListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{31} -} - -func (x *HistoryListResp) GetList() []*ProgramInfo { - if x != nil { - return x.List - } - return nil -} - -func (x *HistoryListResp) GetTotal() int64 { - if x != nil { - return x.Total - } - return 0 -} - -type SubscriptionInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` - ExpiredAt int64 `protobuf:"varint,3,opt,name=expiredAt,proto3" json:"expiredAt,omitempty"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscriptionInfo) Reset() { - *x = SubscriptionInfo{} - mi := &file_pb_radio_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscriptionInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscriptionInfo) ProtoMessage() {} - -func (x *SubscriptionInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[32] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubscriptionInfo.ProtoReflect.Descriptor instead. -func (*SubscriptionInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{32} -} - -func (x *SubscriptionInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *SubscriptionInfo) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *SubscriptionInfo) GetExpiredAt() int64 { - if x != nil { - return x.ExpiredAt - } - return 0 -} - -func (x *SubscriptionInfo) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type SubscriptionListReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscriptionListReq) Reset() { - *x = SubscriptionListReq{} - mi := &file_pb_radio_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscriptionListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscriptionListReq) ProtoMessage() {} - -func (x *SubscriptionListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[33] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubscriptionListReq.ProtoReflect.Descriptor instead. -func (*SubscriptionListReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{33} -} - -func (x *SubscriptionListReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type SubscriptionListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*SubscriptionInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscriptionListResp) Reset() { - *x = SubscriptionListResp{} - mi := &file_pb_radio_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscriptionListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscriptionListResp) ProtoMessage() {} - -func (x *SubscriptionListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[34] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubscriptionListResp.ProtoReflect.Descriptor instead. -func (*SubscriptionListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{34} -} - -func (x *SubscriptionListResp) GetList() []*SubscriptionInfo { - if x != nil { - return x.List - } - return nil -} - -type CreatePayOrderReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` - PlanType string `protobuf:"bytes,3,opt,name=planType,proto3" json:"planType,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreatePayOrderReq) Reset() { - *x = CreatePayOrderReq{} - mi := &file_pb_radio_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreatePayOrderReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePayOrderReq) ProtoMessage() {} - -func (x *CreatePayOrderReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[35] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreatePayOrderReq.ProtoReflect.Descriptor instead. -func (*CreatePayOrderReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{35} -} - -func (x *CreatePayOrderReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *CreatePayOrderReq) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *CreatePayOrderReq) GetPlanType() string { - if x != nil { - return x.PlanType - } - return "" -} - -type CreatePayOrderResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - OrderNo string `protobuf:"bytes,1,opt,name=orderNo,proto3" json:"orderNo,omitempty"` - PrepayId string `protobuf:"bytes,2,opt,name=prepayId,proto3" json:"prepayId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreatePayOrderResp) Reset() { - *x = CreatePayOrderResp{} - mi := &file_pb_radio_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreatePayOrderResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePayOrderResp) ProtoMessage() {} - -func (x *CreatePayOrderResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[36] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreatePayOrderResp.ProtoReflect.Descriptor instead. -func (*CreatePayOrderResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{36} -} - -func (x *CreatePayOrderResp) GetOrderNo() string { - if x != nil { - return x.OrderNo - } - return "" -} - -func (x *CreatePayOrderResp) GetPrepayId() string { - if x != nil { - return x.PrepayId - } - return "" -} - -type VipConfigInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - PlanType string `protobuf:"bytes,3,opt,name=planType,proto3" json:"planType,omitempty"` - Price int32 `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"` - OriginalPrice int32 `protobuf:"varint,5,opt,name=originalPrice,proto3" json:"originalPrice,omitempty"` - Duration int32 `protobuf:"varint,6,opt,name=duration,proto3" json:"duration,omitempty"` - Desc string `protobuf:"bytes,7,opt,name=desc,proto3" json:"desc,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VipConfigInfo) Reset() { - *x = VipConfigInfo{} - mi := &file_pb_radio_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VipConfigInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VipConfigInfo) ProtoMessage() {} - -func (x *VipConfigInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[37] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VipConfigInfo.ProtoReflect.Descriptor instead. -func (*VipConfigInfo) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{37} -} - -func (x *VipConfigInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *VipConfigInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *VipConfigInfo) GetPlanType() string { - if x != nil { - return x.PlanType - } - return "" -} - -func (x *VipConfigInfo) GetPrice() int32 { - if x != nil { - return x.Price - } - return 0 -} - -func (x *VipConfigInfo) GetOriginalPrice() int32 { - if x != nil { - return x.OriginalPrice - } - return 0 -} - -func (x *VipConfigInfo) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *VipConfigInfo) GetDesc() string { - if x != nil { - return x.Desc - } - return "" -} - -type VipConfigListResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*VipConfigInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VipConfigListResp) Reset() { - *x = VipConfigListResp{} - mi := &file_pb_radio_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VipConfigListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VipConfigListResp) ProtoMessage() {} - -func (x *VipConfigListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[38] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VipConfigListResp.ProtoReflect.Descriptor instead. -func (*VipConfigListResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{38} -} - -func (x *VipConfigListResp) GetList() []*VipConfigInfo { - if x != nil { - return x.List - } - return nil -} - -type AnalyticsReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - StartDate string `protobuf:"bytes,1,opt,name=startDate,proto3" json:"startDate,omitempty"` - EndDate string `protobuf:"bytes,2,opt,name=endDate,proto3" json:"endDate,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AnalyticsReq) Reset() { - *x = AnalyticsReq{} - mi := &file_pb_radio_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AnalyticsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnalyticsReq) ProtoMessage() {} - -func (x *AnalyticsReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[39] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnalyticsReq.ProtoReflect.Descriptor instead. -func (*AnalyticsReq) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{39} -} - -func (x *AnalyticsReq) GetStartDate() string { - if x != nil { - return x.StartDate - } - return "" -} - -func (x *AnalyticsReq) GetEndDate() string { - if x != nil { - return x.EndDate - } - return "" -} - -type AnalyticsOverviewResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - TotalUsers int64 `protobuf:"varint,1,opt,name=totalUsers,proto3" json:"totalUsers,omitempty"` - TotalPlays int64 `protobuf:"varint,2,opt,name=totalPlays,proto3" json:"totalPlays,omitempty"` - TotalChannels int64 `protobuf:"varint,3,opt,name=totalChannels,proto3" json:"totalChannels,omitempty"` - TotalPrograms int64 `protobuf:"varint,4,opt,name=totalPrograms,proto3" json:"totalPrograms,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AnalyticsOverviewResp) Reset() { - *x = AnalyticsOverviewResp{} - mi := &file_pb_radio_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AnalyticsOverviewResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnalyticsOverviewResp) ProtoMessage() {} - -func (x *AnalyticsOverviewResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[40] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnalyticsOverviewResp.ProtoReflect.Descriptor instead. -func (*AnalyticsOverviewResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{40} -} - -func (x *AnalyticsOverviewResp) GetTotalUsers() int64 { - if x != nil { - return x.TotalUsers - } - return 0 -} - -func (x *AnalyticsOverviewResp) GetTotalPlays() int64 { - if x != nil { - return x.TotalPlays - } - return 0 -} - -func (x *AnalyticsOverviewResp) GetTotalChannels() int64 { - if x != nil { - return x.TotalChannels - } - return 0 -} - -func (x *AnalyticsOverviewResp) GetTotalPrograms() int64 { - if x != nil { - return x.TotalPrograms - } - return 0 -} - -type ChannelAnalyticsResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*ChannelAnalyticsItem `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChannelAnalyticsResp) Reset() { - *x = ChannelAnalyticsResp{} - mi := &file_pb_radio_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChannelAnalyticsResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelAnalyticsResp) ProtoMessage() {} - -func (x *ChannelAnalyticsResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[41] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChannelAnalyticsResp.ProtoReflect.Descriptor instead. -func (*ChannelAnalyticsResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{41} -} - -func (x *ChannelAnalyticsResp) GetList() []*ChannelAnalyticsItem { - if x != nil { - return x.List - } - return nil -} - -type ChannelAnalyticsItem struct { - state protoimpl.MessageState `protogen:"open.v1"` - ChannelId string `protobuf:"bytes,1,opt,name=channelId,proto3" json:"channelId,omitempty"` - ChannelName string `protobuf:"bytes,2,opt,name=channelName,proto3" json:"channelName,omitempty"` - PlayCount int64 `protobuf:"varint,3,opt,name=playCount,proto3" json:"playCount,omitempty"` - LikeCount int64 `protobuf:"varint,4,opt,name=likeCount,proto3" json:"likeCount,omitempty"` - SubscriberCount int64 `protobuf:"varint,5,opt,name=subscriberCount,proto3" json:"subscriberCount,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChannelAnalyticsItem) Reset() { - *x = ChannelAnalyticsItem{} - mi := &file_pb_radio_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChannelAnalyticsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelAnalyticsItem) ProtoMessage() {} - -func (x *ChannelAnalyticsItem) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[42] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChannelAnalyticsItem.ProtoReflect.Descriptor instead. -func (*ChannelAnalyticsItem) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{42} -} - -func (x *ChannelAnalyticsItem) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *ChannelAnalyticsItem) GetChannelName() string { - if x != nil { - return x.ChannelName - } - return "" -} - -func (x *ChannelAnalyticsItem) GetPlayCount() int64 { - if x != nil { - return x.PlayCount - } - return 0 -} - -func (x *ChannelAnalyticsItem) GetLikeCount() int64 { - if x != nil { - return x.LikeCount - } - return 0 -} - -func (x *ChannelAnalyticsItem) GetSubscriberCount() int64 { - if x != nil { - return x.SubscriberCount - } - return 0 -} - -type UserAnalyticsResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - NewUsers int64 `protobuf:"varint,1,opt,name=newUsers,proto3" json:"newUsers,omitempty"` - ActiveUsers int64 `protobuf:"varint,2,opt,name=activeUsers,proto3" json:"activeUsers,omitempty"` - VipUsers int64 `protobuf:"varint,3,opt,name=vipUsers,proto3" json:"vipUsers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserAnalyticsResp) Reset() { - *x = UserAnalyticsResp{} - mi := &file_pb_radio_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserAnalyticsResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserAnalyticsResp) ProtoMessage() {} - -func (x *UserAnalyticsResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_radio_proto_msgTypes[43] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserAnalyticsResp.ProtoReflect.Descriptor instead. -func (*UserAnalyticsResp) Descriptor() ([]byte, []int) { - return file_pb_radio_proto_rawDescGZIP(), []int{43} -} - -func (x *UserAnalyticsResp) GetNewUsers() int64 { - if x != nil { - return x.NewUsers - } - return 0 -} - -func (x *UserAnalyticsResp) GetActiveUsers() int64 { - if x != nil { - return x.ActiveUsers - } - return 0 -} - -func (x *UserAnalyticsResp) GetVipUsers() int64 { - if x != nil { - return x.VipUsers - } - return 0 -} - -var File_pb_radio_proto protoreflect.FileDescriptor - -const file_pb_radio_proto_rawDesc = "" + - "\n" + - "\x0epb/radio.proto\x12\x05radio\"2\n" + - "\n" + - "CommonResp\x12\x12\n" + - "\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" + - "\x03msg\x18\x02 \x01(\tR\x03msg\"\x17\n" + - "\x05IdReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\"\x1a\n" + - "\x06IdsReq\x12\x10\n" + - "\x03ids\x18\x01 \x03(\tR\x03ids\"\xc6\x01\n" + - "\x10RadioUserProfile\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + - "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x1a\n" + - "\bnickName\x18\x03 \x01(\tR\bnickName\x12\x1a\n" + - "\bavatarId\x18\x04 \x01(\tR\bavatarId\x12\x14\n" + - "\x05isVip\x18\x05 \x01(\x05R\x05isVip\x12 \n" + - "\vvipExpireAt\x18\x06 \x01(\x03R\vvipExpireAt\x12\x1a\n" + - "\bvipLevel\x18\a \x01(\x05R\bvipLevel\"'\n" + - "\rGetProfileReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\"Z\n" + - "\fCategoryInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04icon\x18\x03 \x01(\tR\x04icon\x12\x12\n" + - "\x04sort\x18\x04 \x01(\x05R\x04sort\"I\n" + - "\vCategoryReq\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + - "\x04icon\x18\x02 \x01(\tR\x04icon\x12\x12\n" + - "\x04sort\x18\x03 \x01(\x05R\x04sort\"_\n" + - "\x11CategoryUpdateReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04icon\x18\x03 \x01(\tR\x04icon\x12\x12\n" + - "\x04sort\x18\x04 \x01(\x05R\x04sort\"Q\n" + - "\x10CategoryListResp\x12'\n" + - "\x04list\x18\x01 \x03(\v2\x13.radio.CategoryInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"G\n" + - "\x0fCategoryListReq\x12\x18\n" + - "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + - "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"\xed\x02\n" + - "\vChannelInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1e\n" + - "\n" + - "categoryId\x18\x02 \x01(\tR\n" + - "categoryId\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + - "\x06isFree\x18\x05 \x01(\x05R\x06isFree\x12\x1c\n" + - "\tisVipOnly\x18\x06 \x01(\x05R\tisVipOnly\x12\"\n" + - "\fmonthlyPrice\x18\a \x01(\x05R\fmonthlyPrice\x12&\n" + - "\x0equarterlyPrice\x18\b \x01(\x05R\x0equarterlyPrice\x12 \n" + - "\vannualPrice\x18\t \x01(\x05R\vannualPrice\x12\x14\n" + - "\x05cover\x18\n" + - " \x01(\tR\x05cover\x12\x12\n" + - "\x04tags\x18\v \x01(\tR\x04tags\x12\x12\n" + - "\x04sort\x18\f \x01(\x05R\x04sort\x12\x16\n" + - "\x06status\x18\r \x01(\x05R\x06status\"\xca\x02\n" + - "\x10CreateChannelReq\x12\x1e\n" + - "\n" + - "categoryId\x18\x01 \x01(\tR\n" + - "categoryId\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x16\n" + - "\x06isFree\x18\x04 \x01(\x05R\x06isFree\x12\x1c\n" + - "\tisVipOnly\x18\x05 \x01(\x05R\tisVipOnly\x12\"\n" + - "\fmonthlyPrice\x18\x06 \x01(\x05R\fmonthlyPrice\x12&\n" + - "\x0equarterlyPrice\x18\a \x01(\x05R\x0equarterlyPrice\x12 \n" + - "\vannualPrice\x18\b \x01(\x05R\vannualPrice\x12\x14\n" + - "\x05cover\x18\t \x01(\tR\x05cover\x12\x12\n" + - "\x04tags\x18\n" + - " \x01(\tR\x04tags\x12\x12\n" + - "\x04sort\x18\v \x01(\x05R\x04sort\"\xf2\x02\n" + - "\x10UpdateChannelReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1e\n" + - "\n" + - "categoryId\x18\x02 \x01(\tR\n" + - "categoryId\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + - "\x06isFree\x18\x05 \x01(\x05R\x06isFree\x12\x1c\n" + - "\tisVipOnly\x18\x06 \x01(\x05R\tisVipOnly\x12\"\n" + - "\fmonthlyPrice\x18\a \x01(\x05R\fmonthlyPrice\x12&\n" + - "\x0equarterlyPrice\x18\b \x01(\x05R\x0equarterlyPrice\x12 \n" + - "\vannualPrice\x18\t \x01(\x05R\vannualPrice\x12\x14\n" + - "\x05cover\x18\n" + - " \x01(\tR\x05cover\x12\x12\n" + - "\x04tags\x18\v \x01(\tR\x04tags\x12\x12\n" + - "\x04sort\x18\f \x01(\x05R\x04sort\x12\x16\n" + - "\x06status\x18\r \x01(\x05R\x06status\"~\n" + - "\x0eChannelListReq\x12\x18\n" + - "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + - "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x1e\n" + - "\n" + - "categoryId\x18\x03 \x01(\tR\n" + - "categoryId\x12\x16\n" + - "\x06userId\x18\x04 \x01(\tR\x06userId\"O\n" + - "\x0fChannelListResp\x12&\n" + - "\x04list\x18\x01 \x03(\v2\x12.radio.ChannelInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"\xe3\x02\n" + - "\vProgramInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x14\n" + - "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x18\n" + - "\acontent\x18\x05 \x01(\tR\acontent\x12\x14\n" + - "\x05cover\x18\x06 \x01(\tR\x05cover\x12\x18\n" + - "\aaudioId\x18\a \x01(\tR\aaudioId\x12 \n" + - "\vaudioStatus\x18\b \x01(\x05R\vaudioStatus\x12\x1a\n" + - "\bduration\x18\t \x01(\x05R\bduration\x12\x12\n" + - "\x04tags\x18\n" + - " \x01(\tR\x04tags\x12\x1c\n" + - "\tplayCount\x18\v \x01(\x05R\tplayCount\x12\x1c\n" + - "\tlikeCount\x18\f \x01(\x05R\tlikeCount\x12\x16\n" + - "\x06status\x18\r \x01(\x05R\x06status\"\xac\x01\n" + - "\x10CreateProgramReq\x12\x1c\n" + - "\tchannelId\x18\x01 \x01(\tR\tchannelId\x12\x14\n" + - "\x05title\x18\x02 \x01(\tR\x05title\x12 \n" + - "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" + - "\acontent\x18\x04 \x01(\tR\acontent\x12\x14\n" + - "\x05cover\x18\x05 \x01(\tR\x05cover\x12\x12\n" + - "\x04tags\x18\x06 \x01(\tR\x04tags\"\xac\x02\n" + - "\x10UpdateProgramReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x14\n" + - "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x18\n" + - "\acontent\x18\x05 \x01(\tR\acontent\x12\x14\n" + - "\x05cover\x18\x06 \x01(\tR\x05cover\x12\x18\n" + - "\aaudioId\x18\a \x01(\tR\aaudioId\x12 \n" + - "\vaudioStatus\x18\b \x01(\x05R\vaudioStatus\x12\x1a\n" + - "\bduration\x18\t \x01(\x05R\bduration\x12\x12\n" + - "\x04tags\x18\n" + - " \x01(\tR\x04tags\x12\x16\n" + - "\x06status\x18\v \x01(\x05R\x06status\"|\n" + - "\x0eProgramListReq\x12\x18\n" + - "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + - "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x1c\n" + - "\tchannelId\x18\x03 \x01(\tR\tchannelId\x12\x16\n" + - "\x06userId\x18\x04 \x01(\tR\x06userId\"O\n" + - "\x0fProgramListResp\x12&\n" + - "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"\xff\x01\n" + - "\tVoiceInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tspeakerId\x18\x02 \x01(\tR\tspeakerId\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + - "\x06gender\x18\x05 \x01(\tR\x06gender\x12\x12\n" + - "\x04icon\x18\x06 \x01(\tR\x04icon\x12\x18\n" + - "\aaudioId\x18\a \x01(\tR\aaudioId\x12\x12\n" + - "\x04sort\x18\b \x01(\x05R\x04sort\x12\x16\n" + - "\x06status\x18\t \x01(\x05R\x06status\x12\x1c\n" + - "\tisDefault\x18\n" + - " \x01(\x05R\tisDefault\"\xdc\x01\n" + - "\x0eCreateVoiceReq\x12\x1c\n" + - "\tspeakerId\x18\x01 \x01(\tR\tspeakerId\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x16\n" + - "\x06gender\x18\x04 \x01(\tR\x06gender\x12\x12\n" + - "\x04icon\x18\x05 \x01(\tR\x04icon\x12\x18\n" + - "\aaudioId\x18\x06 \x01(\tR\aaudioId\x12\x12\n" + - "\x04sort\x18\a \x01(\x05R\x04sort\x12\x1c\n" + - "\tisDefault\x18\b \x01(\x05R\tisDefault\"\x84\x02\n" + - "\x0eUpdateVoiceReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tspeakerId\x18\x02 \x01(\tR\tspeakerId\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + - "\x06gender\x18\x05 \x01(\tR\x06gender\x12\x12\n" + - "\x04icon\x18\x06 \x01(\tR\x04icon\x12\x18\n" + - "\aaudioId\x18\a \x01(\tR\aaudioId\x12\x12\n" + - "\x04sort\x18\b \x01(\x05R\x04sort\x12\x16\n" + - "\x06status\x18\t \x01(\x05R\x06status\x12\x1c\n" + - "\tisDefault\x18\n" + - " \x01(\x05R\tisDefault\"D\n" + - "\fVoiceListReq\x12\x18\n" + - "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + - "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"K\n" + - "\rVoiceListResp\x12$\n" + - "\x04list\x18\x01 \x03(\v2\x10.radio.VoiceInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"E\n" + - "\rToggleLikeReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + - "\tprogramId\x18\x02 \x01(\tR\tprogramId\"I\n" + - "\x11ToggleFavoriteReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + - "\tprogramId\x18\x02 \x01(\tR\tprogramId\"x\n" + - "\n" + - "CommentReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + - "\tprogramId\x18\x02 \x01(\tR\tprogramId\x12\x18\n" + - "\acontent\x18\x03 \x01(\tR\acontent\x12\x1a\n" + - "\bparentId\x18\x04 \x01(\tR\bparentId\"d\n" + - "\x10RecordHistoryReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + - "\tprogramId\x18\x02 \x01(\tR\tprogramId\x12\x1a\n" + - "\bduration\x18\x03 \x01(\x05R\bduration\"b\n" + - "\x12InteractionListReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + - "\acurrent\x18\x02 \x01(\x05R\acurrent\x12\x1a\n" + - "\bpageSize\x18\x03 \x01(\x05R\bpageSize\"P\n" + - "\x10FavoriteListResp\x12&\n" + - "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"O\n" + - "\x0fHistoryListResp\x12&\n" + - "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"v\n" + - "\x10SubscriptionInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x1c\n" + - "\texpiredAt\x18\x03 \x01(\x03R\texpiredAt\x12\x16\n" + - "\x06status\x18\x04 \x01(\x05R\x06status\"-\n" + - "\x13SubscriptionListReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\"C\n" + - "\x14SubscriptionListResp\x12+\n" + - "\x04list\x18\x01 \x03(\v2\x17.radio.SubscriptionInfoR\x04list\"e\n" + - "\x11CreatePayOrderReq\x12\x16\n" + - "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + - "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x1a\n" + - "\bplanType\x18\x03 \x01(\tR\bplanType\"J\n" + - "\x12CreatePayOrderResp\x12\x18\n" + - "\aorderNo\x18\x01 \x01(\tR\aorderNo\x12\x1a\n" + - "\bprepayId\x18\x02 \x01(\tR\bprepayId\"\xbb\x01\n" + - "\rVipConfigInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" + - "\bplanType\x18\x03 \x01(\tR\bplanType\x12\x14\n" + - "\x05price\x18\x04 \x01(\x05R\x05price\x12$\n" + - "\roriginalPrice\x18\x05 \x01(\x05R\roriginalPrice\x12\x1a\n" + - "\bduration\x18\x06 \x01(\x05R\bduration\x12\x12\n" + - "\x04desc\x18\a \x01(\tR\x04desc\"=\n" + - "\x11VipConfigListResp\x12(\n" + - "\x04list\x18\x01 \x03(\v2\x14.radio.VipConfigInfoR\x04list\"F\n" + - "\fAnalyticsReq\x12\x1c\n" + - "\tstartDate\x18\x01 \x01(\tR\tstartDate\x12\x18\n" + - "\aendDate\x18\x02 \x01(\tR\aendDate\"\xa3\x01\n" + - "\x15AnalyticsOverviewResp\x12\x1e\n" + - "\n" + - "totalUsers\x18\x01 \x01(\x03R\n" + - "totalUsers\x12\x1e\n" + - "\n" + - "totalPlays\x18\x02 \x01(\x03R\n" + - "totalPlays\x12$\n" + - "\rtotalChannels\x18\x03 \x01(\x03R\rtotalChannels\x12$\n" + - "\rtotalPrograms\x18\x04 \x01(\x03R\rtotalPrograms\"G\n" + - "\x14ChannelAnalyticsResp\x12/\n" + - "\x04list\x18\x01 \x03(\v2\x1b.radio.ChannelAnalyticsItemR\x04list\"\xbc\x01\n" + - "\x14ChannelAnalyticsItem\x12\x1c\n" + - "\tchannelId\x18\x01 \x01(\tR\tchannelId\x12 \n" + - "\vchannelName\x18\x02 \x01(\tR\vchannelName\x12\x1c\n" + - "\tplayCount\x18\x03 \x01(\x03R\tplayCount\x12\x1c\n" + - "\tlikeCount\x18\x04 \x01(\x03R\tlikeCount\x12(\n" + - "\x0fsubscriberCount\x18\x05 \x01(\x03R\x0fsubscriberCount\"m\n" + - "\x11UserAnalyticsResp\x12\x1a\n" + - "\bnewUsers\x18\x01 \x01(\x03R\bnewUsers\x12 \n" + - "\vactiveUsers\x18\x02 \x01(\x03R\vactiveUsers\x12\x1a\n" + - "\bvipUsers\x18\x03 \x01(\x03R\bvipUsers2\xc4\x0f\n" + - "\fRadioService\x12?\n" + - "\x0eGetUserProfile\x12\x14.radio.GetProfileReq\x1a\x17.radio.RadioUserProfile\x127\n" + - "\x0eCreateCategory\x12\x12.radio.CategoryReq\x1a\x11.radio.CommonResp\x12=\n" + - "\x0eUpdateCategory\x12\x18.radio.CategoryUpdateReq\x1a\x11.radio.CommonResp\x122\n" + - "\x0eDeleteCategory\x12\r.radio.IdsReq\x1a\x11.radio.CommonResp\x12B\n" + - "\x0fGetCategoryList\x12\x16.radio.CategoryListReq\x1a\x17.radio.CategoryListResp\x12;\n" + - "\rCreateChannel\x12\x17.radio.CreateChannelReq\x1a\x11.radio.CommonResp\x12;\n" + - "\rUpdateChannel\x12\x17.radio.UpdateChannelReq\x1a\x11.radio.CommonResp\x121\n" + - "\rDeleteChannel\x12\r.radio.IdsReq\x1a\x11.radio.CommonResp\x12?\n" + - "\x0eGetChannelList\x12\x15.radio.ChannelListReq\x1a\x16.radio.ChannelListResp\x124\n" + - "\x10GetChannelDetail\x12\f.radio.IdReq\x1a\x12.radio.ChannelInfo\x12;\n" + - "\rCreateProgram\x12\x17.radio.CreateProgramReq\x1a\x11.radio.CommonResp\x12;\n" + - "\rUpdateProgram\x12\x17.radio.UpdateProgramReq\x1a\x11.radio.CommonResp\x121\n" + - "\rDeleteProgram\x12\r.radio.IdsReq\x1a\x11.radio.CommonResp\x12?\n" + - "\x0eGetProgramList\x12\x15.radio.ProgramListReq\x1a\x16.radio.ProgramListResp\x124\n" + - "\x10GetProgramDetail\x12\f.radio.IdReq\x1a\x12.radio.ProgramInfo\x127\n" + - "\vCreateVoice\x12\x15.radio.CreateVoiceReq\x1a\x11.radio.CommonResp\x127\n" + - "\vUpdateVoice\x12\x15.radio.UpdateVoiceReq\x1a\x11.radio.CommonResp\x12/\n" + - "\vDeleteVoice\x12\r.radio.IdsReq\x1a\x11.radio.CommonResp\x129\n" + - "\fGetVoiceList\x12\x13.radio.VoiceListReq\x1a\x14.radio.VoiceListResp\x125\n" + - "\n" + - "ToggleLike\x12\x14.radio.ToggleLikeReq\x1a\x11.radio.CommonResp\x12=\n" + - "\x0eToggleFavorite\x12\x18.radio.ToggleFavoriteReq\x1a\x11.radio.CommonResp\x126\n" + - "\x0eCommentProgram\x12\x11.radio.CommentReq\x1a\x11.radio.CommonResp\x12;\n" + - "\rRecordHistory\x12\x17.radio.RecordHistoryReq\x1a\x11.radio.CommonResp\x12E\n" + - "\x0fGetFavoriteList\x12\x19.radio.InteractionListReq\x1a\x17.radio.FavoriteListResp\x12C\n" + - "\x0eGetHistoryList\x12\x19.radio.InteractionListReq\x1a\x16.radio.HistoryListResp\x12M\n" + - "\x12GetMySubscriptions\x12\x1a.radio.SubscriptionListReq\x1a\x1b.radio.SubscriptionListResp\x12E\n" + - "\x0eCreatePayOrder\x12\x18.radio.CreatePayOrderReq\x1a\x19.radio.CreatePayOrderResp\x12:\n" + - "\x10GetVipConfigList\x12\f.radio.IdReq\x1a\x18.radio.VipConfigListResp\x12=\n" + - "\fGetMyVipInfo\x12\x14.radio.GetProfileReq\x1a\x17.radio.RadioUserProfile\x12I\n" + - "\x14GetAnalyticsOverview\x12\x13.radio.AnalyticsReq\x1a\x1c.radio.AnalyticsOverviewResp\x12G\n" + - "\x13GetChannelAnalytics\x12\x13.radio.AnalyticsReq\x1a\x1b.radio.ChannelAnalyticsResp\x12A\n" + - "\x10GetUserAnalytics\x12\x13.radio.AnalyticsReq\x1a\x18.radio.UserAnalyticsRespB\tZ\a./radiob\x06proto3" - -var ( - file_pb_radio_proto_rawDescOnce sync.Once - file_pb_radio_proto_rawDescData []byte -) - -func file_pb_radio_proto_rawDescGZIP() []byte { - file_pb_radio_proto_rawDescOnce.Do(func() { - file_pb_radio_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_radio_proto_rawDesc), len(file_pb_radio_proto_rawDesc))) - }) - return file_pb_radio_proto_rawDescData -} - -var file_pb_radio_proto_msgTypes = make([]protoimpl.MessageInfo, 44) -var file_pb_radio_proto_goTypes = []any{ - (*CommonResp)(nil), // 0: radio.CommonResp - (*IdReq)(nil), // 1: radio.IdReq - (*IdsReq)(nil), // 2: radio.IdsReq - (*RadioUserProfile)(nil), // 3: radio.RadioUserProfile - (*GetProfileReq)(nil), // 4: radio.GetProfileReq - (*CategoryInfo)(nil), // 5: radio.CategoryInfo - (*CategoryReq)(nil), // 6: radio.CategoryReq - (*CategoryUpdateReq)(nil), // 7: radio.CategoryUpdateReq - (*CategoryListResp)(nil), // 8: radio.CategoryListResp - (*CategoryListReq)(nil), // 9: radio.CategoryListReq - (*ChannelInfo)(nil), // 10: radio.ChannelInfo - (*CreateChannelReq)(nil), // 11: radio.CreateChannelReq - (*UpdateChannelReq)(nil), // 12: radio.UpdateChannelReq - (*ChannelListReq)(nil), // 13: radio.ChannelListReq - (*ChannelListResp)(nil), // 14: radio.ChannelListResp - (*ProgramInfo)(nil), // 15: radio.ProgramInfo - (*CreateProgramReq)(nil), // 16: radio.CreateProgramReq - (*UpdateProgramReq)(nil), // 17: radio.UpdateProgramReq - (*ProgramListReq)(nil), // 18: radio.ProgramListReq - (*ProgramListResp)(nil), // 19: radio.ProgramListResp - (*VoiceInfo)(nil), // 20: radio.VoiceInfo - (*CreateVoiceReq)(nil), // 21: radio.CreateVoiceReq - (*UpdateVoiceReq)(nil), // 22: radio.UpdateVoiceReq - (*VoiceListReq)(nil), // 23: radio.VoiceListReq - (*VoiceListResp)(nil), // 24: radio.VoiceListResp - (*ToggleLikeReq)(nil), // 25: radio.ToggleLikeReq - (*ToggleFavoriteReq)(nil), // 26: radio.ToggleFavoriteReq - (*CommentReq)(nil), // 27: radio.CommentReq - (*RecordHistoryReq)(nil), // 28: radio.RecordHistoryReq - (*InteractionListReq)(nil), // 29: radio.InteractionListReq - (*FavoriteListResp)(nil), // 30: radio.FavoriteListResp - (*HistoryListResp)(nil), // 31: radio.HistoryListResp - (*SubscriptionInfo)(nil), // 32: radio.SubscriptionInfo - (*SubscriptionListReq)(nil), // 33: radio.SubscriptionListReq - (*SubscriptionListResp)(nil), // 34: radio.SubscriptionListResp - (*CreatePayOrderReq)(nil), // 35: radio.CreatePayOrderReq - (*CreatePayOrderResp)(nil), // 36: radio.CreatePayOrderResp - (*VipConfigInfo)(nil), // 37: radio.VipConfigInfo - (*VipConfigListResp)(nil), // 38: radio.VipConfigListResp - (*AnalyticsReq)(nil), // 39: radio.AnalyticsReq - (*AnalyticsOverviewResp)(nil), // 40: radio.AnalyticsOverviewResp - (*ChannelAnalyticsResp)(nil), // 41: radio.ChannelAnalyticsResp - (*ChannelAnalyticsItem)(nil), // 42: radio.ChannelAnalyticsItem - (*UserAnalyticsResp)(nil), // 43: radio.UserAnalyticsResp -} -var file_pb_radio_proto_depIdxs = []int32{ - 5, // 0: radio.CategoryListResp.list:type_name -> radio.CategoryInfo - 10, // 1: radio.ChannelListResp.list:type_name -> radio.ChannelInfo - 15, // 2: radio.ProgramListResp.list:type_name -> radio.ProgramInfo - 20, // 3: radio.VoiceListResp.list:type_name -> radio.VoiceInfo - 15, // 4: radio.FavoriteListResp.list:type_name -> radio.ProgramInfo - 15, // 5: radio.HistoryListResp.list:type_name -> radio.ProgramInfo - 32, // 6: radio.SubscriptionListResp.list:type_name -> radio.SubscriptionInfo - 37, // 7: radio.VipConfigListResp.list:type_name -> radio.VipConfigInfo - 42, // 8: radio.ChannelAnalyticsResp.list:type_name -> radio.ChannelAnalyticsItem - 4, // 9: radio.RadioService.GetUserProfile:input_type -> radio.GetProfileReq - 6, // 10: radio.RadioService.CreateCategory:input_type -> radio.CategoryReq - 7, // 11: radio.RadioService.UpdateCategory:input_type -> radio.CategoryUpdateReq - 2, // 12: radio.RadioService.DeleteCategory:input_type -> radio.IdsReq - 9, // 13: radio.RadioService.GetCategoryList:input_type -> radio.CategoryListReq - 11, // 14: radio.RadioService.CreateChannel:input_type -> radio.CreateChannelReq - 12, // 15: radio.RadioService.UpdateChannel:input_type -> radio.UpdateChannelReq - 2, // 16: radio.RadioService.DeleteChannel:input_type -> radio.IdsReq - 13, // 17: radio.RadioService.GetChannelList:input_type -> radio.ChannelListReq - 1, // 18: radio.RadioService.GetChannelDetail:input_type -> radio.IdReq - 16, // 19: radio.RadioService.CreateProgram:input_type -> radio.CreateProgramReq - 17, // 20: radio.RadioService.UpdateProgram:input_type -> radio.UpdateProgramReq - 2, // 21: radio.RadioService.DeleteProgram:input_type -> radio.IdsReq - 18, // 22: radio.RadioService.GetProgramList:input_type -> radio.ProgramListReq - 1, // 23: radio.RadioService.GetProgramDetail:input_type -> radio.IdReq - 21, // 24: radio.RadioService.CreateVoice:input_type -> radio.CreateVoiceReq - 22, // 25: radio.RadioService.UpdateVoice:input_type -> radio.UpdateVoiceReq - 2, // 26: radio.RadioService.DeleteVoice:input_type -> radio.IdsReq - 23, // 27: radio.RadioService.GetVoiceList:input_type -> radio.VoiceListReq - 25, // 28: radio.RadioService.ToggleLike:input_type -> radio.ToggleLikeReq - 26, // 29: radio.RadioService.ToggleFavorite:input_type -> radio.ToggleFavoriteReq - 27, // 30: radio.RadioService.CommentProgram:input_type -> radio.CommentReq - 28, // 31: radio.RadioService.RecordHistory:input_type -> radio.RecordHistoryReq - 29, // 32: radio.RadioService.GetFavoriteList:input_type -> radio.InteractionListReq - 29, // 33: radio.RadioService.GetHistoryList:input_type -> radio.InteractionListReq - 33, // 34: radio.RadioService.GetMySubscriptions:input_type -> radio.SubscriptionListReq - 35, // 35: radio.RadioService.CreatePayOrder:input_type -> radio.CreatePayOrderReq - 1, // 36: radio.RadioService.GetVipConfigList:input_type -> radio.IdReq - 4, // 37: radio.RadioService.GetMyVipInfo:input_type -> radio.GetProfileReq - 39, // 38: radio.RadioService.GetAnalyticsOverview:input_type -> radio.AnalyticsReq - 39, // 39: radio.RadioService.GetChannelAnalytics:input_type -> radio.AnalyticsReq - 39, // 40: radio.RadioService.GetUserAnalytics:input_type -> radio.AnalyticsReq - 3, // 41: radio.RadioService.GetUserProfile:output_type -> radio.RadioUserProfile - 0, // 42: radio.RadioService.CreateCategory:output_type -> radio.CommonResp - 0, // 43: radio.RadioService.UpdateCategory:output_type -> radio.CommonResp - 0, // 44: radio.RadioService.DeleteCategory:output_type -> radio.CommonResp - 8, // 45: radio.RadioService.GetCategoryList:output_type -> radio.CategoryListResp - 0, // 46: radio.RadioService.CreateChannel:output_type -> radio.CommonResp - 0, // 47: radio.RadioService.UpdateChannel:output_type -> radio.CommonResp - 0, // 48: radio.RadioService.DeleteChannel:output_type -> radio.CommonResp - 14, // 49: radio.RadioService.GetChannelList:output_type -> radio.ChannelListResp - 10, // 50: radio.RadioService.GetChannelDetail:output_type -> radio.ChannelInfo - 0, // 51: radio.RadioService.CreateProgram:output_type -> radio.CommonResp - 0, // 52: radio.RadioService.UpdateProgram:output_type -> radio.CommonResp - 0, // 53: radio.RadioService.DeleteProgram:output_type -> radio.CommonResp - 19, // 54: radio.RadioService.GetProgramList:output_type -> radio.ProgramListResp - 15, // 55: radio.RadioService.GetProgramDetail:output_type -> radio.ProgramInfo - 0, // 56: radio.RadioService.CreateVoice:output_type -> radio.CommonResp - 0, // 57: radio.RadioService.UpdateVoice:output_type -> radio.CommonResp - 0, // 58: radio.RadioService.DeleteVoice:output_type -> radio.CommonResp - 24, // 59: radio.RadioService.GetVoiceList:output_type -> radio.VoiceListResp - 0, // 60: radio.RadioService.ToggleLike:output_type -> radio.CommonResp - 0, // 61: radio.RadioService.ToggleFavorite:output_type -> radio.CommonResp - 0, // 62: radio.RadioService.CommentProgram:output_type -> radio.CommonResp - 0, // 63: radio.RadioService.RecordHistory:output_type -> radio.CommonResp - 30, // 64: radio.RadioService.GetFavoriteList:output_type -> radio.FavoriteListResp - 31, // 65: radio.RadioService.GetHistoryList:output_type -> radio.HistoryListResp - 34, // 66: radio.RadioService.GetMySubscriptions:output_type -> radio.SubscriptionListResp - 36, // 67: radio.RadioService.CreatePayOrder:output_type -> radio.CreatePayOrderResp - 38, // 68: radio.RadioService.GetVipConfigList:output_type -> radio.VipConfigListResp - 3, // 69: radio.RadioService.GetMyVipInfo:output_type -> radio.RadioUserProfile - 40, // 70: radio.RadioService.GetAnalyticsOverview:output_type -> radio.AnalyticsOverviewResp - 41, // 71: radio.RadioService.GetChannelAnalytics:output_type -> radio.ChannelAnalyticsResp - 43, // 72: radio.RadioService.GetUserAnalytics:output_type -> radio.UserAnalyticsResp - 41, // [41:73] is the sub-list for method output_type - 9, // [9:41] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_pb_radio_proto_init() } -func file_pb_radio_proto_init() { - if File_pb_radio_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_radio_proto_rawDesc), len(file_pb_radio_proto_rawDesc)), - NumEnums: 0, - NumMessages: 44, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_pb_radio_proto_goTypes, - DependencyIndexes: file_pb_radio_proto_depIdxs, - MessageInfos: file_pb_radio_proto_msgTypes, - }.Build() - File_pb_radio_proto = out.File - file_pb_radio_proto_goTypes = nil - file_pb_radio_proto_depIdxs = nil -} diff --git a/app/radio/rpc/radio/radio_grpc.pb.go b/app/radio/rpc/radio/radio_grpc.pb.go deleted file mode 100644 index 226ff61..0000000 --- a/app/radio/rpc/radio/radio_grpc.pb.go +++ /dev/null @@ -1,1315 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc v7.34.1 -// source: pb/radio.proto - -package radio - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - RadioService_GetUserProfile_FullMethodName = "/radio.RadioService/GetUserProfile" - RadioService_CreateCategory_FullMethodName = "/radio.RadioService/CreateCategory" - RadioService_UpdateCategory_FullMethodName = "/radio.RadioService/UpdateCategory" - RadioService_DeleteCategory_FullMethodName = "/radio.RadioService/DeleteCategory" - RadioService_GetCategoryList_FullMethodName = "/radio.RadioService/GetCategoryList" - RadioService_CreateChannel_FullMethodName = "/radio.RadioService/CreateChannel" - RadioService_UpdateChannel_FullMethodName = "/radio.RadioService/UpdateChannel" - RadioService_DeleteChannel_FullMethodName = "/radio.RadioService/DeleteChannel" - RadioService_GetChannelList_FullMethodName = "/radio.RadioService/GetChannelList" - RadioService_GetChannelDetail_FullMethodName = "/radio.RadioService/GetChannelDetail" - RadioService_CreateProgram_FullMethodName = "/radio.RadioService/CreateProgram" - RadioService_UpdateProgram_FullMethodName = "/radio.RadioService/UpdateProgram" - RadioService_DeleteProgram_FullMethodName = "/radio.RadioService/DeleteProgram" - RadioService_GetProgramList_FullMethodName = "/radio.RadioService/GetProgramList" - RadioService_GetProgramDetail_FullMethodName = "/radio.RadioService/GetProgramDetail" - RadioService_CreateVoice_FullMethodName = "/radio.RadioService/CreateVoice" - RadioService_UpdateVoice_FullMethodName = "/radio.RadioService/UpdateVoice" - RadioService_DeleteVoice_FullMethodName = "/radio.RadioService/DeleteVoice" - RadioService_GetVoiceList_FullMethodName = "/radio.RadioService/GetVoiceList" - RadioService_ToggleLike_FullMethodName = "/radio.RadioService/ToggleLike" - RadioService_ToggleFavorite_FullMethodName = "/radio.RadioService/ToggleFavorite" - RadioService_CommentProgram_FullMethodName = "/radio.RadioService/CommentProgram" - RadioService_RecordHistory_FullMethodName = "/radio.RadioService/RecordHistory" - RadioService_GetFavoriteList_FullMethodName = "/radio.RadioService/GetFavoriteList" - RadioService_GetHistoryList_FullMethodName = "/radio.RadioService/GetHistoryList" - RadioService_GetMySubscriptions_FullMethodName = "/radio.RadioService/GetMySubscriptions" - RadioService_CreatePayOrder_FullMethodName = "/radio.RadioService/CreatePayOrder" - RadioService_GetVipConfigList_FullMethodName = "/radio.RadioService/GetVipConfigList" - RadioService_GetMyVipInfo_FullMethodName = "/radio.RadioService/GetMyVipInfo" - RadioService_GetAnalyticsOverview_FullMethodName = "/radio.RadioService/GetAnalyticsOverview" - RadioService_GetChannelAnalytics_FullMethodName = "/radio.RadioService/GetChannelAnalytics" - RadioService_GetUserAnalytics_FullMethodName = "/radio.RadioService/GetUserAnalytics" -) - -// RadioServiceClient is the client API for RadioService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type RadioServiceClient interface { - // 用户Profile - GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) - // 分类 - CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error) - // 频道 - CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error) - GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error) - // 节目 - CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error) - GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error) - // 音色 - CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error) - // 互动 - ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error) - ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error) - CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error) - RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error) - GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error) - GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error) - // 订阅/VIP - GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error) - CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) - GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error) - GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) - // 数据分析 - GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error) - GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error) - GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error) -} - -type radioServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewRadioServiceClient(cc grpc.ClientConnInterface) RadioServiceClient { - return &radioServiceClient{cc} -} - -func (c *radioServiceClient) GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(RadioUserProfile) - err := c.cc.Invoke(ctx, RadioService_GetUserProfile_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_CreateCategory_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_UpdateCategory_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_DeleteCategory_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CategoryListResp) - err := c.cc.Invoke(ctx, RadioService_GetCategoryList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_CreateChannel_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_UpdateChannel_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_DeleteChannel_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ChannelListResp) - err := c.cc.Invoke(ctx, RadioService_GetChannelList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ChannelInfo) - err := c.cc.Invoke(ctx, RadioService_GetChannelDetail_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_CreateProgram_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_UpdateProgram_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_DeleteProgram_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProgramListResp) - err := c.cc.Invoke(ctx, RadioService_GetProgramList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ProgramInfo) - err := c.cc.Invoke(ctx, RadioService_GetProgramDetail_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_CreateVoice_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_UpdateVoice_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_DeleteVoice_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(VoiceListResp) - err := c.cc.Invoke(ctx, RadioService_GetVoiceList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_ToggleLike_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_ToggleFavorite_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_CommentProgram_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, RadioService_RecordHistory_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FavoriteListResp) - err := c.cc.Invoke(ctx, RadioService_GetFavoriteList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(HistoryListResp) - err := c.cc.Invoke(ctx, RadioService_GetHistoryList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SubscriptionListResp) - err := c.cc.Invoke(ctx, RadioService_GetMySubscriptions_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CreatePayOrderResp) - err := c.cc.Invoke(ctx, RadioService_CreatePayOrder_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(VipConfigListResp) - err := c.cc.Invoke(ctx, RadioService_GetVipConfigList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(RadioUserProfile) - err := c.cc.Invoke(ctx, RadioService_GetMyVipInfo_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AnalyticsOverviewResp) - err := c.cc.Invoke(ctx, RadioService_GetAnalyticsOverview_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ChannelAnalyticsResp) - err := c.cc.Invoke(ctx, RadioService_GetChannelAnalytics_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *radioServiceClient) GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(UserAnalyticsResp) - err := c.cc.Invoke(ctx, RadioService_GetUserAnalytics_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RadioServiceServer is the server API for RadioService service. -// All implementations must embed UnimplementedRadioServiceServer -// for forward compatibility. -type RadioServiceServer interface { - // 用户Profile - GetUserProfile(context.Context, *GetProfileReq) (*RadioUserProfile, error) - // 分类 - CreateCategory(context.Context, *CategoryReq) (*CommonResp, error) - UpdateCategory(context.Context, *CategoryUpdateReq) (*CommonResp, error) - DeleteCategory(context.Context, *IdsReq) (*CommonResp, error) - GetCategoryList(context.Context, *CategoryListReq) (*CategoryListResp, error) - // 频道 - CreateChannel(context.Context, *CreateChannelReq) (*CommonResp, error) - UpdateChannel(context.Context, *UpdateChannelReq) (*CommonResp, error) - DeleteChannel(context.Context, *IdsReq) (*CommonResp, error) - GetChannelList(context.Context, *ChannelListReq) (*ChannelListResp, error) - GetChannelDetail(context.Context, *IdReq) (*ChannelInfo, error) - // 节目 - CreateProgram(context.Context, *CreateProgramReq) (*CommonResp, error) - UpdateProgram(context.Context, *UpdateProgramReq) (*CommonResp, error) - DeleteProgram(context.Context, *IdsReq) (*CommonResp, error) - GetProgramList(context.Context, *ProgramListReq) (*ProgramListResp, error) - GetProgramDetail(context.Context, *IdReq) (*ProgramInfo, error) - // 音色 - CreateVoice(context.Context, *CreateVoiceReq) (*CommonResp, error) - UpdateVoice(context.Context, *UpdateVoiceReq) (*CommonResp, error) - DeleteVoice(context.Context, *IdsReq) (*CommonResp, error) - GetVoiceList(context.Context, *VoiceListReq) (*VoiceListResp, error) - // 互动 - ToggleLike(context.Context, *ToggleLikeReq) (*CommonResp, error) - ToggleFavorite(context.Context, *ToggleFavoriteReq) (*CommonResp, error) - CommentProgram(context.Context, *CommentReq) (*CommonResp, error) - RecordHistory(context.Context, *RecordHistoryReq) (*CommonResp, error) - GetFavoriteList(context.Context, *InteractionListReq) (*FavoriteListResp, error) - GetHistoryList(context.Context, *InteractionListReq) (*HistoryListResp, error) - // 订阅/VIP - GetMySubscriptions(context.Context, *SubscriptionListReq) (*SubscriptionListResp, error) - CreatePayOrder(context.Context, *CreatePayOrderReq) (*CreatePayOrderResp, error) - GetVipConfigList(context.Context, *IdReq) (*VipConfigListResp, error) - GetMyVipInfo(context.Context, *GetProfileReq) (*RadioUserProfile, error) - // 数据分析 - GetAnalyticsOverview(context.Context, *AnalyticsReq) (*AnalyticsOverviewResp, error) - GetChannelAnalytics(context.Context, *AnalyticsReq) (*ChannelAnalyticsResp, error) - GetUserAnalytics(context.Context, *AnalyticsReq) (*UserAnalyticsResp, error) - mustEmbedUnimplementedRadioServiceServer() -} - -// UnimplementedRadioServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedRadioServiceServer struct{} - -func (UnimplementedRadioServiceServer) GetUserProfile(context.Context, *GetProfileReq) (*RadioUserProfile, error) { - return nil, status.Error(codes.Unimplemented, "method GetUserProfile not implemented") -} -func (UnimplementedRadioServiceServer) CreateCategory(context.Context, *CategoryReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreateCategory not implemented") -} -func (UnimplementedRadioServiceServer) UpdateCategory(context.Context, *CategoryUpdateReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateCategory not implemented") -} -func (UnimplementedRadioServiceServer) DeleteCategory(context.Context, *IdsReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteCategory not implemented") -} -func (UnimplementedRadioServiceServer) GetCategoryList(context.Context, *CategoryListReq) (*CategoryListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetCategoryList not implemented") -} -func (UnimplementedRadioServiceServer) CreateChannel(context.Context, *CreateChannelReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreateChannel not implemented") -} -func (UnimplementedRadioServiceServer) UpdateChannel(context.Context, *UpdateChannelReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateChannel not implemented") -} -func (UnimplementedRadioServiceServer) DeleteChannel(context.Context, *IdsReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteChannel not implemented") -} -func (UnimplementedRadioServiceServer) GetChannelList(context.Context, *ChannelListReq) (*ChannelListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetChannelList not implemented") -} -func (UnimplementedRadioServiceServer) GetChannelDetail(context.Context, *IdReq) (*ChannelInfo, error) { - return nil, status.Error(codes.Unimplemented, "method GetChannelDetail not implemented") -} -func (UnimplementedRadioServiceServer) CreateProgram(context.Context, *CreateProgramReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreateProgram not implemented") -} -func (UnimplementedRadioServiceServer) UpdateProgram(context.Context, *UpdateProgramReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateProgram not implemented") -} -func (UnimplementedRadioServiceServer) DeleteProgram(context.Context, *IdsReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteProgram not implemented") -} -func (UnimplementedRadioServiceServer) GetProgramList(context.Context, *ProgramListReq) (*ProgramListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetProgramList not implemented") -} -func (UnimplementedRadioServiceServer) GetProgramDetail(context.Context, *IdReq) (*ProgramInfo, error) { - return nil, status.Error(codes.Unimplemented, "method GetProgramDetail not implemented") -} -func (UnimplementedRadioServiceServer) CreateVoice(context.Context, *CreateVoiceReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreateVoice not implemented") -} -func (UnimplementedRadioServiceServer) UpdateVoice(context.Context, *UpdateVoiceReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateVoice not implemented") -} -func (UnimplementedRadioServiceServer) DeleteVoice(context.Context, *IdsReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteVoice not implemented") -} -func (UnimplementedRadioServiceServer) GetVoiceList(context.Context, *VoiceListReq) (*VoiceListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetVoiceList not implemented") -} -func (UnimplementedRadioServiceServer) ToggleLike(context.Context, *ToggleLikeReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method ToggleLike not implemented") -} -func (UnimplementedRadioServiceServer) ToggleFavorite(context.Context, *ToggleFavoriteReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method ToggleFavorite not implemented") -} -func (UnimplementedRadioServiceServer) CommentProgram(context.Context, *CommentReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method CommentProgram not implemented") -} -func (UnimplementedRadioServiceServer) RecordHistory(context.Context, *RecordHistoryReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method RecordHistory not implemented") -} -func (UnimplementedRadioServiceServer) GetFavoriteList(context.Context, *InteractionListReq) (*FavoriteListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetFavoriteList not implemented") -} -func (UnimplementedRadioServiceServer) GetHistoryList(context.Context, *InteractionListReq) (*HistoryListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetHistoryList not implemented") -} -func (UnimplementedRadioServiceServer) GetMySubscriptions(context.Context, *SubscriptionListReq) (*SubscriptionListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetMySubscriptions not implemented") -} -func (UnimplementedRadioServiceServer) CreatePayOrder(context.Context, *CreatePayOrderReq) (*CreatePayOrderResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreatePayOrder not implemented") -} -func (UnimplementedRadioServiceServer) GetVipConfigList(context.Context, *IdReq) (*VipConfigListResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetVipConfigList not implemented") -} -func (UnimplementedRadioServiceServer) GetMyVipInfo(context.Context, *GetProfileReq) (*RadioUserProfile, error) { - return nil, status.Error(codes.Unimplemented, "method GetMyVipInfo not implemented") -} -func (UnimplementedRadioServiceServer) GetAnalyticsOverview(context.Context, *AnalyticsReq) (*AnalyticsOverviewResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetAnalyticsOverview not implemented") -} -func (UnimplementedRadioServiceServer) GetChannelAnalytics(context.Context, *AnalyticsReq) (*ChannelAnalyticsResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetChannelAnalytics not implemented") -} -func (UnimplementedRadioServiceServer) GetUserAnalytics(context.Context, *AnalyticsReq) (*UserAnalyticsResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetUserAnalytics not implemented") -} -func (UnimplementedRadioServiceServer) mustEmbedUnimplementedRadioServiceServer() {} -func (UnimplementedRadioServiceServer) testEmbeddedByValue() {} - -// UnsafeRadioServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to RadioServiceServer will -// result in compilation errors. -type UnsafeRadioServiceServer interface { - mustEmbedUnimplementedRadioServiceServer() -} - -func RegisterRadioServiceServer(s grpc.ServiceRegistrar, srv RadioServiceServer) { - // If the following call panics, it indicates UnimplementedRadioServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&RadioService_ServiceDesc, srv) -} - -func _RadioService_GetUserProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProfileReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetUserProfile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetUserProfile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetUserProfile(ctx, req.(*GetProfileReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CreateCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CategoryReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CreateCategory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CreateCategory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CreateCategory(ctx, req.(*CategoryReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_UpdateCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CategoryUpdateReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).UpdateCategory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_UpdateCategory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).UpdateCategory(ctx, req.(*CategoryUpdateReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_DeleteCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).DeleteCategory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_DeleteCategory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).DeleteCategory(ctx, req.(*IdsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetCategoryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CategoryListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetCategoryList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetCategoryList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetCategoryList(ctx, req.(*CategoryListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CreateChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateChannelReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CreateChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CreateChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CreateChannel(ctx, req.(*CreateChannelReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_UpdateChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateChannelReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).UpdateChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_UpdateChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).UpdateChannel(ctx, req.(*UpdateChannelReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_DeleteChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).DeleteChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_DeleteChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).DeleteChannel(ctx, req.(*IdsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetChannelList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChannelListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetChannelList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetChannelList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetChannelList(ctx, req.(*ChannelListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetChannelDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetChannelDetail(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetChannelDetail_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetChannelDetail(ctx, req.(*IdReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CreateProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateProgramReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CreateProgram(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CreateProgram_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CreateProgram(ctx, req.(*CreateProgramReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_UpdateProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateProgramReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).UpdateProgram(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_UpdateProgram_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).UpdateProgram(ctx, req.(*UpdateProgramReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_DeleteProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).DeleteProgram(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_DeleteProgram_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).DeleteProgram(ctx, req.(*IdsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetProgramList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProgramListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetProgramList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetProgramList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetProgramList(ctx, req.(*ProgramListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetProgramDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetProgramDetail(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetProgramDetail_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetProgramDetail(ctx, req.(*IdReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CreateVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateVoiceReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CreateVoice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CreateVoice_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CreateVoice(ctx, req.(*CreateVoiceReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_UpdateVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateVoiceReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).UpdateVoice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_UpdateVoice_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).UpdateVoice(ctx, req.(*UpdateVoiceReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_DeleteVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).DeleteVoice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_DeleteVoice_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).DeleteVoice(ctx, req.(*IdsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetVoiceList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VoiceListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetVoiceList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetVoiceList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetVoiceList(ctx, req.(*VoiceListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_ToggleLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ToggleLikeReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).ToggleLike(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_ToggleLike_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).ToggleLike(ctx, req.(*ToggleLikeReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_ToggleFavorite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ToggleFavoriteReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).ToggleFavorite(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_ToggleFavorite_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).ToggleFavorite(ctx, req.(*ToggleFavoriteReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CommentProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CommentReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CommentProgram(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CommentProgram_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CommentProgram(ctx, req.(*CommentReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_RecordHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RecordHistoryReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).RecordHistory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_RecordHistory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).RecordHistory(ctx, req.(*RecordHistoryReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetFavoriteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InteractionListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetFavoriteList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetFavoriteList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetFavoriteList(ctx, req.(*InteractionListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetHistoryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InteractionListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetHistoryList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetHistoryList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetHistoryList(ctx, req.(*InteractionListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetMySubscriptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SubscriptionListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetMySubscriptions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetMySubscriptions_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetMySubscriptions(ctx, req.(*SubscriptionListReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_CreatePayOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreatePayOrderReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).CreatePayOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_CreatePayOrder_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).CreatePayOrder(ctx, req.(*CreatePayOrderReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetVipConfigList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IdReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetVipConfigList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetVipConfigList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetVipConfigList(ctx, req.(*IdReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetMyVipInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProfileReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetMyVipInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetMyVipInfo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetMyVipInfo(ctx, req.(*GetProfileReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetAnalyticsOverview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnalyticsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetAnalyticsOverview(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetAnalyticsOverview_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetAnalyticsOverview(ctx, req.(*AnalyticsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetChannelAnalytics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnalyticsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetChannelAnalytics(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetChannelAnalytics_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetChannelAnalytics(ctx, req.(*AnalyticsReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _RadioService_GetUserAnalytics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnalyticsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RadioServiceServer).GetUserAnalytics(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RadioService_GetUserAnalytics_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RadioServiceServer).GetUserAnalytics(ctx, req.(*AnalyticsReq)) - } - return interceptor(ctx, in, info, handler) -} - -// RadioService_ServiceDesc is the grpc.ServiceDesc for RadioService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var RadioService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "radio.RadioService", - HandlerType: (*RadioServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetUserProfile", - Handler: _RadioService_GetUserProfile_Handler, - }, - { - MethodName: "CreateCategory", - Handler: _RadioService_CreateCategory_Handler, - }, - { - MethodName: "UpdateCategory", - Handler: _RadioService_UpdateCategory_Handler, - }, - { - MethodName: "DeleteCategory", - Handler: _RadioService_DeleteCategory_Handler, - }, - { - MethodName: "GetCategoryList", - Handler: _RadioService_GetCategoryList_Handler, - }, - { - MethodName: "CreateChannel", - Handler: _RadioService_CreateChannel_Handler, - }, - { - MethodName: "UpdateChannel", - Handler: _RadioService_UpdateChannel_Handler, - }, - { - MethodName: "DeleteChannel", - Handler: _RadioService_DeleteChannel_Handler, - }, - { - MethodName: "GetChannelList", - Handler: _RadioService_GetChannelList_Handler, - }, - { - MethodName: "GetChannelDetail", - Handler: _RadioService_GetChannelDetail_Handler, - }, - { - MethodName: "CreateProgram", - Handler: _RadioService_CreateProgram_Handler, - }, - { - MethodName: "UpdateProgram", - Handler: _RadioService_UpdateProgram_Handler, - }, - { - MethodName: "DeleteProgram", - Handler: _RadioService_DeleteProgram_Handler, - }, - { - MethodName: "GetProgramList", - Handler: _RadioService_GetProgramList_Handler, - }, - { - MethodName: "GetProgramDetail", - Handler: _RadioService_GetProgramDetail_Handler, - }, - { - MethodName: "CreateVoice", - Handler: _RadioService_CreateVoice_Handler, - }, - { - MethodName: "UpdateVoice", - Handler: _RadioService_UpdateVoice_Handler, - }, - { - MethodName: "DeleteVoice", - Handler: _RadioService_DeleteVoice_Handler, - }, - { - MethodName: "GetVoiceList", - Handler: _RadioService_GetVoiceList_Handler, - }, - { - MethodName: "ToggleLike", - Handler: _RadioService_ToggleLike_Handler, - }, - { - MethodName: "ToggleFavorite", - Handler: _RadioService_ToggleFavorite_Handler, - }, - { - MethodName: "CommentProgram", - Handler: _RadioService_CommentProgram_Handler, - }, - { - MethodName: "RecordHistory", - Handler: _RadioService_RecordHistory_Handler, - }, - { - MethodName: "GetFavoriteList", - Handler: _RadioService_GetFavoriteList_Handler, - }, - { - MethodName: "GetHistoryList", - Handler: _RadioService_GetHistoryList_Handler, - }, - { - MethodName: "GetMySubscriptions", - Handler: _RadioService_GetMySubscriptions_Handler, - }, - { - MethodName: "CreatePayOrder", - Handler: _RadioService_CreatePayOrder_Handler, - }, - { - MethodName: "GetVipConfigList", - Handler: _RadioService_GetVipConfigList_Handler, - }, - { - MethodName: "GetMyVipInfo", - Handler: _RadioService_GetMyVipInfo_Handler, - }, - { - MethodName: "GetAnalyticsOverview", - Handler: _RadioService_GetAnalyticsOverview_Handler, - }, - { - MethodName: "GetChannelAnalytics", - Handler: _RadioService_GetChannelAnalytics_Handler, - }, - { - MethodName: "GetUserAnalytics", - Handler: _RadioService_GetUserAnalytics_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "pb/radio.proto", -} diff --git a/app/radio/rpc/radioservice/radioService.go b/app/radio/rpc/radioservice/radioService.go deleted file mode 100644 index 291f5ba..0000000 --- a/app/radio/rpc/radioservice/radioService.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 -// Source: radio.proto - -package radioservice - -import ( - "context" - - "sundynix-micro-go/app/radio/rpc/radio" - - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" -) - -type ( - AnalyticsOverviewResp = radio.AnalyticsOverviewResp - AnalyticsReq = radio.AnalyticsReq - CategoryInfo = radio.CategoryInfo - CategoryListReq = radio.CategoryListReq - CategoryListResp = radio.CategoryListResp - CategoryReq = radio.CategoryReq - CategoryUpdateReq = radio.CategoryUpdateReq - ChannelAnalyticsItem = radio.ChannelAnalyticsItem - ChannelAnalyticsResp = radio.ChannelAnalyticsResp - ChannelInfo = radio.ChannelInfo - ChannelListReq = radio.ChannelListReq - ChannelListResp = radio.ChannelListResp - CommentReq = radio.CommentReq - CommonResp = radio.CommonResp - CreateChannelReq = radio.CreateChannelReq - CreatePayOrderReq = radio.CreatePayOrderReq - CreatePayOrderResp = radio.CreatePayOrderResp - CreateProgramReq = radio.CreateProgramReq - CreateVoiceReq = radio.CreateVoiceReq - FavoriteListResp = radio.FavoriteListResp - GetProfileReq = radio.GetProfileReq - HistoryListResp = radio.HistoryListResp - IdReq = radio.IdReq - IdsReq = radio.IdsReq - InteractionListReq = radio.InteractionListReq - ProgramInfo = radio.ProgramInfo - ProgramListReq = radio.ProgramListReq - ProgramListResp = radio.ProgramListResp - RadioUserProfile = radio.RadioUserProfile - RecordHistoryReq = radio.RecordHistoryReq - SubscriptionInfo = radio.SubscriptionInfo - SubscriptionListReq = radio.SubscriptionListReq - SubscriptionListResp = radio.SubscriptionListResp - ToggleFavoriteReq = radio.ToggleFavoriteReq - ToggleLikeReq = radio.ToggleLikeReq - UpdateChannelReq = radio.UpdateChannelReq - UpdateProgramReq = radio.UpdateProgramReq - UpdateVoiceReq = radio.UpdateVoiceReq - UserAnalyticsResp = radio.UserAnalyticsResp - VipConfigInfo = radio.VipConfigInfo - VipConfigListResp = radio.VipConfigListResp - VoiceInfo = radio.VoiceInfo - VoiceListReq = radio.VoiceListReq - VoiceListResp = radio.VoiceListResp - - RadioService interface { - // 用户Profile - GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) - // 分类 - CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error) - // 频道 - CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error) - GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error) - // 节目 - CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error) - GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error) - // 音色 - CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) - UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) - DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) - GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error) - // 互动 - ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error) - ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error) - CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error) - RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error) - GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error) - GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error) - // 订阅/VIP - GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error) - CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) - GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error) - GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) - // 数据分析 - GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error) - GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error) - GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error) - } - - defaultRadioService struct { - cli zrpc.Client - } -) - -func NewRadioService(cli zrpc.Client) RadioService { - return &defaultRadioService{ - cli: cli, - } -} - -// 用户Profile -func (m *defaultRadioService) GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetUserProfile(ctx, in, opts...) -} - -// 分类 -func (m *defaultRadioService) CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CreateCategory(ctx, in, opts...) -} - -func (m *defaultRadioService) UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.UpdateCategory(ctx, in, opts...) -} - -func (m *defaultRadioService) DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.DeleteCategory(ctx, in, opts...) -} - -func (m *defaultRadioService) GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetCategoryList(ctx, in, opts...) -} - -// 频道 -func (m *defaultRadioService) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CreateChannel(ctx, in, opts...) -} - -func (m *defaultRadioService) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.UpdateChannel(ctx, in, opts...) -} - -func (m *defaultRadioService) DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.DeleteChannel(ctx, in, opts...) -} - -func (m *defaultRadioService) GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetChannelList(ctx, in, opts...) -} - -func (m *defaultRadioService) GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetChannelDetail(ctx, in, opts...) -} - -// 节目 -func (m *defaultRadioService) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CreateProgram(ctx, in, opts...) -} - -func (m *defaultRadioService) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.UpdateProgram(ctx, in, opts...) -} - -func (m *defaultRadioService) DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.DeleteProgram(ctx, in, opts...) -} - -func (m *defaultRadioService) GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetProgramList(ctx, in, opts...) -} - -func (m *defaultRadioService) GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetProgramDetail(ctx, in, opts...) -} - -// 音色 -func (m *defaultRadioService) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CreateVoice(ctx, in, opts...) -} - -func (m *defaultRadioService) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.UpdateVoice(ctx, in, opts...) -} - -func (m *defaultRadioService) DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.DeleteVoice(ctx, in, opts...) -} - -func (m *defaultRadioService) GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetVoiceList(ctx, in, opts...) -} - -// 互动 -func (m *defaultRadioService) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.ToggleLike(ctx, in, opts...) -} - -func (m *defaultRadioService) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.ToggleFavorite(ctx, in, opts...) -} - -func (m *defaultRadioService) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CommentProgram(ctx, in, opts...) -} - -func (m *defaultRadioService) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.RecordHistory(ctx, in, opts...) -} - -func (m *defaultRadioService) GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetFavoriteList(ctx, in, opts...) -} - -func (m *defaultRadioService) GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetHistoryList(ctx, in, opts...) -} - -// 订阅/VIP -func (m *defaultRadioService) GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetMySubscriptions(ctx, in, opts...) -} - -func (m *defaultRadioService) CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.CreatePayOrder(ctx, in, opts...) -} - -func (m *defaultRadioService) GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetVipConfigList(ctx, in, opts...) -} - -func (m *defaultRadioService) GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetMyVipInfo(ctx, in, opts...) -} - -// 数据分析 -func (m *defaultRadioService) GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetAnalyticsOverview(ctx, in, opts...) -} - -func (m *defaultRadioService) GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetChannelAnalytics(ctx, in, opts...) -} - -func (m *defaultRadioService) GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error) { - client := radio.NewRadioServiceClient(m.cli.Conn()) - return client.GetUserAnalytics(ctx, in, opts...) -} diff --git a/app/system/api/etc/system-api.yaml b/app/system/api/etc/system-api.yaml index 96caf63..8356a14 100644 --- a/app/system/api/etc/system-api.yaml +++ b/app/system/api/etc/system-api.yaml @@ -6,7 +6,7 @@ Host: 0.0.0.0 Port: 9003 Auth: - AccessSecret: sundynix-jwt-secret-2024 + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 AccessExpire: 604800 SystemRpc: diff --git a/app/system/api/internal/handler/routes.go b/app/system/api/internal/handler/routes.go index dfa0b61..a325f85 100644 --- a/app/system/api/internal/handler/routes.go +++ b/app/system/api/internal/handler/routes.go @@ -11,6 +11,7 @@ import ( menu "sundynix-micro-go/app/system/api/internal/handler/menu" operationRecord "sundynix-micro-go/app/system/api/internal/handler/operationRecord" role "sundynix-micro-go/app/system/api/internal/handler/role" + user "sundynix-micro-go/app/system/api/internal/handler/user" "sundynix-micro-go/app/system/api/internal/svc" "github.com/zeromicro/go-zero/rest" @@ -27,7 +28,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 删除客户端 - Method: http.MethodDelete, + Method: http.MethodPost, Path: "/client/delete", Handler: client.DeleteClientHandler(serverCtx), }, @@ -39,7 +40,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 更新客户端 - Method: http.MethodPut, + Method: http.MethodPost, Path: "/client/update", Handler: client.UpdateClientHandler(serverCtx), }, @@ -58,7 +59,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 删除字典 - Method: http.MethodDelete, + Method: http.MethodPost, Path: "/dict/delete", Handler: dict.DeleteDictHandler(serverCtx), }, @@ -70,7 +71,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 更新字典 - Method: http.MethodPut, + Method: http.MethodPost, Path: "/dict/update", Handler: dict.UpdateDictHandler(serverCtx), }, @@ -95,7 +96,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 删除菜单 - Method: http.MethodDelete, + Method: http.MethodPost, Path: "/menu/delete", Handler: menu.DeleteMenuHandler(serverCtx), }, @@ -107,7 +108,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 更新菜单 - Method: http.MethodPut, + Method: http.MethodPost, Path: "/menu/update", Handler: menu.UpdateMenuHandler(serverCtx), }, @@ -120,7 +121,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { []rest.Route{ { // 删除操作日志 - Method: http.MethodDelete, + Method: http.MethodPost, Path: "/log/delete", Handler: operationRecord.DeleteOperationRecordHandler(serverCtx), }, @@ -145,7 +146,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 删除角色 - Method: http.MethodDelete, + Method: http.MethodPost, Path: "/role/delete", Handler: role.DeleteRoleHandler(serverCtx), }, @@ -157,7 +158,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, { // 更新角色 - Method: http.MethodPut, + Method: http.MethodPost, Path: "/role/update", Handler: role.UpdateRoleHandler(serverCtx), }, @@ -165,4 +166,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { rest.WithJwt(serverCtx.Config.Auth.AccessSecret), rest.WithPrefix("/api/sys"), ) + + server.AddRoutes( + []rest.Route{ + { + // 创建用户 + Method: http.MethodPost, + Path: "/user/create", + Handler: user.CreateUserHandler(serverCtx), + }, + { + // 删除用户 + Method: http.MethodPost, + Path: "/user/delete", + Handler: user.DeleteUserHandler(serverCtx), + }, + { + // 用户列表 + Method: http.MethodPost, + Path: "/user/list", + Handler: user.GetUserListHandler(serverCtx), + }, + { + // 重置密码 + Method: http.MethodPost, + Path: "/user/resetPassword", + Handler: user.ResetPasswordHandler(serverCtx), + }, + { + // 更新用户 + Method: http.MethodPost, + Path: "/user/update", + Handler: user.UpdateUserHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) } diff --git a/app/system/api/internal/handler/user/createUserHandler.go b/app/system/api/internal/handler/user/createUserHandler.go new file mode 100644 index 0000000..b8426b3 --- /dev/null +++ b/app/system/api/internal/handler/user/createUserHandler.go @@ -0,0 +1,27 @@ +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/user" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +func CreateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UserCreateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + l := user.NewCreateUserLogic(r.Context(), svcCtx) + if err := l.CreateUser(&req); err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/deleteUserHandler.go b/app/system/api/internal/handler/user/deleteUserHandler.go similarity index 63% rename from app/user/api/internal/handler/user/deleteUserHandler.go rename to app/system/api/internal/handler/user/deleteUserHandler.go index 6ff4fe3..3b91d1e 100644 --- a/app/user/api/internal/handler/user/deleteUserHandler.go +++ b/app/system/api/internal/handler/user/deleteUserHandler.go @@ -1,19 +1,15 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package user import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/system/api/internal/logic/user" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" "sundynix-micro-go/common/response" ) -// 删除用户 func DeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.IdsReq @@ -21,10 +17,8 @@ func DeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { response.Fail(w, err.Error()) return } - l := user.NewDeleteUserLogic(r.Context(), svcCtx) - err := l.DeleteUser(&req) - if err != nil { + if err := l.DeleteUser(&req); err != nil { response.Fail(w, err.Error()) } else { response.Ok(w) diff --git a/app/user/api/internal/handler/user/getUserListHandler.go b/app/system/api/internal/handler/user/getUserListHandler.go similarity index 64% rename from app/user/api/internal/handler/user/getUserListHandler.go rename to app/system/api/internal/handler/user/getUserListHandler.go index 22b0547..28a2806 100644 --- a/app/user/api/internal/handler/user/getUserListHandler.go +++ b/app/system/api/internal/handler/user/getUserListHandler.go @@ -1,19 +1,15 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package user import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" - "sundynix-micro-go/app/user/api/internal/logic/user" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/system/api/internal/logic/user" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" "sundynix-micro-go/common/response" ) -// 用户列表 func GetUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UserListReq @@ -21,13 +17,12 @@ func GetUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { response.Fail(w, err.Error()) return } - l := user.NewGetUserListLogic(r.Context(), svcCtx) - err := l.GetUserList(&req) + resp, err := l.GetUserList(&req) if err != nil { response.Fail(w, err.Error()) } else { - response.Ok(w) + response.OkWithData(w, resp) } } } diff --git a/app/system/api/internal/handler/user/resetPasswordHandler.go b/app/system/api/internal/handler/user/resetPasswordHandler.go new file mode 100644 index 0000000..b09d39f --- /dev/null +++ b/app/system/api/internal/handler/user/resetPasswordHandler.go @@ -0,0 +1,27 @@ +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/user" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +func ResetPasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ResetPasswordReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + l := user.NewResetPasswordLogic(r.Context(), svcCtx) + if err := l.ResetPassword(&req); err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/user/updateUserHandler.go b/app/system/api/internal/handler/user/updateUserHandler.go new file mode 100644 index 0000000..18bbece --- /dev/null +++ b/app/system/api/internal/handler/user/updateUserHandler.go @@ -0,0 +1,27 @@ +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/user" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +func UpdateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UserUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + l := user.NewUpdateUserLogic(r.Context(), svcCtx) + if err := l.UpdateUser(&req); err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/logic/user/createUserLogic.go b/app/system/api/internal/logic/user/createUserLogic.go new file mode 100644 index 0000000..cff0bf6 --- /dev/null +++ b/app/system/api/internal/logic/user/createUserLogic.go @@ -0,0 +1,31 @@ +package user + +import ( + "context" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { + return &CreateUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *CreateUserLogic) CreateUser(req *types.UserCreateReq) error { + _, err := l.svcCtx.SystemRpc.CreateUser(l.ctx, &system.CreateUserReq{ + Name: req.Name, + Account: req.Account, + Password: req.Password, + Phone: req.Phone, + }) + return err +} diff --git a/app/user/api/internal/logic/user/deleteUserLogic.go b/app/system/api/internal/logic/user/deleteUserLogic.go similarity index 50% rename from app/user/api/internal/logic/user/deleteUserLogic.go rename to app/system/api/internal/logic/user/deleteUserLogic.go index a2a1b11..4c03e87 100644 --- a/app/user/api/internal/logic/user/deleteUserLogic.go +++ b/app/system/api/internal/logic/user/deleteUserLogic.go @@ -1,13 +1,11 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package user import ( "context" - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/app/system/rpc/system" "github.com/zeromicro/go-zero/core/logx" ) @@ -18,17 +16,11 @@ type DeleteUserLogic struct { svcCtx *svc.ServiceContext } -// 删除用户 func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic { - return &DeleteUserLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } + return &DeleteUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *DeleteUserLogic) DeleteUser(req *types.IdsReq) error { - // todo: add your logic here and delete this line - - return nil + _, err := l.svcCtx.SystemRpc.DeleteUser(l.ctx, &system.DeleteUserReq{Ids: req.Ids}) + return err } diff --git a/app/system/api/internal/logic/user/getUserListLogic.go b/app/system/api/internal/logic/user/getUserListLogic.go new file mode 100644 index 0000000..af13727 --- /dev/null +++ b/app/system/api/internal/logic/user/getUserListLogic.go @@ -0,0 +1,46 @@ +package user + +import ( + "context" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic { + return &GetUserListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetUserListLogic) GetUserList(req *types.UserListReq) (resp interface{}, err error) { + rpcResp, err := l.svcCtx.SystemRpc.GetUserList(l.ctx, &system.GetUserListReq{ + Current: int32(req.Current), + PageSize: int32(req.PageSize), + Name: req.Name, + Account: req.Account, + }) + if err != nil { + return nil, err + } + var list []map[string]interface{} + for _, u := range rpcResp.List { + list = append(list, map[string]interface{}{ + "id": u.Id, + "name": u.Name, + "account": u.Account, + "nickName": u.NickName, + "phone": u.Phone, + "gender": u.Gender, + "createdAt": u.CreatedAt, + }) + } + return map[string]interface{}{"list": list, "total": rpcResp.Total}, nil +} diff --git a/app/system/api/internal/logic/user/resetPasswordLogic.go b/app/system/api/internal/logic/user/resetPasswordLogic.go new file mode 100644 index 0000000..af42400 --- /dev/null +++ b/app/system/api/internal/logic/user/resetPasswordLogic.go @@ -0,0 +1,29 @@ +package user + +import ( + "context" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ResetPasswordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewResetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResetPasswordLogic { + return &ResetPasswordLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *ResetPasswordLogic) ResetPassword(req *types.ResetPasswordReq) error { + _, err := l.svcCtx.SystemRpc.ResetPassword(l.ctx, &system.ResetPasswordReq{ + Id: req.Id, + Password: req.Password, + }) + return err +} diff --git a/app/system/api/internal/logic/user/updateUserLogic.go b/app/system/api/internal/logic/user/updateUserLogic.go new file mode 100644 index 0000000..c07738b --- /dev/null +++ b/app/system/api/internal/logic/user/updateUserLogic.go @@ -0,0 +1,32 @@ +package user + +import ( + "context" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *UpdateUserLogic) UpdateUser(req *types.UserUpdateReq) error { + _, err := l.svcCtx.SystemRpc.UpdateUser(l.ctx, &system.UpdateUserReq{ + Id: req.Id, + Name: req.Name, + Account: req.Account, + Phone: req.Phone, + NickName: req.NickName, + }) + return err +} diff --git a/app/system/api/internal/svc/serviceContext.go b/app/system/api/internal/svc/serviceContext.go index 5ba295a..4622689 100644 --- a/app/system/api/internal/svc/serviceContext.go +++ b/app/system/api/internal/svc/serviceContext.go @@ -1,6 +1,3 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - package svc import ( diff --git a/app/system/api/internal/types/types.go b/app/system/api/internal/types/types.go index 7a06b5a..5282b50 100644 --- a/app/system/api/internal/types/types.go +++ b/app/system/api/internal/types/types.go @@ -98,6 +98,11 @@ type PageReq struct { Keyword string `json:"keyword,optional"` } +type ResetPasswordReq struct { + Id string `json:"id"` + Password string `json:"password"` +} + type RoleListReq struct { Current int `json:"current,optional"` PageSize int `json:"pageSize,optional"` @@ -118,3 +123,28 @@ type RoleUpdateReq struct { Sort int `json:"sort,optional"` MenuIds []string `json:"menuIds,optional"` } + +type UserCreateReq struct { + Name string `json:"name"` + Account string `json:"account"` + Password string `json:"password"` + Phone string `json:"phone,optional"` + NickName string `json:"nickName,optional"` + RoleIds []string `json:"roleIds,optional"` +} + +type UserListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + Account string `json:"account,optional"` +} + +type UserUpdateReq struct { + Id string `json:"id"` + Name string `json:"name,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` + NickName string `json:"nickName,optional"` + RoleIds []string `json:"roleIds,optional"` +} diff --git a/app/system/api/system.api b/app/system/api/system.api index 35fd4c4..833d9ca 100644 --- a/app/system/api/system.api +++ b/app/system/api/system.api @@ -115,6 +115,33 @@ type ( PageSize int `json:"pageSize,optional"` Type string `json:"type,optional"` } + // ---------- 用户管理 ---------- + UserCreateReq { + Name string `json:"name"` + Account string `json:"account"` + Password string `json:"password"` + Phone string `json:"phone,optional"` + NickName string `json:"nickName,optional"` + RoleIds []string `json:"roleIds,optional"` + } + UserUpdateReq { + Id string `json:"id"` + Name string `json:"name,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` + NickName string `json:"nickName,optional"` + RoleIds []string `json:"roleIds,optional"` + } + UserListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + Account string `json:"account,optional"` + } + ResetPasswordReq { + Id string `json:"id"` + Password string `json:"password"` + } ) // ========== 需要鉴权的接口 ========== @@ -130,11 +157,11 @@ service system-api { @doc "更新客户端" @handler UpdateClient - put /client/update (ClientUpdateReq) + post /client/update (ClientUpdateReq) @doc "删除客户端" @handler DeleteClient - delete /client/delete (IdsReq) + post /client/delete (IdsReq) @doc "客户端列表" @handler GetClientList @@ -153,11 +180,11 @@ service system-api { @doc "更新角色" @handler UpdateRole - put /role/update (RoleUpdateReq) + post /role/update (RoleUpdateReq) @doc "删除角色" @handler DeleteRole - delete /role/delete (IdsReq) + post /role/delete (IdsReq) @doc "角色列表" @handler GetRoleList @@ -176,11 +203,11 @@ service system-api { @doc "更新菜单" @handler UpdateMenu - put /menu/update (MenuUpdateReq) + post /menu/update (MenuUpdateReq) @doc "删除菜单" @handler DeleteMenu - delete /menu/delete (IdsReq) + post /menu/delete (IdsReq) @doc "菜单列表(树形)" @handler GetMenuList @@ -203,7 +230,7 @@ service system-api { @doc "删除操作日志" @handler DeleteOperationRecord - delete /log/delete (IdsReq) + post /log/delete (IdsReq) } @server ( @@ -218,14 +245,41 @@ service system-api { @doc "更新字典" @handler UpdateDict - put /dict/update (DictUpdateReq) + post /dict/update (DictUpdateReq) @doc "删除字典" @handler DeleteDict - delete /dict/delete (IdsReq) + post /dict/delete (IdsReq) @doc "字典列表" @handler GetDictList post /dict/list (DictListReq) } +@server ( + prefix: /api/sys + group: user + jwt: Auth +) +service system-api { + @doc "用户列表" + @handler GetUserList + post /user/list (UserListReq) + + @doc "创建用户" + @handler CreateUser + post /user/create (UserCreateReq) + + @doc "更新用户" + @handler UpdateUser + post /user/update (UserUpdateReq) + + @doc "删除用户" + @handler DeleteUser + post /user/delete (IdsReq) + + @doc "重置密码" + @handler ResetPassword + post /user/resetPassword (ResetPasswordReq) +} + diff --git a/app/system/api/system.go b/app/system/api/system.go index 52ac1b9..6df1dc9 100644 --- a/app/system/api/system.go +++ b/app/system/api/system.go @@ -12,6 +12,7 @@ import ( "sundynix-micro-go/app/system/api/internal/svc" "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/rest" ) @@ -19,6 +20,7 @@ var configFile = flag.String("f", "etc/system-api.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/system/model/system_model.go b/app/system/model/system_model.go index 8b56013..d6d112d 100644 --- a/app/system/model/system_model.go +++ b/app/system/model/system_model.go @@ -62,24 +62,15 @@ func (SundynixRoleMenu) TableName() string { return "sundynix_role_menu" } -// SundynixUserRole 用户角色关联表 -type SundynixUserRole struct { - UserID string `gorm:"size:50;primaryKey;column:user_id" json:"userId"` - RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"` -} - -func (SundynixUserRole) TableName() string { - return "sundynix_user_role" -} - // SundynixOperationRecord 操作记录表 type SundynixOperationRecord struct { model.BaseModel + ClientID string `gorm:"size:50;column:client_id;comment:客户端标识" json:"clientId"` IP string `gorm:"column:ip;comment:请求ip" json:"ip"` Method string `gorm:"column:method;comment:请求方法" json:"method"` Path string `gorm:"column:path;comment:请求路径" json:"path"` Status int `gorm:"column:status;comment:请求状态" json:"status"` - Latency time.Duration `gorm:"column:latency;comment:延迟" json:"latency"` + Latency time.Duration `gorm:"column:latency;comment:耗时(纳秒)" json:"latency"` Agent string `gorm:"type:text;column:agent;comment:代理" json:"agent"` ErrorMessage string `gorm:"column:error_message;comment:错误信息" json:"errorMessage"` Body string `gorm:"type:text;column:body;comment:请求Body" json:"body"` @@ -104,3 +95,37 @@ type SundynixDict struct { func (SundynixDict) TableName() string { return "sundynix_dict" } + +// SundynixUser 用户基础表 +type SundynixUser struct { + model.BaseModel + TenantID string `gorm:"size:20;column:tenant_id" json:"tenantId"` + ClientID string `gorm:"size:20;column:client_id" json:"clientId"` + Name string `gorm:"size:100;column:name" json:"name"` + Account string `gorm:"size:50;column:account" json:"account"` + Password string `gorm:"size:100;column:password" json:"-"` + NickName string `gorm:"size:100;column:nick_name" json:"nickName"` + Phone string `gorm:"size:20;column:phone" json:"phone"` + SessionKey string `gorm:"size:80;column:session_key" json:"-"` + UnionID string `gorm:"size:80;column:union_id" json:"unionId"` + OpenID string `gorm:"size:80;column:open_id;index" json:"openId"` + SaOpenID string `gorm:"size:80;column:sa_open_id" json:"saOpenId"` + AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"` + Gender int `gorm:"default:0;column:gender" json:"gender"` + LastLoginIP string `gorm:"size:20;column:last_login_ip" json:"lastLoginIp"` + LastLoginAt *time.Time `gorm:"column:last_login_at" json:"lastLoginAt"` +} + +func (SundynixUser) TableName() string { + return "sundynix_user" +} + +// SundynixUserRole 用户角色关联表 +type SundynixUserRole struct { + UserID string `gorm:"size:50;primaryKey;column:user_id" json:"userId"` + RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"` +} + +func (SundynixUserRole) TableName() string { + return "sundynix_user_role" +} diff --git a/app/system/rpc/internal/logic/createOperationRecordLogic.go b/app/system/rpc/internal/logic/createOperationRecordLogic.go new file mode 100644 index 0000000..c9db029 --- /dev/null +++ b/app/system/rpc/internal/logic/createOperationRecordLogic.go @@ -0,0 +1,45 @@ +package logic + +import ( + "context" + "time" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateOperationRecordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateOperationRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateOperationRecordLogic { + return &CreateOperationRecordLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *CreateOperationRecordLogic) CreateOperationRecord(in *system.CreateOperationRecordReq) (*system.CommonResp, error) { + record := sysModel.SundynixOperationRecord{ + ClientID: in.ClientId, + IP: in.Ip, + Method: in.Method, + Path: in.Path, + Status: int(in.Status), + Latency: time.Duration(in.Latency), + Agent: in.Agent, + ErrorMessage: in.ErrorMessage, + Body: in.Body, + Resp: in.Resp, + UserID: in.UserId, + } + + if err := l.svcCtx.DB.Create(&record).Error; err != nil { + l.Errorf("写入操作日志失败: %v", err) + // 日志写入失败不影响业务,不返回error + } + + return &system.CommonResp{Code: 200, Msg: "success"}, nil +} diff --git a/app/system/rpc/internal/logic/createRoleLogic.go b/app/system/rpc/internal/logic/createRoleLogic.go index b7214e7..7f2e8ed 100644 --- a/app/system/rpc/internal/logic/createRoleLogic.go +++ b/app/system/rpc/internal/logic/createRoleLogic.go @@ -3,10 +3,13 @@ package logic import ( "context" "fmt" - "github.com/zeromicro/go-zero/core/logx" + sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) type CreateRoleLogic struct { @@ -20,15 +23,21 @@ func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create } func (l *CreateRoleLogic) CreateRole(in *system.RoleReq) (*system.CommonResp, error) { - role := sysModel.SundynixRole{Name: in.Name, Code: in.Code, Sort: int(in.Sort)} - if err := l.svcCtx.DB.Create(&role).Error; err != nil { - return nil, fmt.Errorf("创建角色失败") - } - // 关联菜单 - if len(in.MenuIds) > 0 { - for _, mid := range in.MenuIds { - l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: role.ID, MenuID: mid}) + err := l.svcCtx.DB.Transaction(func(tx *gorm.DB) error { + role := sysModel.SundynixRole{Name: in.Name, Code: in.Code, Sort: int(in.Sort)} + if err := tx.Create(&role).Error; err != nil { + return fmt.Errorf("创建角色失败: %w", err) } + // 关联菜单 + for _, mid := range in.MenuIds { + if err := tx.Create(&sysModel.SundynixRoleMenu{RoleID: role.ID, MenuID: mid}).Error; err != nil { + return fmt.Errorf("关联菜单失败: %w", err) + } + } + return nil + }) + if err != nil { + return nil, err } return &system.CommonResp{Code: 200, Msg: "success"}, nil } diff --git a/app/system/rpc/internal/logic/createUserLogic.go b/app/system/rpc/internal/logic/createUserLogic.go new file mode 100644 index 0000000..ea5cbf5 --- /dev/null +++ b/app/system/rpc/internal/logic/createUserLogic.go @@ -0,0 +1,62 @@ +package logic + +import ( + "context" + "fmt" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/common/utils/hash" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { + return &CreateUserLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *CreateUserLogic) CreateUser(in *system.CreateUserReq) (*system.CreateUserResp, error) { + // 如果有 OpenId,先查是否已存在(社交登录场景:已有用户直接返回) + if in.OpenId != "" { + var existing sysModel.SundynixUser + if err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&existing).Error; err == nil { + // 用户已存在,更新 session_key 后直接返回 + if in.SessionKey != "" { + l.svcCtx.DB.Model(&existing).Update("session_key", in.SessionKey) + } + return &system.CreateUserResp{User: convertUserToProto(&existing)}, nil + } + } + + // 如果有 Account,检查是否重复(后台创建用户场景:禁止重复) + if in.Account != "" { + var count int64 + l.svcCtx.DB.Model(&sysModel.SundynixUser{}).Where("account = ?", in.Account).Count(&count) + if count > 0 { + return nil, fmt.Errorf("账号 %s 已存在", in.Account) + } + } + + u := sysModel.SundynixUser{ + Name: in.Name, + Account: in.Account, + Phone: in.Phone, + OpenID: in.OpenId, + SessionKey: in.SessionKey, + ClientID: in.ClientId, + } + if in.Password != "" { + u.Password = hash.BcryptHash(in.Password) + } + if err := l.svcCtx.DB.Create(&u).Error; err != nil { + return nil, fmt.Errorf("创建用户失败: %w", err) + } + return &system.CreateUserResp{User: convertUserToProto(&u)}, nil +} diff --git a/app/system/rpc/internal/logic/deleteMenuLogic.go b/app/system/rpc/internal/logic/deleteMenuLogic.go index 81b9abe..01a1895 100644 --- a/app/system/rpc/internal/logic/deleteMenuLogic.go +++ b/app/system/rpc/internal/logic/deleteMenuLogic.go @@ -3,10 +3,13 @@ package logic import ( "context" "fmt" - "github.com/zeromicro/go-zero/core/logx" + sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) type DeleteMenuLogic struct { @@ -20,9 +23,17 @@ func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete } func (l *DeleteMenuLogic) DeleteMenu(in *system.IdsReq) (*system.CommonResp, error) { - if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixMenu{}).Error; err != nil { - return nil, fmt.Errorf("删除菜单失败") + err := l.svcCtx.DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixMenu{}).Error; err != nil { + return fmt.Errorf("删除菜单失败: %w", err) + } + if err := tx.Where("menu_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{}).Error; err != nil { + return fmt.Errorf("清除角色关联失败: %w", err) + } + return nil + }) + if err != nil { + return nil, err } - l.svcCtx.DB.Where("menu_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{}) return &system.CommonResp{Code: 200, Msg: "success"}, nil } diff --git a/app/system/rpc/internal/logic/deleteRoleLogic.go b/app/system/rpc/internal/logic/deleteRoleLogic.go index 4a39b0b..6dbefda 100644 --- a/app/system/rpc/internal/logic/deleteRoleLogic.go +++ b/app/system/rpc/internal/logic/deleteRoleLogic.go @@ -3,10 +3,13 @@ package logic import ( "context" "fmt" - "github.com/zeromicro/go-zero/core/logx" + sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) type DeleteRoleLogic struct { @@ -20,9 +23,17 @@ func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete } func (l *DeleteRoleLogic) DeleteRole(in *system.IdsReq) (*system.CommonResp, error) { - if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixRole{}).Error; err != nil { - return nil, fmt.Errorf("删除角色失败") + err := l.svcCtx.DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixRole{}).Error; err != nil { + return fmt.Errorf("删除角色失败: %w", err) + } + if err := tx.Where("role_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{}).Error; err != nil { + return fmt.Errorf("清除菜单关联失败: %w", err) + } + return nil + }) + if err != nil { + return nil, err } - l.svcCtx.DB.Where("role_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{}) return &system.CommonResp{Code: 200, Msg: "success"}, nil } diff --git a/app/system/rpc/internal/logic/deleteUserLogic.go b/app/system/rpc/internal/logic/deleteUserLogic.go new file mode 100644 index 0000000..3eda56c --- /dev/null +++ b/app/system/rpc/internal/logic/deleteUserLogic.go @@ -0,0 +1,39 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" +) + +type DeleteUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic { + return &DeleteUserLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *DeleteUserLogic) DeleteUser(in *system.DeleteUserReq) (*system.CommonResp, error) { + err := l.svcCtx.DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixUser{}).Error; err != nil { + return err + } + // 同时删除用户角色关联 + if err := tx.Where("user_id IN ?", in.Ids).Delete(&sysModel.SundynixUserRole{}).Error; err != nil { + return err + } + return nil + }) + if err != nil { + return nil, err + } + return &system.CommonResp{Code: 200, Msg: "success"}, nil +} diff --git a/app/system/rpc/internal/logic/getClientByIdLogic.go b/app/system/rpc/internal/logic/getClientByIdLogic.go index d3ba39c..c2b7ed4 100644 --- a/app/system/rpc/internal/logic/getClientByIdLogic.go +++ b/app/system/rpc/internal/logic/getClientByIdLogic.go @@ -2,6 +2,7 @@ package logic import ( "context" + "errors" sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" @@ -32,10 +33,11 @@ func (l *GetClientByIdLogic) GetClientById(in *system.GetClientByIdReq) (*system var client sysModel.SundynixClient err := l.svcCtx.DB.Where("client_id = ?", in.ClientId).First(&client).Error if err != nil { - if err == gorm.ErrRecordNotFound { + if errors.Is(err, gorm.ErrRecordNotFound) { + l.Infof("[GetClientById] 客户端不存在 | clientId=%s", in.ClientId) return nil, status.Error(codes.NotFound, "客户端不存在") } - l.Errorf("查询客户端失败: %v", err) + l.Errorf("[GetClientById] ❌ 查询客户端失败 | clientId=%s | err=%v", in.ClientId, err) return nil, status.Error(codes.Internal, "查询客户端失败") } diff --git a/app/system/rpc/internal/logic/getMenuListLogic.go b/app/system/rpc/internal/logic/getMenuListLogic.go index 11897c7..09077f9 100644 --- a/app/system/rpc/internal/logic/getMenuListLogic.go +++ b/app/system/rpc/internal/logic/getMenuListLogic.go @@ -3,10 +3,11 @@ package logic import ( "context" "fmt" - "github.com/zeromicro/go-zero/core/logx" sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" ) type GetMenuListLogic struct { @@ -22,9 +23,11 @@ func NewGetMenuListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMe func (l *GetMenuListLogic) GetMenuList(in *system.IdReq) (*system.MenuListResp, error) { var menus []sysModel.SundynixMenu if err := l.svcCtx.DB.Order("sort ASC").Find(&menus).Error; err != nil { + l.Errorf("[GetMenuList] ❌ 查询菜单失败: %v", err) return nil, fmt.Errorf("查询菜单列表失败") } - tree := buildMenuTree(menus, "") + l.Infof("[GetMenuList] 查询到菜单数量: %d", len(menus)) + tree := buildMenuTree(menus, "0") return &system.MenuListResp{Menus: tree}, nil } diff --git a/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go b/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go index e64cca7..acdc37d 100644 --- a/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go +++ b/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go @@ -73,7 +73,8 @@ func (l *GetMenusByRoleIdLogic) GetMenusByRoleId(in *system.GetMenusByRoleIdReq) menuMap[m.ID] = menuInfo } - for _, menuInfo := range menuMap { + for _, m := range menus { + menuInfo := menuMap[m.ID] if menuInfo.ParentId == "0" || menuInfo.ParentId == "" { rootMenus = append(rootMenus, menuInfo) } else { diff --git a/app/system/rpc/internal/logic/getOperationRecordListLogic.go b/app/system/rpc/internal/logic/getOperationRecordListLogic.go index 669036b..cb98947 100644 --- a/app/system/rpc/internal/logic/getOperationRecordListLogic.go +++ b/app/system/rpc/internal/logic/getOperationRecordListLogic.go @@ -46,11 +46,21 @@ func (l *GetOperationRecordListLogic) GetOperationRecordList(in *system.Operatio var items []*system.OperationRecordInfo for _, r := range list { items = append(items, &system.OperationRecordInfo{ - Id: r.ID, Ip: r.IP, Method: r.Method, Path: r.Path, - Status: int32(r.Status), Agent: r.Agent, ErrorMessage: r.ErrorMessage, - Body: r.Body, Resp: r.Resp, UserId: r.UserID, - CreatedAt: r.CreatedAt.Unix(), + Id: r.ID, + ClientId: r.ClientID, + Ip: r.IP, + Method: r.Method, + Path: r.Path, + Status: int32(r.Status), + Latency: int64(r.Latency), + Agent: r.Agent, + ErrorMessage: r.ErrorMessage, + Body: r.Body, + Resp: r.Resp, + UserId: r.UserID, + CreatedAt: r.CreatedAt.Unix(), }) } + return &system.OperationRecordListResp{List: items, Total: total}, nil } diff --git a/app/system/rpc/internal/logic/getUserByIdLogic.go b/app/system/rpc/internal/logic/getUserByIdLogic.go new file mode 100644 index 0000000..a7646ee --- /dev/null +++ b/app/system/rpc/internal/logic/getUserByIdLogic.go @@ -0,0 +1,36 @@ +package logic + +import ( + "context" + "errors" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetUserByIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByIdLogic { + return &GetUserByIdLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *GetUserByIdLogic) GetUserById(in *system.GetUserByIdReq) (*system.GetUserByIdResp, error) { + var u sysModel.SundynixUser + if err := l.svcCtx.DB.Where("id = ?", in.Id).First(&u).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, status.Error(codes.NotFound, "用户不存在") + } + return nil, status.Error(codes.Internal, "查询用户失败") + } + return &system.GetUserByIdResp{User: convertUserToProto(&u)}, nil +} diff --git a/app/system/rpc/internal/logic/getUserByOpenIdLogic.go b/app/system/rpc/internal/logic/getUserByOpenIdLogic.go new file mode 100644 index 0000000..094ef27 --- /dev/null +++ b/app/system/rpc/internal/logic/getUserByOpenIdLogic.go @@ -0,0 +1,36 @@ +package logic + +import ( + "context" + "errors" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetUserByOpenIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserByOpenIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByOpenIdLogic { + return &GetUserByOpenIdLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *GetUserByOpenIdLogic) GetUserByOpenId(in *system.GetUserByOpenIdReq) (*system.GetUserByOpenIdResp, error) { + var u sysModel.SundynixUser + if err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&u).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, status.Error(codes.NotFound, "用户不存在") + } + return nil, status.Error(codes.Internal, "查询失败") + } + return &system.GetUserByOpenIdResp{User: convertUserToProto(&u)}, nil +} diff --git a/app/system/rpc/internal/logic/getUserListLogic.go b/app/system/rpc/internal/logic/getUserListLogic.go new file mode 100644 index 0000000..cc377e7 --- /dev/null +++ b/app/system/rpc/internal/logic/getUserListLogic.go @@ -0,0 +1,51 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic { + return &GetUserListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *GetUserListLogic) GetUserList(in *system.GetUserListReq) (*system.GetUserListResp, error) { + db := l.svcCtx.DB.Model(&sysModel.SundynixUser{}) + if in.Name != "" { + db = db.Where("name LIKE ?", "%"+in.Name+"%") + } + if in.Account != "" { + db = db.Where("account LIKE ?", "%"+in.Account+"%") + } + + var total int64 + db.Count(&total) + + var list []sysModel.SundynixUser + pageSize := int(in.PageSize) + if pageSize <= 0 { + pageSize = 10 + } + current := int(in.Current) + if current <= 0 { + current = 1 + } + db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&list) + + var protoList []*system.UserInfo + for _, u := range list { + protoList = append(protoList, convertUserToProto(&u)) + } + return &system.GetUserListResp{List: protoList, Total: total}, nil +} diff --git a/app/system/rpc/internal/logic/loginByAccountLogic.go b/app/system/rpc/internal/logic/loginByAccountLogic.go new file mode 100644 index 0000000..6f68249 --- /dev/null +++ b/app/system/rpc/internal/logic/loginByAccountLogic.go @@ -0,0 +1,48 @@ +package logic + +import ( + "context" + "errors" + "time" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/common/utils/hash" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type LoginByAccountLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewLoginByAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginByAccountLogic { + return &LoginByAccountLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *LoginByAccountLogic) LoginByAccount(in *system.LoginByAccountReq) (*system.LoginByAccountResp, error) { + var u sysModel.SundynixUser + err := l.svcCtx.DB.Where("account = ?", in.Account).First(&u).Error + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, status.Error(codes.NotFound, "账号不存在") + } + return nil, status.Error(codes.Internal, "查询用户失败") + } + if !hash.BcryptCheck(in.Password, u.Password) { + return nil, status.Error(codes.Unauthenticated, "密码错误") + } + + // 更新最后登录时间 + now := time.Now() + l.svcCtx.DB.Model(&u).Update("last_login_at", now) + u.LastLoginAt = &now + + return &system.LoginByAccountResp{User: convertUserToProto(&u)}, nil +} diff --git a/app/system/rpc/internal/logic/resetPasswordLogic.go b/app/system/rpc/internal/logic/resetPasswordLogic.go new file mode 100644 index 0000000..a4f812a --- /dev/null +++ b/app/system/rpc/internal/logic/resetPasswordLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/common/utils/hash" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ResetPasswordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewResetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResetPasswordLogic { + return &ResetPasswordLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *ResetPasswordLogic) ResetPassword(in *system.ResetPasswordReq) (*system.CommonResp, error) { + if err := l.svcCtx.DB.Model(&sysModel.SundynixUser{}).Where("id = ?", in.Id). + Update("password", hash.BcryptHash(in.Password)).Error; err != nil { + return nil, err + } + return &system.CommonResp{Code: 200, Msg: "success"}, nil +} diff --git a/app/system/rpc/internal/logic/updateRoleLogic.go b/app/system/rpc/internal/logic/updateRoleLogic.go index 671db7c..93edfdb 100644 --- a/app/system/rpc/internal/logic/updateRoleLogic.go +++ b/app/system/rpc/internal/logic/updateRoleLogic.go @@ -3,10 +3,13 @@ package logic import ( "context" "fmt" - "github.com/zeromicro/go-zero/core/logx" + sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/svc" "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) type UpdateRoleLogic struct { @@ -20,15 +23,26 @@ func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update } func (l *UpdateRoleLogic) UpdateRole(in *system.RoleUpdateReq) (*system.CommonResp, error) { - if err := l.svcCtx.DB.Model(&sysModel.SundynixRole{}).Where("id = ?", in.Id).Updates(map[string]interface{}{ - "name": in.Name, "code": in.Code, "sort": in.Sort, - }).Error; err != nil { - return nil, fmt.Errorf("更新角色失败") - } - // 更新菜单关联 - l.svcCtx.DB.Where("role_id = ?", in.Id).Delete(&sysModel.SundynixRoleMenu{}) - for _, mid := range in.MenuIds { - l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: in.Id, MenuID: mid}) + err := l.svcCtx.DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Model(&sysModel.SundynixRole{}).Where("id = ?", in.Id).Updates(map[string]interface{}{ + "name": in.Name, "code": in.Code, "sort": in.Sort, + }).Error; err != nil { + return fmt.Errorf("更新角色失败: %w", err) + } + // 先删除旧的菜单关联 + if err := tx.Where("role_id = ?", in.Id).Delete(&sysModel.SundynixRoleMenu{}).Error; err != nil { + return fmt.Errorf("清除菜单关联失败: %w", err) + } + // 重新关联菜单 + for _, mid := range in.MenuIds { + if err := tx.Create(&sysModel.SundynixRoleMenu{RoleID: in.Id, MenuID: mid}).Error; err != nil { + return fmt.Errorf("关联菜单失败: %w", err) + } + } + return nil + }) + if err != nil { + return nil, err } return &system.CommonResp{Code: 200, Msg: "success"}, nil } diff --git a/app/system/rpc/internal/logic/updateUserLogic.go b/app/system/rpc/internal/logic/updateUserLogic.go new file mode 100644 index 0000000..f92f7be --- /dev/null +++ b/app/system/rpc/internal/logic/updateUserLogic.go @@ -0,0 +1,44 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)} +} + +func (l *UpdateUserLogic) UpdateUser(in *system.UpdateUserReq) (*system.CommonResp, error) { + updates := map[string]interface{}{} + if in.Name != "" { + updates["name"] = in.Name + } + if in.Account != "" { + updates["account"] = in.Account + } + if in.Phone != "" { + updates["phone"] = in.Phone + } + if in.AvatarId != "" { + updates["avatar_id"] = in.AvatarId + } + if in.NickName != "" { + updates["nick_name"] = in.NickName + } + if err := l.svcCtx.DB.Model(&sysModel.SundynixUser{}).Where("id = ?", in.Id).Updates(updates).Error; err != nil { + return nil, err + } + return &system.CommonResp{Code: 200, Msg: "success"}, nil +} diff --git a/app/system/rpc/internal/logic/userHelper.go b/app/system/rpc/internal/logic/userHelper.go new file mode 100644 index 0000000..4335d67 --- /dev/null +++ b/app/system/rpc/internal/logic/userHelper.go @@ -0,0 +1,31 @@ +package logic + +import ( + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/system" +) + +// convertUserToProto 将 model 转为 proto UserInfo +func convertUserToProto(u *sysModel.SundynixUser) *system.UserInfo { + info := &system.UserInfo{ + Id: u.ID, + TenantId: u.TenantID, + ClientId: u.ClientID, + Name: u.Name, + Account: u.Account, + NickName: u.NickName, + Phone: u.Phone, + SessionKey: u.SessionKey, + UnionId: u.UnionID, + OpenId: u.OpenID, + SaOpenId: u.SaOpenID, + AvatarId: u.AvatarID, + Gender: int32(u.Gender), + CreatedAt: u.CreatedAt.Unix(), + UpdatedAt: u.UpdatedAt.Unix(), + } + if u.LastLoginAt != nil { + info.LastLoginAt = u.LastLoginAt.Unix() + } + return info +} diff --git a/app/system/rpc/internal/server/systemServiceServer.go b/app/system/rpc/internal/server/systemServiceServer.go index 0664e8e..1e167eb 100644 --- a/app/system/rpc/internal/server/systemServiceServer.go +++ b/app/system/rpc/internal/server/systemServiceServer.go @@ -23,6 +23,47 @@ func NewSystemServiceServer(svcCtx *svc.ServiceContext) *SystemServiceServer { } } +// --- 用户 --- +func (s *SystemServiceServer) GetUserById(ctx context.Context, in *system.GetUserByIdReq) (*system.GetUserByIdResp, error) { + l := logic.NewGetUserByIdLogic(ctx, s.svcCtx) + return l.GetUserById(in) +} + +func (s *SystemServiceServer) GetUserByOpenId(ctx context.Context, in *system.GetUserByOpenIdReq) (*system.GetUserByOpenIdResp, error) { + l := logic.NewGetUserByOpenIdLogic(ctx, s.svcCtx) + return l.GetUserByOpenId(in) +} + +func (s *SystemServiceServer) LoginByAccount(ctx context.Context, in *system.LoginByAccountReq) (*system.LoginByAccountResp, error) { + l := logic.NewLoginByAccountLogic(ctx, s.svcCtx) + return l.LoginByAccount(in) +} + +func (s *SystemServiceServer) CreateUser(ctx context.Context, in *system.CreateUserReq) (*system.CreateUserResp, error) { + l := logic.NewCreateUserLogic(ctx, s.svcCtx) + return l.CreateUser(in) +} + +func (s *SystemServiceServer) UpdateUser(ctx context.Context, in *system.UpdateUserReq) (*system.CommonResp, error) { + l := logic.NewUpdateUserLogic(ctx, s.svcCtx) + return l.UpdateUser(in) +} + +func (s *SystemServiceServer) GetUserList(ctx context.Context, in *system.GetUserListReq) (*system.GetUserListResp, error) { + l := logic.NewGetUserListLogic(ctx, s.svcCtx) + return l.GetUserList(in) +} + +func (s *SystemServiceServer) DeleteUser(ctx context.Context, in *system.DeleteUserReq) (*system.CommonResp, error) { + l := logic.NewDeleteUserLogic(ctx, s.svcCtx) + return l.DeleteUser(in) +} + +func (s *SystemServiceServer) ResetPassword(ctx context.Context, in *system.ResetPasswordReq) (*system.CommonResp, error) { + l := logic.NewResetPasswordLogic(ctx, s.svcCtx) + return l.ResetPassword(in) +} + // --- 角色 --- func (s *SystemServiceServer) GetRolesByUserId(ctx context.Context, in *system.GetRolesByUserIdReq) (*system.GetRolesByUserIdResp, error) { l := logic.NewGetRolesByUserIdLogic(ctx, s.svcCtx) @@ -123,6 +164,11 @@ func (s *SystemServiceServer) GetDictList(ctx context.Context, in *system.DictLi } // --- 操作日志 --- +func (s *SystemServiceServer) CreateOperationRecord(ctx context.Context, in *system.CreateOperationRecordReq) (*system.CommonResp, error) { + l := logic.NewCreateOperationRecordLogic(ctx, s.svcCtx) + return l.CreateOperationRecord(in) +} + func (s *SystemServiceServer) DeleteOperationRecord(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) { l := logic.NewDeleteOperationRecordLogic(ctx, s.svcCtx) return l.DeleteOperationRecord(in) diff --git a/app/system/rpc/internal/svc/serviceContext.go b/app/system/rpc/internal/svc/serviceContext.go index d1e7a94..8f0c7f4 100644 --- a/app/system/rpc/internal/svc/serviceContext.go +++ b/app/system/rpc/internal/svc/serviceContext.go @@ -1,6 +1,8 @@ package svc import ( + "time" + sysModel "sundynix-micro-go/app/system/model" "sundynix-micro-go/app/system/rpc/internal/config" @@ -17,20 +19,36 @@ type ServiceContext struct { func NewServiceContext(c config.Config) *ServiceContext { db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) if err != nil { - logx.Errorf("连接数据库失败: %v", err) + logx.Errorf("[system-rpc] ❌ 连接数据库失败: %v", err) panic(err) } + // 配置连接池,防止高并发耗尽连接 + sqlDB, err := db.DB() + if err != nil { + logx.Errorf("[system-rpc] ❌ 获取底层 DB 失败: %v", err) + panic(err) + } + sqlDB.SetMaxOpenConns(100) + sqlDB.SetMaxIdleConns(20) + sqlDB.SetConnMaxLifetime(time.Hour) + logx.Infof("[system-rpc] ✅ 数据库连接成功 | MaxOpen=100 MaxIdle=20") + // 自动迁移 - if err := db.AutoMigrate( + tables := []interface{}{ &sysModel.SundynixClient{}, &sysModel.SundynixRole{}, &sysModel.SundynixMenu{}, &sysModel.SundynixRoleMenu{}, &sysModel.SundynixOperationRecord{}, &sysModel.SundynixDict{}, - ); err != nil { - logx.Errorf("数据库迁移失败: %v", err) + &sysModel.SundynixUser{}, + &sysModel.SundynixUserRole{}, + } + if err := db.AutoMigrate(tables...); err != nil { + logx.Errorf("[system-rpc] ⚠️ 数据库迁移失败: %v", err) + } else { + logx.Infof("[system-rpc] ✅ 数据库迁移完成 | 表数量: %d", len(tables)) } return &ServiceContext{ diff --git a/app/system/rpc/pb/system.proto b/app/system/rpc/pb/system.proto index 93950b7..9004b3e 100644 --- a/app/system/rpc/pb/system.proto +++ b/app/system/rpc/pb/system.proto @@ -185,16 +185,32 @@ message DictListResp { message OperationRecordInfo { string id = 1; + string clientId = 2; + string ip = 3; + string method = 4; + string path = 5; + int32 status = 6; + int64 latency = 7; + string agent = 8; + string errorMessage = 9; + string body = 10; + string resp = 11; + string userId = 12; + int64 createdAt = 13; +} + +message CreateOperationRecordReq { + string clientId = 1; string ip = 2; string method = 3; string path = 4; int32 status = 5; - string agent = 6; - string errorMessage = 7; - string body = 8; - string resp = 9; - string userId = 10; - int64 createdAt = 11; + int64 latency = 6; + string agent = 7; + string errorMessage = 8; + string body = 9; + string resp = 10; + string userId = 11; } message OperationRecordListReq { @@ -210,7 +226,105 @@ message OperationRecordListResp { int64 total = 2; } -// ========== 请求/响应(原有) ========== +// ========== 用户 ========== + +message UserInfo { + string id = 1; + string tenantId = 2; + string clientId = 3; + string name = 4; + string account = 5; + string nickName = 6; + string phone = 7; + string sessionKey = 8; + string unionId = 9; + string openId = 10; + string saOpenId = 11; + string avatarId = 12; + int32 gender = 13; + string country = 14; + string province = 15; + string city = 16; + string language = 17; + int32 isVip = 18; + int64 vipExpireAt = 19; + string lastLoginIp = 20; + int64 lastLoginAt = 21; + int64 createdAt = 22; + int64 updatedAt = 23; + string avatarUrl = 24; +} + +message GetUserByIdReq { + string id = 1; +} + +message GetUserByIdResp { + UserInfo user = 1; +} + +message GetUserByOpenIdReq { + string openId = 1; +} + +message GetUserByOpenIdResp { + UserInfo user = 1; +} + +message CreateUserReq { + string name = 1; + string account = 2; + string password = 3; + string openId = 4; + string sessionKey = 5; + string clientId = 6; + string phone = 7; +} + +message CreateUserResp { + UserInfo user = 1; +} + +message UpdateUserReq { + string id = 1; + string name = 2; + string account = 3; + string phone = 4; + string avatarId = 5; + string nickName = 6; +} + +message LoginByAccountReq { + string account = 1; + string password = 2; +} + +message LoginByAccountResp { + UserInfo user = 1; +} + +message GetUserListReq { + int32 current = 1; + int32 pageSize = 2; + string name = 3; + string account = 4; +} + +message GetUserListResp { + repeated UserInfo list = 1; + int64 total = 2; +} + +message DeleteUserReq { + repeated string ids = 1; +} + +message ResetPasswordReq { + string id = 1; + string password = 2; +} + +// ========== 请求/响应(跨模块) ========== message GetRolesByUserIdReq { string userId = 1; @@ -239,6 +353,16 @@ message GetClientByIdResp { // ========== 服务定义 ========== service SystemService { + // --- 用户 --- + rpc GetUserById(GetUserByIdReq) returns (GetUserByIdResp); + rpc GetUserByOpenId(GetUserByOpenIdReq) returns (GetUserByOpenIdResp); + rpc LoginByAccount(LoginByAccountReq) returns (LoginByAccountResp); + rpc CreateUser(CreateUserReq) returns (CreateUserResp); + rpc UpdateUser(UpdateUserReq) returns (CommonResp); + rpc GetUserList(GetUserListReq) returns (GetUserListResp); + rpc DeleteUser(DeleteUserReq) returns (CommonResp); + rpc ResetPassword(ResetPasswordReq) returns (CommonResp); + // --- 角色 --- rpc GetRolesByUserId(GetRolesByUserIdReq) returns (GetRolesByUserIdResp); rpc CreateRole(RoleReq) returns (CommonResp); @@ -251,7 +375,7 @@ service SystemService { rpc CreateMenu(MenuReq) returns (CommonResp); rpc UpdateMenu(MenuUpdateReq) returns (CommonResp); rpc DeleteMenu(IdsReq) returns (CommonResp); - rpc GetMenuList(IdReq) returns (MenuListResp); // 传空id返回全部树 + rpc GetMenuList(IdReq) returns (MenuListResp); // --- 客户端 --- rpc GetClientById(GetClientByIdReq) returns (GetClientByIdResp); @@ -267,6 +391,7 @@ service SystemService { rpc GetDictList(DictListReq) returns (DictListResp); // --- 操作日志 --- + rpc CreateOperationRecord(CreateOperationRecordReq) returns (CommonResp); rpc DeleteOperationRecord(IdsReq) returns (CommonResp); rpc GetOperationRecordList(OperationRecordListReq) returns (OperationRecordListResp); } diff --git a/app/system/rpc/system.go b/app/system/rpc/system.go index 310fc07..1a4767b 100644 --- a/app/system/rpc/system.go +++ b/app/system/rpc/system.go @@ -11,6 +11,7 @@ import ( "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/core/stat" "github.com/zeromicro/go-zero/zrpc" "google.golang.org/grpc" "google.golang.org/grpc/reflection" @@ -20,6 +21,7 @@ var configFile = flag.String("f", "etc/system.yaml", "the config file") func main() { flag.Parse() + stat.DisableLog() var c config.Config conf.MustLoad(*configFile, &c) diff --git a/app/system/rpc/system/system.pb.go b/app/system/rpc/system/system.pb.go index e88b66e..0e38b79 100644 --- a/app/system/rpc/system/system.pb.go +++ b/app/system/rpc/system/system.pb.go @@ -1624,16 +1624,18 @@ func (x *DictListResp) GetTotal() int64 { type OperationRecordInfo struct { state protoimpl.MessageState `protogen:"open.v1"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` - Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` - Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` - Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` - Agent string `protobuf:"bytes,6,opt,name=agent,proto3" json:"agent,omitempty"` - ErrorMessage string `protobuf:"bytes,7,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` - Body string `protobuf:"bytes,8,opt,name=body,proto3" json:"body,omitempty"` - Resp string `protobuf:"bytes,9,opt,name=resp,proto3" json:"resp,omitempty"` - UserId string `protobuf:"bytes,10,opt,name=userId,proto3" json:"userId,omitempty"` - CreatedAt int64 `protobuf:"varint,11,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=clientId,proto3" json:"clientId,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"` + Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` + Latency int64 `protobuf:"varint,7,opt,name=latency,proto3" json:"latency,omitempty"` + Agent string `protobuf:"bytes,8,opt,name=agent,proto3" json:"agent,omitempty"` + ErrorMessage string `protobuf:"bytes,9,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` + Body string `protobuf:"bytes,10,opt,name=body,proto3" json:"body,omitempty"` + Resp string `protobuf:"bytes,11,opt,name=resp,proto3" json:"resp,omitempty"` + UserId string `protobuf:"bytes,12,opt,name=userId,proto3" json:"userId,omitempty"` + CreatedAt int64 `protobuf:"varint,13,opt,name=createdAt,proto3" json:"createdAt,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1675,6 +1677,13 @@ func (x *OperationRecordInfo) GetId() string { return "" } +func (x *OperationRecordInfo) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + func (x *OperationRecordInfo) GetIp() string { if x != nil { return x.Ip @@ -1703,6 +1712,13 @@ func (x *OperationRecordInfo) GetStatus() int32 { return 0 } +func (x *OperationRecordInfo) GetLatency() int64 { + if x != nil { + return x.Latency + } + return 0 +} + func (x *OperationRecordInfo) GetAgent() string { if x != nil { return x.Agent @@ -1745,6 +1761,130 @@ func (x *OperationRecordInfo) GetCreatedAt() int64 { return 0 } +type CreateOperationRecordReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + ClientId string `protobuf:"bytes,1,opt,name=clientId,proto3" json:"clientId,omitempty"` + Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + Latency int64 `protobuf:"varint,6,opt,name=latency,proto3" json:"latency,omitempty"` + Agent string `protobuf:"bytes,7,opt,name=agent,proto3" json:"agent,omitempty"` + ErrorMessage string `protobuf:"bytes,8,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` + Body string `protobuf:"bytes,9,opt,name=body,proto3" json:"body,omitempty"` + Resp string `protobuf:"bytes,10,opt,name=resp,proto3" json:"resp,omitempty"` + UserId string `protobuf:"bytes,11,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateOperationRecordReq) Reset() { + *x = CreateOperationRecordReq{} + mi := &file_pb_system_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateOperationRecordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOperationRecordReq) ProtoMessage() {} + +func (x *CreateOperationRecordReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateOperationRecordReq.ProtoReflect.Descriptor instead. +func (*CreateOperationRecordReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{23} +} + +func (x *CreateOperationRecordReq) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *CreateOperationRecordReq) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *CreateOperationRecordReq) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *CreateOperationRecordReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *CreateOperationRecordReq) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *CreateOperationRecordReq) GetLatency() int64 { + if x != nil { + return x.Latency + } + return 0 +} + +func (x *CreateOperationRecordReq) GetAgent() string { + if x != nil { + return x.Agent + } + return "" +} + +func (x *CreateOperationRecordReq) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +func (x *CreateOperationRecordReq) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +func (x *CreateOperationRecordReq) GetResp() string { + if x != nil { + return x.Resp + } + return "" +} + +func (x *CreateOperationRecordReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + type OperationRecordListReq struct { state protoimpl.MessageState `protogen:"open.v1"` Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` @@ -1758,7 +1898,7 @@ type OperationRecordListReq struct { func (x *OperationRecordListReq) Reset() { *x = OperationRecordListReq{} - mi := &file_pb_system_proto_msgTypes[23] + mi := &file_pb_system_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1770,7 +1910,7 @@ func (x *OperationRecordListReq) String() string { func (*OperationRecordListReq) ProtoMessage() {} func (x *OperationRecordListReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[23] + mi := &file_pb_system_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1783,7 +1923,7 @@ func (x *OperationRecordListReq) ProtoReflect() protoreflect.Message { // Deprecated: Use OperationRecordListReq.ProtoReflect.Descriptor instead. func (*OperationRecordListReq) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{23} + return file_pb_system_proto_rawDescGZIP(), []int{24} } func (x *OperationRecordListReq) GetCurrent() int32 { @@ -1831,7 +1971,7 @@ type OperationRecordListResp struct { func (x *OperationRecordListResp) Reset() { *x = OperationRecordListResp{} - mi := &file_pb_system_proto_msgTypes[24] + mi := &file_pb_system_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1843,7 +1983,7 @@ func (x *OperationRecordListResp) String() string { func (*OperationRecordListResp) ProtoMessage() {} func (x *OperationRecordListResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[24] + mi := &file_pb_system_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1856,7 +1996,7 @@ func (x *OperationRecordListResp) ProtoReflect() protoreflect.Message { // Deprecated: Use OperationRecordListResp.ProtoReflect.Descriptor instead. func (*OperationRecordListResp) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{24} + return file_pb_system_proto_rawDescGZIP(), []int{25} } func (x *OperationRecordListResp) GetList() []*OperationRecordInfo { @@ -1873,6 +2013,942 @@ func (x *OperationRecordListResp) GetTotal() int64 { return 0 } +type UserInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + TenantId string `protobuf:"bytes,2,opt,name=tenantId,proto3" json:"tenantId,omitempty"` + ClientId string `protobuf:"bytes,3,opt,name=clientId,proto3" json:"clientId,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"` + NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` + Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty"` + SessionKey string `protobuf:"bytes,8,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` + UnionId string `protobuf:"bytes,9,opt,name=unionId,proto3" json:"unionId,omitempty"` + OpenId string `protobuf:"bytes,10,opt,name=openId,proto3" json:"openId,omitempty"` + SaOpenId string `protobuf:"bytes,11,opt,name=saOpenId,proto3" json:"saOpenId,omitempty"` + AvatarId string `protobuf:"bytes,12,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + Gender int32 `protobuf:"varint,13,opt,name=gender,proto3" json:"gender,omitempty"` + Country string `protobuf:"bytes,14,opt,name=country,proto3" json:"country,omitempty"` + Province string `protobuf:"bytes,15,opt,name=province,proto3" json:"province,omitempty"` + City string `protobuf:"bytes,16,opt,name=city,proto3" json:"city,omitempty"` + Language string `protobuf:"bytes,17,opt,name=language,proto3" json:"language,omitempty"` + IsVip int32 `protobuf:"varint,18,opt,name=isVip,proto3" json:"isVip,omitempty"` + VipExpireAt int64 `protobuf:"varint,19,opt,name=vipExpireAt,proto3" json:"vipExpireAt,omitempty"` + LastLoginIp string `protobuf:"bytes,20,opt,name=lastLoginIp,proto3" json:"lastLoginIp,omitempty"` + LastLoginAt int64 `protobuf:"varint,21,opt,name=lastLoginAt,proto3" json:"lastLoginAt,omitempty"` + CreatedAt int64 `protobuf:"varint,22,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,23,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` + AvatarUrl string `protobuf:"bytes,24,opt,name=avatarUrl,proto3" json:"avatarUrl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserInfo) Reset() { + *x = UserInfo{} + mi := &file_pb_system_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserInfo) ProtoMessage() {} + +func (x *UserInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserInfo.ProtoReflect.Descriptor instead. +func (*UserInfo) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{26} +} + +func (x *UserInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserInfo) GetTenantId() string { + if x != nil { + return x.TenantId + } + return "" +} + +func (x *UserInfo) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *UserInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserInfo) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *UserInfo) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +func (x *UserInfo) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UserInfo) GetSessionKey() string { + if x != nil { + return x.SessionKey + } + return "" +} + +func (x *UserInfo) GetUnionId() string { + if x != nil { + return x.UnionId + } + return "" +} + +func (x *UserInfo) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +func (x *UserInfo) GetSaOpenId() string { + if x != nil { + return x.SaOpenId + } + return "" +} + +func (x *UserInfo) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *UserInfo) GetGender() int32 { + if x != nil { + return x.Gender + } + return 0 +} + +func (x *UserInfo) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *UserInfo) GetProvince() string { + if x != nil { + return x.Province + } + return "" +} + +func (x *UserInfo) GetCity() string { + if x != nil { + return x.City + } + return "" +} + +func (x *UserInfo) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *UserInfo) GetIsVip() int32 { + if x != nil { + return x.IsVip + } + return 0 +} + +func (x *UserInfo) GetVipExpireAt() int64 { + if x != nil { + return x.VipExpireAt + } + return 0 +} + +func (x *UserInfo) GetLastLoginIp() string { + if x != nil { + return x.LastLoginIp + } + return "" +} + +func (x *UserInfo) GetLastLoginAt() int64 { + if x != nil { + return x.LastLoginAt + } + return 0 +} + +func (x *UserInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *UserInfo) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *UserInfo) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} + +type GetUserByIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByIdReq) Reset() { + *x = GetUserByIdReq{} + mi := &file_pb_system_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByIdReq) ProtoMessage() {} + +func (x *GetUserByIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByIdReq.ProtoReflect.Descriptor instead. +func (*GetUserByIdReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{27} +} + +func (x *GetUserByIdReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetUserByIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByIdResp) Reset() { + *x = GetUserByIdResp{} + mi := &file_pb_system_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByIdResp) ProtoMessage() {} + +func (x *GetUserByIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByIdResp.ProtoReflect.Descriptor instead. +func (*GetUserByIdResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{28} +} + +func (x *GetUserByIdResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type GetUserByOpenIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + OpenId string `protobuf:"bytes,1,opt,name=openId,proto3" json:"openId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByOpenIdReq) Reset() { + *x = GetUserByOpenIdReq{} + mi := &file_pb_system_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByOpenIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByOpenIdReq) ProtoMessage() {} + +func (x *GetUserByOpenIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByOpenIdReq.ProtoReflect.Descriptor instead. +func (*GetUserByOpenIdReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{29} +} + +func (x *GetUserByOpenIdReq) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +type GetUserByOpenIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByOpenIdResp) Reset() { + *x = GetUserByOpenIdResp{} + mi := &file_pb_system_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByOpenIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByOpenIdResp) ProtoMessage() {} + +func (x *GetUserByOpenIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByOpenIdResp.ProtoReflect.Descriptor instead. +func (*GetUserByOpenIdResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{30} +} + +func (x *GetUserByOpenIdResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type CreateUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + OpenId string `protobuf:"bytes,4,opt,name=openId,proto3" json:"openId,omitempty"` + SessionKey string `protobuf:"bytes,5,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` + ClientId string `protobuf:"bytes,6,opt,name=clientId,proto3" json:"clientId,omitempty"` + Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserReq) Reset() { + *x = CreateUserReq{} + mi := &file_pb_system_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserReq) ProtoMessage() {} + +func (x *CreateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead. +func (*CreateUserReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{31} +} + +func (x *CreateUserReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateUserReq) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *CreateUserReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateUserReq) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +func (x *CreateUserReq) GetSessionKey() string { + if x != nil { + return x.SessionKey + } + return "" +} + +func (x *CreateUserReq) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *CreateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +type CreateUserResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserResp) Reset() { + *x = CreateUserResp{} + mi := &file_pb_system_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResp) ProtoMessage() {} + +func (x *CreateUserResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserResp.ProtoReflect.Descriptor instead. +func (*CreateUserResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{32} +} + +func (x *CreateUserResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type UpdateUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` + Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` + AvatarId string `protobuf:"bytes,5,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserReq) Reset() { + *x = UpdateUserReq{} + mi := &file_pb_system_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserReq) ProtoMessage() {} + +func (x *UpdateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead. +func (*UpdateUserReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{33} +} + +func (x *UpdateUserReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateUserReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateUserReq) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *UpdateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UpdateUserReq) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *UpdateUserReq) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +type LoginByAccountReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginByAccountReq) Reset() { + *x = LoginByAccountReq{} + mi := &file_pb_system_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginByAccountReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginByAccountReq) ProtoMessage() {} + +func (x *LoginByAccountReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginByAccountReq.ProtoReflect.Descriptor instead. +func (*LoginByAccountReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{34} +} + +func (x *LoginByAccountReq) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *LoginByAccountReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type LoginByAccountResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginByAccountResp) Reset() { + *x = LoginByAccountResp{} + mi := &file_pb_system_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginByAccountResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginByAccountResp) ProtoMessage() {} + +func (x *LoginByAccountResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginByAccountResp.ProtoReflect.Descriptor instead. +func (*LoginByAccountResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{35} +} + +func (x *LoginByAccountResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type GetUserListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,4,opt,name=account,proto3" json:"account,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserListReq) Reset() { + *x = GetUserListReq{} + mi := &file_pb_system_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserListReq) ProtoMessage() {} + +func (x *GetUserListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserListReq.ProtoReflect.Descriptor instead. +func (*GetUserListReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{36} +} + +func (x *GetUserListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetUserListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetUserListReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetUserListReq) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +type GetUserListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*UserInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserListResp) Reset() { + *x = GetUserListResp{} + mi := &file_pb_system_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserListResp) ProtoMessage() {} + +func (x *GetUserListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserListResp.ProtoReflect.Descriptor instead. +func (*GetUserListResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{37} +} + +func (x *GetUserListResp) GetList() []*UserInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetUserListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type DeleteUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserReq) Reset() { + *x = DeleteUserReq{} + mi := &file_pb_system_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserReq) ProtoMessage() {} + +func (x *DeleteUserReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserReq.ProtoReflect.Descriptor instead. +func (*DeleteUserReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{38} +} + +func (x *DeleteUserReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type ResetPasswordReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetPasswordReq) Reset() { + *x = ResetPasswordReq{} + mi := &file_pb_system_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetPasswordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetPasswordReq) ProtoMessage() {} + +func (x *ResetPasswordReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetPasswordReq.ProtoReflect.Descriptor instead. +func (*ResetPasswordReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{39} +} + +func (x *ResetPasswordReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ResetPasswordReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + type GetRolesByUserIdReq struct { state protoimpl.MessageState `protogen:"open.v1"` UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` @@ -1882,7 +2958,7 @@ type GetRolesByUserIdReq struct { func (x *GetRolesByUserIdReq) Reset() { *x = GetRolesByUserIdReq{} - mi := &file_pb_system_proto_msgTypes[25] + mi := &file_pb_system_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1894,7 +2970,7 @@ func (x *GetRolesByUserIdReq) String() string { func (*GetRolesByUserIdReq) ProtoMessage() {} func (x *GetRolesByUserIdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[25] + mi := &file_pb_system_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1907,7 +2983,7 @@ func (x *GetRolesByUserIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRolesByUserIdReq.ProtoReflect.Descriptor instead. func (*GetRolesByUserIdReq) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{25} + return file_pb_system_proto_rawDescGZIP(), []int{40} } func (x *GetRolesByUserIdReq) GetUserId() string { @@ -1926,7 +3002,7 @@ type GetRolesByUserIdResp struct { func (x *GetRolesByUserIdResp) Reset() { *x = GetRolesByUserIdResp{} - mi := &file_pb_system_proto_msgTypes[26] + mi := &file_pb_system_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1938,7 +3014,7 @@ func (x *GetRolesByUserIdResp) String() string { func (*GetRolesByUserIdResp) ProtoMessage() {} func (x *GetRolesByUserIdResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[26] + mi := &file_pb_system_proto_msgTypes[41] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1951,7 +3027,7 @@ func (x *GetRolesByUserIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRolesByUserIdResp.ProtoReflect.Descriptor instead. func (*GetRolesByUserIdResp) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{26} + return file_pb_system_proto_rawDescGZIP(), []int{41} } func (x *GetRolesByUserIdResp) GetRoles() []*RoleInfo { @@ -1970,7 +3046,7 @@ type GetMenusByRoleIdReq struct { func (x *GetMenusByRoleIdReq) Reset() { *x = GetMenusByRoleIdReq{} - mi := &file_pb_system_proto_msgTypes[27] + mi := &file_pb_system_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1982,7 +3058,7 @@ func (x *GetMenusByRoleIdReq) String() string { func (*GetMenusByRoleIdReq) ProtoMessage() {} func (x *GetMenusByRoleIdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[27] + mi := &file_pb_system_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1995,7 +3071,7 @@ func (x *GetMenusByRoleIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMenusByRoleIdReq.ProtoReflect.Descriptor instead. func (*GetMenusByRoleIdReq) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{27} + return file_pb_system_proto_rawDescGZIP(), []int{42} } func (x *GetMenusByRoleIdReq) GetRoleId() string { @@ -2014,7 +3090,7 @@ type GetMenusByRoleIdResp struct { func (x *GetMenusByRoleIdResp) Reset() { *x = GetMenusByRoleIdResp{} - mi := &file_pb_system_proto_msgTypes[28] + mi := &file_pb_system_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2026,7 +3102,7 @@ func (x *GetMenusByRoleIdResp) String() string { func (*GetMenusByRoleIdResp) ProtoMessage() {} func (x *GetMenusByRoleIdResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[28] + mi := &file_pb_system_proto_msgTypes[43] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2039,7 +3115,7 @@ func (x *GetMenusByRoleIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMenusByRoleIdResp.ProtoReflect.Descriptor instead. func (*GetMenusByRoleIdResp) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{28} + return file_pb_system_proto_rawDescGZIP(), []int{43} } func (x *GetMenusByRoleIdResp) GetMenus() []*MenuInfo { @@ -2058,7 +3134,7 @@ type GetClientByIdReq struct { func (x *GetClientByIdReq) Reset() { *x = GetClientByIdReq{} - mi := &file_pb_system_proto_msgTypes[29] + mi := &file_pb_system_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2070,7 +3146,7 @@ func (x *GetClientByIdReq) String() string { func (*GetClientByIdReq) ProtoMessage() {} func (x *GetClientByIdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[29] + mi := &file_pb_system_proto_msgTypes[44] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2083,7 +3159,7 @@ func (x *GetClientByIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClientByIdReq.ProtoReflect.Descriptor instead. func (*GetClientByIdReq) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{29} + return file_pb_system_proto_rawDescGZIP(), []int{44} } func (x *GetClientByIdReq) GetClientId() string { @@ -2102,7 +3178,7 @@ type GetClientByIdResp struct { func (x *GetClientByIdResp) Reset() { *x = GetClientByIdResp{} - mi := &file_pb_system_proto_msgTypes[30] + mi := &file_pb_system_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2114,7 +3190,7 @@ func (x *GetClientByIdResp) String() string { func (*GetClientByIdResp) ProtoMessage() {} func (x *GetClientByIdResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_system_proto_msgTypes[30] + mi := &file_pb_system_proto_msgTypes[45] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2127,7 +3203,7 @@ func (x *GetClientByIdResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClientByIdResp.ProtoReflect.Descriptor instead. func (*GetClientByIdResp) Descriptor() ([]byte, []int) { - return file_pb_system_proto_rawDescGZIP(), []int{30} + return file_pb_system_proto_rawDescGZIP(), []int{45} } func (x *GetClientByIdResp) GetClient() *ClientInfo { @@ -2275,20 +3351,35 @@ const file_pb_system_proto_rawDesc = "" + "\x04type\x18\x03 \x01(\tR\x04type\"J\n" + "\fDictListResp\x12$\n" + "\x04list\x18\x01 \x03(\v2\x10.system.DictInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"\x91\x02\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\xc7\x02\n" + "\x13OperationRecordInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\bclientId\x18\x02 \x01(\tR\bclientId\x12\x0e\n" + + "\x02ip\x18\x03 \x01(\tR\x02ip\x12\x16\n" + + "\x06method\x18\x04 \x01(\tR\x06method\x12\x12\n" + + "\x04path\x18\x05 \x01(\tR\x04path\x12\x16\n" + + "\x06status\x18\x06 \x01(\x05R\x06status\x12\x18\n" + + "\alatency\x18\a \x01(\x03R\alatency\x12\x14\n" + + "\x05agent\x18\b \x01(\tR\x05agent\x12\"\n" + + "\ferrorMessage\x18\t \x01(\tR\ferrorMessage\x12\x12\n" + + "\x04body\x18\n" + + " \x01(\tR\x04body\x12\x12\n" + + "\x04resp\x18\v \x01(\tR\x04resp\x12\x16\n" + + "\x06userId\x18\f \x01(\tR\x06userId\x12\x1c\n" + + "\tcreatedAt\x18\r \x01(\x03R\tcreatedAt\"\x9e\x02\n" + + "\x18CreateOperationRecordReq\x12\x1a\n" + + "\bclientId\x18\x01 \x01(\tR\bclientId\x12\x0e\n" + "\x02ip\x18\x02 \x01(\tR\x02ip\x12\x16\n" + "\x06method\x18\x03 \x01(\tR\x06method\x12\x12\n" + "\x04path\x18\x04 \x01(\tR\x04path\x12\x16\n" + - "\x06status\x18\x05 \x01(\x05R\x06status\x12\x14\n" + - "\x05agent\x18\x06 \x01(\tR\x05agent\x12\"\n" + - "\ferrorMessage\x18\a \x01(\tR\ferrorMessage\x12\x12\n" + - "\x04body\x18\b \x01(\tR\x04body\x12\x12\n" + - "\x04resp\x18\t \x01(\tR\x04resp\x12\x16\n" + - "\x06userId\x18\n" + - " \x01(\tR\x06userId\x12\x1c\n" + - "\tcreatedAt\x18\v \x01(\x03R\tcreatedAt\"\x92\x01\n" + + "\x06status\x18\x05 \x01(\x05R\x06status\x12\x18\n" + + "\alatency\x18\x06 \x01(\x03R\alatency\x12\x14\n" + + "\x05agent\x18\a \x01(\tR\x05agent\x12\"\n" + + "\ferrorMessage\x18\b \x01(\tR\ferrorMessage\x12\x12\n" + + "\x04body\x18\t \x01(\tR\x04body\x12\x12\n" + + "\x04resp\x18\n" + + " \x01(\tR\x04resp\x12\x16\n" + + "\x06userId\x18\v \x01(\tR\x06userId\"\x92\x01\n" + "\x16OperationRecordListReq\x12\x18\n" + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x16\n" + @@ -2297,7 +3388,80 @@ const file_pb_system_proto_rawDesc = "" + "\x06status\x18\x05 \x01(\x05R\x06status\"`\n" + "\x17OperationRecordListResp\x12/\n" + "\x04list\x18\x01 \x03(\v2\x1b.system.OperationRecordInfoR\x04list\x12\x14\n" + - "\x05total\x18\x02 \x01(\x03R\x05total\"-\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\x90\x05\n" + + "\bUserInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\btenantId\x18\x02 \x01(\tR\btenantId\x12\x1a\n" + + "\bclientId\x18\x03 \x01(\tR\bclientId\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x05 \x01(\tR\aaccount\x12\x1a\n" + + "\bnickName\x18\x06 \x01(\tR\bnickName\x12\x14\n" + + "\x05phone\x18\a \x01(\tR\x05phone\x12\x1e\n" + + "\n" + + "sessionKey\x18\b \x01(\tR\n" + + "sessionKey\x12\x18\n" + + "\aunionId\x18\t \x01(\tR\aunionId\x12\x16\n" + + "\x06openId\x18\n" + + " \x01(\tR\x06openId\x12\x1a\n" + + "\bsaOpenId\x18\v \x01(\tR\bsaOpenId\x12\x1a\n" + + "\bavatarId\x18\f \x01(\tR\bavatarId\x12\x16\n" + + "\x06gender\x18\r \x01(\x05R\x06gender\x12\x18\n" + + "\acountry\x18\x0e \x01(\tR\acountry\x12\x1a\n" + + "\bprovince\x18\x0f \x01(\tR\bprovince\x12\x12\n" + + "\x04city\x18\x10 \x01(\tR\x04city\x12\x1a\n" + + "\blanguage\x18\x11 \x01(\tR\blanguage\x12\x14\n" + + "\x05isVip\x18\x12 \x01(\x05R\x05isVip\x12 \n" + + "\vvipExpireAt\x18\x13 \x01(\x03R\vvipExpireAt\x12 \n" + + "\vlastLoginIp\x18\x14 \x01(\tR\vlastLoginIp\x12 \n" + + "\vlastLoginAt\x18\x15 \x01(\x03R\vlastLoginAt\x12\x1c\n" + + "\tcreatedAt\x18\x16 \x01(\x03R\tcreatedAt\x12\x1c\n" + + "\tupdatedAt\x18\x17 \x01(\x03R\tupdatedAt\x12\x1c\n" + + "\tavatarUrl\x18\x18 \x01(\tR\tavatarUrl\" \n" + + "\x0eGetUserByIdReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"7\n" + + "\x0fGetUserByIdResp\x12$\n" + + "\x04user\x18\x01 \x01(\v2\x10.system.UserInfoR\x04user\",\n" + + "\x12GetUserByOpenIdReq\x12\x16\n" + + "\x06openId\x18\x01 \x01(\tR\x06openId\";\n" + + "\x13GetUserByOpenIdResp\x12$\n" + + "\x04user\x18\x01 \x01(\v2\x10.system.UserInfoR\x04user\"\xc3\x01\n" + + "\rCreateUserReq\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x02 \x01(\tR\aaccount\x12\x1a\n" + + "\bpassword\x18\x03 \x01(\tR\bpassword\x12\x16\n" + + "\x06openId\x18\x04 \x01(\tR\x06openId\x12\x1e\n" + + "\n" + + "sessionKey\x18\x05 \x01(\tR\n" + + "sessionKey\x12\x1a\n" + + "\bclientId\x18\x06 \x01(\tR\bclientId\x12\x14\n" + + "\x05phone\x18\a \x01(\tR\x05phone\"6\n" + + "\x0eCreateUserResp\x12$\n" + + "\x04user\x18\x01 \x01(\v2\x10.system.UserInfoR\x04user\"\x9b\x01\n" + + "\rUpdateUserReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x03 \x01(\tR\aaccount\x12\x14\n" + + "\x05phone\x18\x04 \x01(\tR\x05phone\x12\x1a\n" + + "\bavatarId\x18\x05 \x01(\tR\bavatarId\x12\x1a\n" + + "\bnickName\x18\x06 \x01(\tR\bnickName\"I\n" + + "\x11LoginByAccountReq\x12\x18\n" + + "\aaccount\x18\x01 \x01(\tR\aaccount\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\":\n" + + "\x12LoginByAccountResp\x12$\n" + + "\x04user\x18\x01 \x01(\v2\x10.system.UserInfoR\x04user\"t\n" + + "\x0eGetUserListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x04 \x01(\tR\aaccount\"M\n" + + "\x0fGetUserListResp\x12$\n" + + "\x04list\x18\x01 \x03(\v2\x10.system.UserInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"!\n" + + "\rDeleteUserReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\">\n" + + "\x10ResetPasswordReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"-\n" + "\x13GetRolesByUserIdReq\x12\x16\n" + "\x06userId\x18\x01 \x01(\tR\x06userId\">\n" + "\x14GetRolesByUserIdResp\x12&\n" + @@ -2309,8 +3473,19 @@ const file_pb_system_proto_rawDesc = "" + "\x10GetClientByIdReq\x12\x1a\n" + "\bclientId\x18\x01 \x01(\tR\bclientId\"?\n" + "\x11GetClientByIdResp\x12*\n" + - "\x06client\x18\x01 \x01(\v2\x12.system.ClientInfoR\x06client2\xf5\t\n" + - "\rSystemService\x12M\n" + + "\x06client\x18\x01 \x01(\v2\x12.system.ClientInfoR\x06client2\xc7\x0e\n" + + "\rSystemService\x12>\n" + + "\vGetUserById\x12\x16.system.GetUserByIdReq\x1a\x17.system.GetUserByIdResp\x12J\n" + + "\x0fGetUserByOpenId\x12\x1a.system.GetUserByOpenIdReq\x1a\x1b.system.GetUserByOpenIdResp\x12G\n" + + "\x0eLoginByAccount\x12\x19.system.LoginByAccountReq\x1a\x1a.system.LoginByAccountResp\x12;\n" + + "\n" + + "CreateUser\x12\x15.system.CreateUserReq\x1a\x16.system.CreateUserResp\x127\n" + + "\n" + + "UpdateUser\x12\x15.system.UpdateUserReq\x1a\x12.system.CommonResp\x12>\n" + + "\vGetUserList\x12\x16.system.GetUserListReq\x1a\x17.system.GetUserListResp\x127\n" + + "\n" + + "DeleteUser\x12\x15.system.DeleteUserReq\x1a\x12.system.CommonResp\x12=\n" + + "\rResetPassword\x12\x18.system.ResetPasswordReq\x1a\x12.system.CommonResp\x12M\n" + "\x10GetRolesByUserId\x12\x1b.system.GetRolesByUserIdReq\x1a\x1c.system.GetRolesByUserIdResp\x121\n" + "\n" + "CreateRole\x12\x0f.system.RoleReq\x1a\x12.system.CommonResp\x127\n" + @@ -2338,7 +3513,8 @@ const file_pb_system_proto_rawDesc = "" + "UpdateDict\x12\x15.system.DictUpdateReq\x1a\x12.system.CommonResp\x120\n" + "\n" + "DeleteDict\x12\x0e.system.IdsReq\x1a\x12.system.CommonResp\x128\n" + - "\vGetDictList\x12\x13.system.DictListReq\x1a\x14.system.DictListResp\x12;\n" + + "\vGetDictList\x12\x13.system.DictListReq\x1a\x14.system.DictListResp\x12M\n" + + "\x15CreateOperationRecord\x12 .system.CreateOperationRecordReq\x1a\x12.system.CommonResp\x12;\n" + "\x15DeleteOperationRecord\x12\x0e.system.IdsReq\x1a\x12.system.CommonResp\x12Y\n" + "\x16GetOperationRecordList\x12\x1e.system.OperationRecordListReq\x1a\x1f.system.OperationRecordListRespB\n" + "Z\b./systemb\x06proto3" @@ -2355,39 +3531,54 @@ func file_pb_system_proto_rawDescGZIP() []byte { return file_pb_system_proto_rawDescData } -var file_pb_system_proto_msgTypes = make([]protoimpl.MessageInfo, 31) +var file_pb_system_proto_msgTypes = make([]protoimpl.MessageInfo, 46) var file_pb_system_proto_goTypes = []any{ - (*CommonResp)(nil), // 0: system.CommonResp - (*IdReq)(nil), // 1: system.IdReq - (*IdsReq)(nil), // 2: system.IdsReq - (*RoleInfo)(nil), // 3: system.RoleInfo - (*RoleReq)(nil), // 4: system.RoleReq - (*RoleUpdateReq)(nil), // 5: system.RoleUpdateReq - (*RoleListReq)(nil), // 6: system.RoleListReq - (*RoleListResp)(nil), // 7: system.RoleListResp - (*MenuInfo)(nil), // 8: system.MenuInfo - (*MenuReq)(nil), // 9: system.MenuReq - (*MenuUpdateReq)(nil), // 10: system.MenuUpdateReq - (*MenuListResp)(nil), // 11: system.MenuListResp - (*ClientInfo)(nil), // 12: system.ClientInfo - (*ClientReq)(nil), // 13: system.ClientReq - (*ClientUpdateReq)(nil), // 14: system.ClientUpdateReq - (*ClientListReq)(nil), // 15: system.ClientListReq - (*ClientListResp)(nil), // 16: system.ClientListResp - (*DictInfo)(nil), // 17: system.DictInfo - (*DictReq)(nil), // 18: system.DictReq - (*DictUpdateReq)(nil), // 19: system.DictUpdateReq - (*DictListReq)(nil), // 20: system.DictListReq - (*DictListResp)(nil), // 21: system.DictListResp - (*OperationRecordInfo)(nil), // 22: system.OperationRecordInfo - (*OperationRecordListReq)(nil), // 23: system.OperationRecordListReq - (*OperationRecordListResp)(nil), // 24: system.OperationRecordListResp - (*GetRolesByUserIdReq)(nil), // 25: system.GetRolesByUserIdReq - (*GetRolesByUserIdResp)(nil), // 26: system.GetRolesByUserIdResp - (*GetMenusByRoleIdReq)(nil), // 27: system.GetMenusByRoleIdReq - (*GetMenusByRoleIdResp)(nil), // 28: system.GetMenusByRoleIdResp - (*GetClientByIdReq)(nil), // 29: system.GetClientByIdReq - (*GetClientByIdResp)(nil), // 30: system.GetClientByIdResp + (*CommonResp)(nil), // 0: system.CommonResp + (*IdReq)(nil), // 1: system.IdReq + (*IdsReq)(nil), // 2: system.IdsReq + (*RoleInfo)(nil), // 3: system.RoleInfo + (*RoleReq)(nil), // 4: system.RoleReq + (*RoleUpdateReq)(nil), // 5: system.RoleUpdateReq + (*RoleListReq)(nil), // 6: system.RoleListReq + (*RoleListResp)(nil), // 7: system.RoleListResp + (*MenuInfo)(nil), // 8: system.MenuInfo + (*MenuReq)(nil), // 9: system.MenuReq + (*MenuUpdateReq)(nil), // 10: system.MenuUpdateReq + (*MenuListResp)(nil), // 11: system.MenuListResp + (*ClientInfo)(nil), // 12: system.ClientInfo + (*ClientReq)(nil), // 13: system.ClientReq + (*ClientUpdateReq)(nil), // 14: system.ClientUpdateReq + (*ClientListReq)(nil), // 15: system.ClientListReq + (*ClientListResp)(nil), // 16: system.ClientListResp + (*DictInfo)(nil), // 17: system.DictInfo + (*DictReq)(nil), // 18: system.DictReq + (*DictUpdateReq)(nil), // 19: system.DictUpdateReq + (*DictListReq)(nil), // 20: system.DictListReq + (*DictListResp)(nil), // 21: system.DictListResp + (*OperationRecordInfo)(nil), // 22: system.OperationRecordInfo + (*CreateOperationRecordReq)(nil), // 23: system.CreateOperationRecordReq + (*OperationRecordListReq)(nil), // 24: system.OperationRecordListReq + (*OperationRecordListResp)(nil), // 25: system.OperationRecordListResp + (*UserInfo)(nil), // 26: system.UserInfo + (*GetUserByIdReq)(nil), // 27: system.GetUserByIdReq + (*GetUserByIdResp)(nil), // 28: system.GetUserByIdResp + (*GetUserByOpenIdReq)(nil), // 29: system.GetUserByOpenIdReq + (*GetUserByOpenIdResp)(nil), // 30: system.GetUserByOpenIdResp + (*CreateUserReq)(nil), // 31: system.CreateUserReq + (*CreateUserResp)(nil), // 32: system.CreateUserResp + (*UpdateUserReq)(nil), // 33: system.UpdateUserReq + (*LoginByAccountReq)(nil), // 34: system.LoginByAccountReq + (*LoginByAccountResp)(nil), // 35: system.LoginByAccountResp + (*GetUserListReq)(nil), // 36: system.GetUserListReq + (*GetUserListResp)(nil), // 37: system.GetUserListResp + (*DeleteUserReq)(nil), // 38: system.DeleteUserReq + (*ResetPasswordReq)(nil), // 39: system.ResetPasswordReq + (*GetRolesByUserIdReq)(nil), // 40: system.GetRolesByUserIdReq + (*GetRolesByUserIdResp)(nil), // 41: system.GetRolesByUserIdResp + (*GetMenusByRoleIdReq)(nil), // 42: system.GetMenusByRoleIdReq + (*GetMenusByRoleIdResp)(nil), // 43: system.GetMenusByRoleIdResp + (*GetClientByIdReq)(nil), // 44: system.GetClientByIdReq + (*GetClientByIdResp)(nil), // 45: system.GetClientByIdResp } var file_pb_system_proto_depIdxs = []int32{ 3, // 0: system.RoleListResp.list:type_name -> system.RoleInfo @@ -2396,56 +3587,79 @@ var file_pb_system_proto_depIdxs = []int32{ 12, // 3: system.ClientListResp.list:type_name -> system.ClientInfo 17, // 4: system.DictListResp.list:type_name -> system.DictInfo 22, // 5: system.OperationRecordListResp.list:type_name -> system.OperationRecordInfo - 3, // 6: system.GetRolesByUserIdResp.roles:type_name -> system.RoleInfo - 8, // 7: system.GetMenusByRoleIdResp.menus:type_name -> system.MenuInfo - 12, // 8: system.GetClientByIdResp.client:type_name -> system.ClientInfo - 25, // 9: system.SystemService.GetRolesByUserId:input_type -> system.GetRolesByUserIdReq - 4, // 10: system.SystemService.CreateRole:input_type -> system.RoleReq - 5, // 11: system.SystemService.UpdateRole:input_type -> system.RoleUpdateReq - 2, // 12: system.SystemService.DeleteRole:input_type -> system.IdsReq - 6, // 13: system.SystemService.GetRoleList:input_type -> system.RoleListReq - 27, // 14: system.SystemService.GetMenusByRoleId:input_type -> system.GetMenusByRoleIdReq - 9, // 15: system.SystemService.CreateMenu:input_type -> system.MenuReq - 10, // 16: system.SystemService.UpdateMenu:input_type -> system.MenuUpdateReq - 2, // 17: system.SystemService.DeleteMenu:input_type -> system.IdsReq - 1, // 18: system.SystemService.GetMenuList:input_type -> system.IdReq - 29, // 19: system.SystemService.GetClientById:input_type -> system.GetClientByIdReq - 13, // 20: system.SystemService.CreateClient:input_type -> system.ClientReq - 14, // 21: system.SystemService.UpdateClient:input_type -> system.ClientUpdateReq - 2, // 22: system.SystemService.DeleteClient:input_type -> system.IdsReq - 15, // 23: system.SystemService.GetClientList:input_type -> system.ClientListReq - 18, // 24: system.SystemService.CreateDict:input_type -> system.DictReq - 19, // 25: system.SystemService.UpdateDict:input_type -> system.DictUpdateReq - 2, // 26: system.SystemService.DeleteDict:input_type -> system.IdsReq - 20, // 27: system.SystemService.GetDictList:input_type -> system.DictListReq - 2, // 28: system.SystemService.DeleteOperationRecord:input_type -> system.IdsReq - 23, // 29: system.SystemService.GetOperationRecordList:input_type -> system.OperationRecordListReq - 26, // 30: system.SystemService.GetRolesByUserId:output_type -> system.GetRolesByUserIdResp - 0, // 31: system.SystemService.CreateRole:output_type -> system.CommonResp - 0, // 32: system.SystemService.UpdateRole:output_type -> system.CommonResp - 0, // 33: system.SystemService.DeleteRole:output_type -> system.CommonResp - 7, // 34: system.SystemService.GetRoleList:output_type -> system.RoleListResp - 28, // 35: system.SystemService.GetMenusByRoleId:output_type -> system.GetMenusByRoleIdResp - 0, // 36: system.SystemService.CreateMenu:output_type -> system.CommonResp - 0, // 37: system.SystemService.UpdateMenu:output_type -> system.CommonResp - 0, // 38: system.SystemService.DeleteMenu:output_type -> system.CommonResp - 11, // 39: system.SystemService.GetMenuList:output_type -> system.MenuListResp - 30, // 40: system.SystemService.GetClientById:output_type -> system.GetClientByIdResp - 0, // 41: system.SystemService.CreateClient:output_type -> system.CommonResp - 0, // 42: system.SystemService.UpdateClient:output_type -> system.CommonResp - 0, // 43: system.SystemService.DeleteClient:output_type -> system.CommonResp - 16, // 44: system.SystemService.GetClientList:output_type -> system.ClientListResp - 0, // 45: system.SystemService.CreateDict:output_type -> system.CommonResp - 0, // 46: system.SystemService.UpdateDict:output_type -> system.CommonResp - 0, // 47: system.SystemService.DeleteDict:output_type -> system.CommonResp - 21, // 48: system.SystemService.GetDictList:output_type -> system.DictListResp - 0, // 49: system.SystemService.DeleteOperationRecord:output_type -> system.CommonResp - 24, // 50: system.SystemService.GetOperationRecordList:output_type -> system.OperationRecordListResp - 30, // [30:51] is the sub-list for method output_type - 9, // [9:30] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 26, // 6: system.GetUserByIdResp.user:type_name -> system.UserInfo + 26, // 7: system.GetUserByOpenIdResp.user:type_name -> system.UserInfo + 26, // 8: system.CreateUserResp.user:type_name -> system.UserInfo + 26, // 9: system.LoginByAccountResp.user:type_name -> system.UserInfo + 26, // 10: system.GetUserListResp.list:type_name -> system.UserInfo + 3, // 11: system.GetRolesByUserIdResp.roles:type_name -> system.RoleInfo + 8, // 12: system.GetMenusByRoleIdResp.menus:type_name -> system.MenuInfo + 12, // 13: system.GetClientByIdResp.client:type_name -> system.ClientInfo + 27, // 14: system.SystemService.GetUserById:input_type -> system.GetUserByIdReq + 29, // 15: system.SystemService.GetUserByOpenId:input_type -> system.GetUserByOpenIdReq + 34, // 16: system.SystemService.LoginByAccount:input_type -> system.LoginByAccountReq + 31, // 17: system.SystemService.CreateUser:input_type -> system.CreateUserReq + 33, // 18: system.SystemService.UpdateUser:input_type -> system.UpdateUserReq + 36, // 19: system.SystemService.GetUserList:input_type -> system.GetUserListReq + 38, // 20: system.SystemService.DeleteUser:input_type -> system.DeleteUserReq + 39, // 21: system.SystemService.ResetPassword:input_type -> system.ResetPasswordReq + 40, // 22: system.SystemService.GetRolesByUserId:input_type -> system.GetRolesByUserIdReq + 4, // 23: system.SystemService.CreateRole:input_type -> system.RoleReq + 5, // 24: system.SystemService.UpdateRole:input_type -> system.RoleUpdateReq + 2, // 25: system.SystemService.DeleteRole:input_type -> system.IdsReq + 6, // 26: system.SystemService.GetRoleList:input_type -> system.RoleListReq + 42, // 27: system.SystemService.GetMenusByRoleId:input_type -> system.GetMenusByRoleIdReq + 9, // 28: system.SystemService.CreateMenu:input_type -> system.MenuReq + 10, // 29: system.SystemService.UpdateMenu:input_type -> system.MenuUpdateReq + 2, // 30: system.SystemService.DeleteMenu:input_type -> system.IdsReq + 1, // 31: system.SystemService.GetMenuList:input_type -> system.IdReq + 44, // 32: system.SystemService.GetClientById:input_type -> system.GetClientByIdReq + 13, // 33: system.SystemService.CreateClient:input_type -> system.ClientReq + 14, // 34: system.SystemService.UpdateClient:input_type -> system.ClientUpdateReq + 2, // 35: system.SystemService.DeleteClient:input_type -> system.IdsReq + 15, // 36: system.SystemService.GetClientList:input_type -> system.ClientListReq + 18, // 37: system.SystemService.CreateDict:input_type -> system.DictReq + 19, // 38: system.SystemService.UpdateDict:input_type -> system.DictUpdateReq + 2, // 39: system.SystemService.DeleteDict:input_type -> system.IdsReq + 20, // 40: system.SystemService.GetDictList:input_type -> system.DictListReq + 23, // 41: system.SystemService.CreateOperationRecord:input_type -> system.CreateOperationRecordReq + 2, // 42: system.SystemService.DeleteOperationRecord:input_type -> system.IdsReq + 24, // 43: system.SystemService.GetOperationRecordList:input_type -> system.OperationRecordListReq + 28, // 44: system.SystemService.GetUserById:output_type -> system.GetUserByIdResp + 30, // 45: system.SystemService.GetUserByOpenId:output_type -> system.GetUserByOpenIdResp + 35, // 46: system.SystemService.LoginByAccount:output_type -> system.LoginByAccountResp + 32, // 47: system.SystemService.CreateUser:output_type -> system.CreateUserResp + 0, // 48: system.SystemService.UpdateUser:output_type -> system.CommonResp + 37, // 49: system.SystemService.GetUserList:output_type -> system.GetUserListResp + 0, // 50: system.SystemService.DeleteUser:output_type -> system.CommonResp + 0, // 51: system.SystemService.ResetPassword:output_type -> system.CommonResp + 41, // 52: system.SystemService.GetRolesByUserId:output_type -> system.GetRolesByUserIdResp + 0, // 53: system.SystemService.CreateRole:output_type -> system.CommonResp + 0, // 54: system.SystemService.UpdateRole:output_type -> system.CommonResp + 0, // 55: system.SystemService.DeleteRole:output_type -> system.CommonResp + 7, // 56: system.SystemService.GetRoleList:output_type -> system.RoleListResp + 43, // 57: system.SystemService.GetMenusByRoleId:output_type -> system.GetMenusByRoleIdResp + 0, // 58: system.SystemService.CreateMenu:output_type -> system.CommonResp + 0, // 59: system.SystemService.UpdateMenu:output_type -> system.CommonResp + 0, // 60: system.SystemService.DeleteMenu:output_type -> system.CommonResp + 11, // 61: system.SystemService.GetMenuList:output_type -> system.MenuListResp + 45, // 62: system.SystemService.GetClientById:output_type -> system.GetClientByIdResp + 0, // 63: system.SystemService.CreateClient:output_type -> system.CommonResp + 0, // 64: system.SystemService.UpdateClient:output_type -> system.CommonResp + 0, // 65: system.SystemService.DeleteClient:output_type -> system.CommonResp + 16, // 66: system.SystemService.GetClientList:output_type -> system.ClientListResp + 0, // 67: system.SystemService.CreateDict:output_type -> system.CommonResp + 0, // 68: system.SystemService.UpdateDict:output_type -> system.CommonResp + 0, // 69: system.SystemService.DeleteDict:output_type -> system.CommonResp + 21, // 70: system.SystemService.GetDictList:output_type -> system.DictListResp + 0, // 71: system.SystemService.CreateOperationRecord:output_type -> system.CommonResp + 0, // 72: system.SystemService.DeleteOperationRecord:output_type -> system.CommonResp + 25, // 73: system.SystemService.GetOperationRecordList:output_type -> system.OperationRecordListResp + 44, // [44:74] is the sub-list for method output_type + 14, // [14:44] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_pb_system_proto_init() } @@ -2459,7 +3673,7 @@ func file_pb_system_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_system_proto_rawDesc), len(file_pb_system_proto_rawDesc)), NumEnums: 0, - NumMessages: 31, + NumMessages: 46, NumExtensions: 0, NumServices: 1, }, diff --git a/app/system/rpc/system/system_grpc.pb.go b/app/system/rpc/system/system_grpc.pb.go index 05fb1a2..3c431e2 100644 --- a/app/system/rpc/system/system_grpc.pb.go +++ b/app/system/rpc/system/system_grpc.pb.go @@ -19,6 +19,14 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + SystemService_GetUserById_FullMethodName = "/system.SystemService/GetUserById" + SystemService_GetUserByOpenId_FullMethodName = "/system.SystemService/GetUserByOpenId" + SystemService_LoginByAccount_FullMethodName = "/system.SystemService/LoginByAccount" + SystemService_CreateUser_FullMethodName = "/system.SystemService/CreateUser" + SystemService_UpdateUser_FullMethodName = "/system.SystemService/UpdateUser" + SystemService_GetUserList_FullMethodName = "/system.SystemService/GetUserList" + SystemService_DeleteUser_FullMethodName = "/system.SystemService/DeleteUser" + SystemService_ResetPassword_FullMethodName = "/system.SystemService/ResetPassword" SystemService_GetRolesByUserId_FullMethodName = "/system.SystemService/GetRolesByUserId" SystemService_CreateRole_FullMethodName = "/system.SystemService/CreateRole" SystemService_UpdateRole_FullMethodName = "/system.SystemService/UpdateRole" @@ -38,6 +46,7 @@ const ( SystemService_UpdateDict_FullMethodName = "/system.SystemService/UpdateDict" SystemService_DeleteDict_FullMethodName = "/system.SystemService/DeleteDict" SystemService_GetDictList_FullMethodName = "/system.SystemService/GetDictList" + SystemService_CreateOperationRecord_FullMethodName = "/system.SystemService/CreateOperationRecord" SystemService_DeleteOperationRecord_FullMethodName = "/system.SystemService/DeleteOperationRecord" SystemService_GetOperationRecordList_FullMethodName = "/system.SystemService/GetOperationRecordList" ) @@ -46,6 +55,15 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SystemServiceClient interface { + // --- 用户 --- + GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) + GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) + LoginByAccount(ctx context.Context, in *LoginByAccountReq, opts ...grpc.CallOption) (*LoginByAccountResp, error) + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) + GetUserList(ctx context.Context, in *GetUserListReq, opts ...grpc.CallOption) (*GetUserListResp, error) + DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*CommonResp, error) + ResetPassword(ctx context.Context, in *ResetPasswordReq, opts ...grpc.CallOption) (*CommonResp, error) // --- 角色 --- GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error) @@ -70,6 +88,7 @@ type SystemServiceClient interface { DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error) // --- 操作日志 --- + CreateOperationRecord(ctx context.Context, in *CreateOperationRecordReq, opts ...grpc.CallOption) (*CommonResp, error) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error) } @@ -82,6 +101,86 @@ func NewSystemServiceClient(cc grpc.ClientConnInterface) SystemServiceClient { return &systemServiceClient{cc} } +func (c *systemServiceClient) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserByIdResp) + err := c.cc.Invoke(ctx, SystemService_GetUserById_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserByOpenIdResp) + err := c.cc.Invoke(ctx, SystemService_GetUserByOpenId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) LoginByAccount(ctx context.Context, in *LoginByAccountReq, opts ...grpc.CallOption) (*LoginByAccountResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LoginByAccountResp) + err := c.cc.Invoke(ctx, SystemService_LoginByAccount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateUserResp) + err := c.cc.Invoke(ctx, SystemService_CreateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommonResp) + err := c.cc.Invoke(ctx, SystemService_UpdateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetUserList(ctx context.Context, in *GetUserListReq, opts ...grpc.CallOption) (*GetUserListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserListResp) + err := c.cc.Invoke(ctx, SystemService_GetUserList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommonResp) + err := c.cc.Invoke(ctx, SystemService_DeleteUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ResetPassword(ctx context.Context, in *ResetPasswordReq, opts ...grpc.CallOption) (*CommonResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommonResp) + err := c.cc.Invoke(ctx, SystemService_ResetPassword_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *systemServiceClient) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetRolesByUserIdResp) @@ -272,6 +371,16 @@ func (c *systemServiceClient) GetDictList(ctx context.Context, in *DictListReq, return out, nil } +func (c *systemServiceClient) CreateOperationRecord(ctx context.Context, in *CreateOperationRecordReq, opts ...grpc.CallOption) (*CommonResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommonResp) + err := c.cc.Invoke(ctx, SystemService_CreateOperationRecord_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *systemServiceClient) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CommonResp) @@ -296,6 +405,15 @@ func (c *systemServiceClient) GetOperationRecordList(ctx context.Context, in *Op // All implementations must embed UnimplementedSystemServiceServer // for forward compatibility. type SystemServiceServer interface { + // --- 用户 --- + GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) + GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) + LoginByAccount(context.Context, *LoginByAccountReq) (*LoginByAccountResp, error) + CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) + UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) + GetUserList(context.Context, *GetUserListReq) (*GetUserListResp, error) + DeleteUser(context.Context, *DeleteUserReq) (*CommonResp, error) + ResetPassword(context.Context, *ResetPasswordReq) (*CommonResp, error) // --- 角色 --- GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) CreateRole(context.Context, *RoleReq) (*CommonResp, error) @@ -320,6 +438,7 @@ type SystemServiceServer interface { DeleteDict(context.Context, *IdsReq) (*CommonResp, error) GetDictList(context.Context, *DictListReq) (*DictListResp, error) // --- 操作日志 --- + CreateOperationRecord(context.Context, *CreateOperationRecordReq) (*CommonResp, error) DeleteOperationRecord(context.Context, *IdsReq) (*CommonResp, error) GetOperationRecordList(context.Context, *OperationRecordListReq) (*OperationRecordListResp, error) mustEmbedUnimplementedSystemServiceServer() @@ -332,6 +451,30 @@ type SystemServiceServer interface { // pointer dereference when methods are called. type UnimplementedSystemServiceServer struct{} +func (UnimplementedSystemServiceServer) GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserById not implemented") +} +func (UnimplementedSystemServiceServer) GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserByOpenId not implemented") +} +func (UnimplementedSystemServiceServer) LoginByAccount(context.Context, *LoginByAccountReq) (*LoginByAccountResp, error) { + return nil, status.Error(codes.Unimplemented, "method LoginByAccount not implemented") +} +func (UnimplementedSystemServiceServer) CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedSystemServiceServer) UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedSystemServiceServer) GetUserList(context.Context, *GetUserListReq) (*GetUserListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserList not implemented") +} +func (UnimplementedSystemServiceServer) DeleteUser(context.Context, *DeleteUserReq) (*CommonResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedSystemServiceServer) ResetPassword(context.Context, *ResetPasswordReq) (*CommonResp, error) { + return nil, status.Error(codes.Unimplemented, "method ResetPassword not implemented") +} func (UnimplementedSystemServiceServer) GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) { return nil, status.Error(codes.Unimplemented, "method GetRolesByUserId not implemented") } @@ -389,6 +532,9 @@ func (UnimplementedSystemServiceServer) DeleteDict(context.Context, *IdsReq) (*C func (UnimplementedSystemServiceServer) GetDictList(context.Context, *DictListReq) (*DictListResp, error) { return nil, status.Error(codes.Unimplemented, "method GetDictList not implemented") } +func (UnimplementedSystemServiceServer) CreateOperationRecord(context.Context, *CreateOperationRecordReq) (*CommonResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateOperationRecord not implemented") +} func (UnimplementedSystemServiceServer) DeleteOperationRecord(context.Context, *IdsReq) (*CommonResp, error) { return nil, status.Error(codes.Unimplemented, "method DeleteOperationRecord not implemented") } @@ -416,6 +562,150 @@ func RegisterSystemServiceServer(s grpc.ServiceRegistrar, srv SystemServiceServe s.RegisterService(&SystemService_ServiceDesc, srv) } +func _SystemService_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetUserById(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetUserById_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetUserById(ctx, req.(*GetUserByIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetUserByOpenId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByOpenIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetUserByOpenId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetUserByOpenId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetUserByOpenId(ctx, req.(*GetUserByOpenIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_LoginByAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginByAccountReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).LoginByAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_LoginByAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).LoginByAccount(ctx, req.(*LoginByAccountReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateUser(ctx, req.(*CreateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_UpdateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateUser(ctx, req.(*UpdateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetUserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetUserList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetUserList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetUserList(ctx, req.(*GetUserListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_DeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).DeleteUser(ctx, req.(*DeleteUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ResetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResetPasswordReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ResetPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_ResetPassword_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ResetPassword(ctx, req.(*ResetPasswordReq)) + } + return interceptor(ctx, in, info, handler) +} + func _SystemService_GetRolesByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetRolesByUserIdReq) if err := dec(in); err != nil { @@ -758,6 +1048,24 @@ func _SystemService_GetDictList_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _SystemService_CreateOperationRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOperationRecordReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateOperationRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_CreateOperationRecord_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateOperationRecord(ctx, req.(*CreateOperationRecordReq)) + } + return interceptor(ctx, in, info, handler) +} + func _SystemService_DeleteOperationRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(IdsReq) if err := dec(in); err != nil { @@ -801,6 +1109,38 @@ var SystemService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "system.SystemService", HandlerType: (*SystemServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "GetUserById", + Handler: _SystemService_GetUserById_Handler, + }, + { + MethodName: "GetUserByOpenId", + Handler: _SystemService_GetUserByOpenId_Handler, + }, + { + MethodName: "LoginByAccount", + Handler: _SystemService_LoginByAccount_Handler, + }, + { + MethodName: "CreateUser", + Handler: _SystemService_CreateUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _SystemService_UpdateUser_Handler, + }, + { + MethodName: "GetUserList", + Handler: _SystemService_GetUserList_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _SystemService_DeleteUser_Handler, + }, + { + MethodName: "ResetPassword", + Handler: _SystemService_ResetPassword_Handler, + }, { MethodName: "GetRolesByUserId", Handler: _SystemService_GetRolesByUserId_Handler, @@ -877,6 +1217,10 @@ var SystemService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetDictList", Handler: _SystemService_GetDictList_Handler, }, + { + MethodName: "CreateOperationRecord", + Handler: _SystemService_CreateOperationRecord_Handler, + }, { MethodName: "DeleteOperationRecord", Handler: _SystemService_DeleteOperationRecord_Handler, diff --git a/app/system/rpc/systemservice/systemService.go b/app/system/rpc/systemservice/systemService.go index 58d6ee8..804edbe 100644 --- a/app/system/rpc/systemservice/systemService.go +++ b/app/system/rpc/systemservice/systemService.go @@ -14,39 +14,63 @@ import ( ) type ( - ClientInfo = system.ClientInfo - ClientListReq = system.ClientListReq - ClientListResp = system.ClientListResp - ClientReq = system.ClientReq - ClientUpdateReq = system.ClientUpdateReq - CommonResp = system.CommonResp - DictInfo = system.DictInfo - DictListReq = system.DictListReq - DictListResp = system.DictListResp - DictReq = system.DictReq - DictUpdateReq = system.DictUpdateReq - GetClientByIdReq = system.GetClientByIdReq - GetClientByIdResp = system.GetClientByIdResp - GetMenusByRoleIdReq = system.GetMenusByRoleIdReq - GetMenusByRoleIdResp = system.GetMenusByRoleIdResp - GetRolesByUserIdReq = system.GetRolesByUserIdReq - GetRolesByUserIdResp = system.GetRolesByUserIdResp - IdReq = system.IdReq - IdsReq = system.IdsReq - MenuInfo = system.MenuInfo - MenuListResp = system.MenuListResp - MenuReq = system.MenuReq - MenuUpdateReq = system.MenuUpdateReq - OperationRecordInfo = system.OperationRecordInfo - OperationRecordListReq = system.OperationRecordListReq - OperationRecordListResp = system.OperationRecordListResp - RoleInfo = system.RoleInfo - RoleListReq = system.RoleListReq - RoleListResp = system.RoleListResp - RoleReq = system.RoleReq - RoleUpdateReq = system.RoleUpdateReq + ClientInfo = system.ClientInfo + ClientListReq = system.ClientListReq + ClientListResp = system.ClientListResp + ClientReq = system.ClientReq + ClientUpdateReq = system.ClientUpdateReq + CommonResp = system.CommonResp + CreateOperationRecordReq = system.CreateOperationRecordReq + CreateUserReq = system.CreateUserReq + CreateUserResp = system.CreateUserResp + DeleteUserReq = system.DeleteUserReq + DictInfo = system.DictInfo + DictListReq = system.DictListReq + DictListResp = system.DictListResp + DictReq = system.DictReq + DictUpdateReq = system.DictUpdateReq + GetClientByIdReq = system.GetClientByIdReq + GetClientByIdResp = system.GetClientByIdResp + GetMenusByRoleIdReq = system.GetMenusByRoleIdReq + GetMenusByRoleIdResp = system.GetMenusByRoleIdResp + GetRolesByUserIdReq = system.GetRolesByUserIdReq + GetRolesByUserIdResp = system.GetRolesByUserIdResp + GetUserByIdReq = system.GetUserByIdReq + GetUserByIdResp = system.GetUserByIdResp + GetUserByOpenIdReq = system.GetUserByOpenIdReq + GetUserByOpenIdResp = system.GetUserByOpenIdResp + GetUserListReq = system.GetUserListReq + GetUserListResp = system.GetUserListResp + IdReq = system.IdReq + IdsReq = system.IdsReq + LoginByAccountReq = system.LoginByAccountReq + LoginByAccountResp = system.LoginByAccountResp + MenuInfo = system.MenuInfo + MenuListResp = system.MenuListResp + MenuReq = system.MenuReq + MenuUpdateReq = system.MenuUpdateReq + OperationRecordInfo = system.OperationRecordInfo + OperationRecordListReq = system.OperationRecordListReq + OperationRecordListResp = system.OperationRecordListResp + ResetPasswordReq = system.ResetPasswordReq + RoleInfo = system.RoleInfo + RoleListReq = system.RoleListReq + RoleListResp = system.RoleListResp + RoleReq = system.RoleReq + RoleUpdateReq = system.RoleUpdateReq + UpdateUserReq = system.UpdateUserReq + UserInfo = system.UserInfo SystemService interface { + // --- 用户 --- + GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) + GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) + LoginByAccount(ctx context.Context, in *LoginByAccountReq, opts ...grpc.CallOption) (*LoginByAccountResp, error) + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) + GetUserList(ctx context.Context, in *GetUserListReq, opts ...grpc.CallOption) (*GetUserListResp, error) + DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*CommonResp, error) + ResetPassword(ctx context.Context, in *ResetPasswordReq, opts ...grpc.CallOption) (*CommonResp, error) // --- 角色 --- GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error) @@ -71,6 +95,7 @@ type ( DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error) // --- 操作日志 --- + CreateOperationRecord(ctx context.Context, in *CreateOperationRecordReq, opts ...grpc.CallOption) (*CommonResp, error) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error) } @@ -86,6 +111,47 @@ func NewSystemService(cli zrpc.Client) SystemService { } } +// --- 用户 --- +func (m *defaultSystemService) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetUserById(ctx, in, opts...) +} + +func (m *defaultSystemService) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetUserByOpenId(ctx, in, opts...) +} + +func (m *defaultSystemService) LoginByAccount(ctx context.Context, in *LoginByAccountReq, opts ...grpc.CallOption) (*LoginByAccountResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.LoginByAccount(ctx, in, opts...) +} + +func (m *defaultSystemService) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.CreateUser(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateUser(ctx, in, opts...) +} + +func (m *defaultSystemService) GetUserList(ctx context.Context, in *GetUserListReq, opts ...grpc.CallOption) (*GetUserListResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetUserList(ctx, in, opts...) +} + +func (m *defaultSystemService) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.DeleteUser(ctx, in, opts...) +} + +func (m *defaultSystemService) ResetPassword(ctx context.Context, in *ResetPasswordReq, opts ...grpc.CallOption) (*CommonResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.ResetPassword(ctx, in, opts...) +} + // --- 角色 --- func (m *defaultSystemService) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) { client := system.NewSystemServiceClient(m.cli.Conn()) @@ -186,6 +252,11 @@ func (m *defaultSystemService) GetDictList(ctx context.Context, in *DictListReq, } // --- 操作日志 --- +func (m *defaultSystemService) CreateOperationRecord(ctx context.Context, in *CreateOperationRecordReq, opts ...grpc.CallOption) (*CommonResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.CreateOperationRecord(ctx, in, opts...) +} + func (m *defaultSystemService) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) { client := system.NewSystemServiceClient(m.cli.Conn()) return client.DeleteOperationRecord(ctx, in, opts...) diff --git a/app/user/api/internal/logic/auth/loginLogic.go b/app/user/api/internal/logic/auth/loginLogic.go deleted file mode 100644 index 1123bbd..0000000 --- a/app/user/api/internal/logic/auth/loginLogic.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package auth - -import ( - "context" - "fmt" - "time" - - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - "sundynix-micro-go/app/user/rpc/user" - jwtUtil "sundynix-micro-go/common/utils/jwt" - - jwtv5 "github.com/golang-jwt/jwt/v5" - "github.com/zeromicro/go-zero/core/logx" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type LoginLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic { - return &LoginLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *LoginLogic) Login(req *types.LoginReq) (resp *types.LoginResp, err error) { - // 通过 user-rpc 查询用户 (account登录暂用GetUserByOpenId的方式,后续需补充account查询RPC) - // 这里简化处理:直接在api层查询并验证密码 - // TODO: 后续应该在user-rpc中增加LoginByAccount方法 - - _ = req - _ = l - - return nil, status.Error(codes.Unimplemented, "账号密码登录功能开发中") -} - -// generateToken 生成JWT Token的辅助方法 -func generateToken(config svc.ServiceContext, userInfo *user.UserInfo) (string, error) { - j := jwtUtil.NewJWT(config.Config.Auth.AccessSecret) - claims := jwtUtil.CustomClaims{ - BaseClaims: jwtUtil.BaseClaims{ - ID: userInfo.Id, - Account: userInfo.Account, - }, - BufferTime: 3600, - RegisteredClaims: jwtv5.RegisteredClaims{ - Audience: jwtv5.ClaimStrings{"sundynix"}, - NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), - ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(config.Config.Auth.AccessExpire) * time.Second)), - Issuer: "sundynix", - }, - } - token, err := j.CreateToken(claims) - if err != nil { - return "", fmt.Errorf("生成Token失败: %w", err) - } - return token, nil -} diff --git a/app/user/api/internal/logic/user/getUserInfoLogic.go b/app/user/api/internal/logic/user/getUserInfoLogic.go deleted file mode 100644 index 1c3930a..0000000 --- a/app/user/api/internal/logic/user/getUserInfoLogic.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package user - -import ( - "context" - "encoding/json" - "fmt" - - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - pb "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetUserInfoLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { - return &GetUserInfoLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetUserInfoLogic) GetUserInfo() (resp *types.LoginResp, err error) { - // 从JWT claims中获取userId - userId := fmt.Sprintf("%v", l.ctx.Value("userId")) - if userId == "" || userId == "" { - return nil, fmt.Errorf("用户未登录") - } - - userResp, err := l.svcCtx.UserRpc.GetUserById(l.ctx, &pb.GetUserByIdReq{ - Id: userId, - }) - if err != nil { - l.Errorf("获取用户信息失败: %v", err) - return nil, fmt.Errorf("获取用户信息失败") - } - - // 将proto消息转换为map以便JSON序列化 - userJSON, _ := json.Marshal(userResp.User) - var userInfo interface{} - _ = json.Unmarshal(userJSON, &userInfo) - - return &types.LoginResp{ - UserInfo: userInfo, - }, nil -} diff --git a/app/user/api/internal/logic/user/getUserListLogic.go b/app/user/api/internal/logic/user/getUserListLogic.go deleted file mode 100644 index b25e865..0000000 --- a/app/user/api/internal/logic/user/getUserListLogic.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package user - -import ( - "context" - - "sundynix-micro-go/app/user/api/internal/svc" - "sundynix-micro-go/app/user/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type GetUserListLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 用户列表 -func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic { - return &GetUserListLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetUserListLogic) GetUserList(req *types.UserListReq) error { - // todo: add your logic here and delete this line - - return nil -} diff --git a/app/user/api/internal/svc/serviceContext.go b/app/user/api/internal/svc/serviceContext.go deleted file mode 100644 index f1efd7d..0000000 --- a/app/user/api/internal/svc/serviceContext.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.10.1 - -package svc - -import ( - "sundynix-micro-go/app/user/api/internal/config" - "sundynix-micro-go/app/user/rpc/userservice" - - "github.com/zeromicro/go-zero/zrpc" -) - -type ServiceContext struct { - Config config.Config - UserRpc userservice.UserService -} - -func NewServiceContext(c config.Config) *ServiceContext { - return &ServiceContext{ - Config: c, - UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), - } -} diff --git a/app/user/rpc/etc/user.yaml b/app/user/rpc/etc/user.yaml deleted file mode 100644 index 0d480a2..0000000 --- a/app/user/rpc/etc/user.yaml +++ /dev/null @@ -1,29 +0,0 @@ -Name: user.rpc - -Log: - Encoding: plain -ListenOn: 0.0.0.0:9101 -Etcd: - Hosts: - - 192.168.100.127:2379 - Key: user.rpc - -# MySQL -DB: - DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local - -# Redis -Cache: - - Host: 127.0.0.1:6379 - Pass: sundynix - Type: node - -# JWT -JwtAuth: - AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 - AccessExpire: 7200 - -# 微信小程序配置 -WxMini: - AppId: wxb463820bf36dd5d6 - AppSecret: 731784a74c76c6d31fa00bb847af2c7d diff --git a/app/user/rpc/internal/config/config.go b/app/user/rpc/internal/config/config.go deleted file mode 100755 index 7120865..0000000 --- a/app/user/rpc/internal/config/config.go +++ /dev/null @@ -1,23 +0,0 @@ -package config - -import "github.com/zeromicro/go-zero/zrpc" - -type Config struct { - zrpc.RpcServerConf - DB struct { - DataSource string - } - Cache []struct { - Host string - Pass string - Type string - } - JwtAuth struct { - AccessSecret string - AccessExpire int64 - } - WxMini struct { - AppId string - AppSecret string - } -} diff --git a/app/user/rpc/internal/logic/createUserLogic.go b/app/user/rpc/internal/logic/createUserLogic.go deleted file mode 100644 index 979fdc6..0000000 --- a/app/user/rpc/internal/logic/createUserLogic.go +++ /dev/null @@ -1,81 +0,0 @@ -package logic - -import ( - "context" - "errors" - - "sundynix-micro-go/app/user/model" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - "sundynix-micro-go/common/utils/hash" - "sundynix-micro-go/common/utils/uniqueid" - - "github.com/zeromicro/go-zero/core/logx" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gorm.io/gorm" -) - -type CreateUserLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { - return &CreateUserLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 创建用户 -func (l *CreateUserLogic) CreateUser(in *user.CreateUserReq) (*user.CreateUserResp, error) { - // 如果有OpenID,先检查是否存在 - if in.OpenId != "" { - var existing model.SundynixUser - err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&existing).Error - if err == nil { - // 用户已存在,更新session_key - if in.SessionKey != "" { - l.svcCtx.DB.Model(&existing).UpdateColumn("session_key", in.SessionKey) - } - return &user.CreateUserResp{ - User: convertUserToProto(&existing), - }, nil - } - if !errors.Is(err, gorm.ErrRecordNotFound) { - l.Errorf("查询用户失败: %v", err) - return nil, status.Error(codes.Internal, "查询用户失败") - } - } - - // 创建新用户 - name := in.Name - if name == "" { - name = uniqueid.GenerateName("用户") - } - - newUser := model.SundynixUser{ - Name: name, - OpenID: in.OpenId, - SessionKey: in.SessionKey, - ClientID: in.ClientId, - Phone: in.Phone, - } - - // 如果有密码则加密 - if in.Phone != "" { - newUser.Password = hash.BcryptHash(in.Phone) // 默认密码为手机号 - } - - if err := l.svcCtx.DB.Create(&newUser).Error; err != nil { - l.Errorf("创建用户失败: %v", err) - return nil, status.Error(codes.Internal, "创建用户失败") - } - - return &user.CreateUserResp{ - User: convertUserToProto(&newUser), - }, nil -} diff --git a/app/user/rpc/internal/logic/getUserByIdLogic.go b/app/user/rpc/internal/logic/getUserByIdLogic.go deleted file mode 100644 index 989d9dd..0000000 --- a/app/user/rpc/internal/logic/getUserByIdLogic.go +++ /dev/null @@ -1,70 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/user/model" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/logx" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gorm.io/gorm" -) - -type GetUserByIdLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetUserByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByIdLogic { - return &GetUserByIdLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 根据ID获取用户信息 -func (l *GetUserByIdLogic) GetUserById(in *user.GetUserByIdReq) (*user.GetUserByIdResp, error) { - var u model.SundynixUser - err := l.svcCtx.DB.Where("id = ?", in.Id).First(&u).Error - if err != nil { - if err == gorm.ErrRecordNotFound { - return nil, status.Error(codes.NotFound, "用户不存在") - } - l.Errorf("查询用户失败: %v", err) - return nil, status.Error(codes.Internal, "查询用户失败") - } - - return &user.GetUserByIdResp{ - User: convertUserToProto(&u), - }, nil -} - -// convertUserToProto 将GORM模型转换为proto消息 -func convertUserToProto(u *model.SundynixUser) *user.UserInfo { - info := &user.UserInfo{ - Id: u.ID, - TenantId: u.TenantID, - ClientId: u.ClientID, - Name: u.Name, - Account: u.Account, - NickName: u.NickName, - Phone: u.Phone, - SessionKey: u.SessionKey, - UnionId: u.UnionID, - OpenId: u.OpenID, - SaOpenId: u.SaOpenID, - AvatarId: u.AvatarID, - Gender: int32(u.Gender), - CreatedAt: u.CreatedAt.Unix(), - UpdatedAt: u.UpdatedAt.Unix(), - } - if u.LastLoginAt != nil { - info.LastLoginAt = u.LastLoginAt.Unix() - } - return info -} diff --git a/app/user/rpc/internal/logic/getUserByOpenIdLogic.go b/app/user/rpc/internal/logic/getUserByOpenIdLogic.go deleted file mode 100644 index b3f9b2f..0000000 --- a/app/user/rpc/internal/logic/getUserByOpenIdLogic.go +++ /dev/null @@ -1,45 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/user/model" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/logx" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gorm.io/gorm" -) - -type GetUserByOpenIdLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewGetUserByOpenIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByOpenIdLogic { - return &GetUserByOpenIdLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 根据OpenId获取用户信息 -func (l *GetUserByOpenIdLogic) GetUserByOpenId(in *user.GetUserByOpenIdReq) (*user.GetUserByOpenIdResp, error) { - var u model.SundynixUser - err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&u).Error - if err != nil { - if err == gorm.ErrRecordNotFound { - return nil, status.Error(codes.NotFound, "用户不存在") - } - l.Errorf("查询用户失败: %v", err) - return nil, status.Error(codes.Internal, "查询用户失败") - } - - return &user.GetUserByOpenIdResp{ - User: convertUserToProto(&u), - }, nil -} diff --git a/app/user/rpc/internal/logic/updateUserLogic.go b/app/user/rpc/internal/logic/updateUserLogic.go deleted file mode 100644 index 045e499..0000000 --- a/app/user/rpc/internal/logic/updateUserLogic.go +++ /dev/null @@ -1,64 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/user/model" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/logx" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type UpdateUserLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { - return &UpdateUserLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 更新用户信息 -func (l *UpdateUserLogic) UpdateUser(in *user.UpdateUserReq) (*user.CommonResp, error) { - var u model.SundynixUser - if err := l.svcCtx.DB.Where("id = ?", in.Id).First(&u).Error; err != nil { - return nil, status.Error(codes.NotFound, "用户不存在") - } - - updates := map[string]interface{}{} - if in.Name != "" { - updates["name"] = in.Name - } - if in.Account != "" { - updates["account"] = in.Account - } - if in.Phone != "" { - updates["phone"] = in.Phone - } - if in.AvatarId != "" { - updates["avatar_id"] = in.AvatarId - } - if in.NickName != "" { - updates["nick_name"] = in.NickName - } - - if len(updates) > 0 { - if err := l.svcCtx.DB.Model(&u).Updates(updates).Error; err != nil { - l.Errorf("更新用户失败: %v", err) - return nil, status.Error(codes.Internal, "更新用户失败") - } - } - - return &user.CommonResp{ - Code: 200, - Msg: "更新成功", - }, nil -} diff --git a/app/user/rpc/internal/logic/verifyTokenLogic.go b/app/user/rpc/internal/logic/verifyTokenLogic.go deleted file mode 100644 index e954f3c..0000000 --- a/app/user/rpc/internal/logic/verifyTokenLogic.go +++ /dev/null @@ -1,52 +0,0 @@ -package logic - -import ( - "context" - - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/logx" -) - -type VerifyTokenLogic struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger -} - -func NewVerifyTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VerifyTokenLogic { - return &VerifyTokenLogic{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - } -} - -// 验证Token有效性 -func (l *VerifyTokenLogic) VerifyToken(in *user.VerifyTokenReq) (*user.VerifyTokenResp, error) { - claims, err := l.svcCtx.JWT.ParseToken(in.Token) - if err != nil { - return &user.VerifyTokenResp{ - Valid: false, - }, nil - } - - // 检查Redis黑名单 - if l.svcCtx.Redis != nil { - blacklistKey := "jwt:blacklist:" + claims.BaseClaims.ID - val, _ := l.svcCtx.Redis.Get(l.ctx, blacklistKey).Result() - if val == in.Token { - return &user.VerifyTokenResp{ - Valid: false, - }, nil - } - } - - return &user.VerifyTokenResp{ - Valid: true, - UserId: claims.BaseClaims.ID, - Account: claims.BaseClaims.Account, - ExpiresAt: claims.ExpiresAt.Unix(), - }, nil -} diff --git a/app/user/rpc/internal/server/userServiceServer.go b/app/user/rpc/internal/server/userServiceServer.go deleted file mode 100644 index e598f09..0000000 --- a/app/user/rpc/internal/server/userServiceServer.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 -// Source: user.proto - -package server - -import ( - "context" - - "sundynix-micro-go/app/user/rpc/internal/logic" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" -) - -type UserServiceServer struct { - svcCtx *svc.ServiceContext - user.UnimplementedUserServiceServer -} - -func NewUserServiceServer(svcCtx *svc.ServiceContext) *UserServiceServer { - return &UserServiceServer{ - svcCtx: svcCtx, - } -} - -// 根据ID获取用户信息 -func (s *UserServiceServer) GetUserById(ctx context.Context, in *user.GetUserByIdReq) (*user.GetUserByIdResp, error) { - l := logic.NewGetUserByIdLogic(ctx, s.svcCtx) - return l.GetUserById(in) -} - -// 根据OpenId获取用户信息 -func (s *UserServiceServer) GetUserByOpenId(ctx context.Context, in *user.GetUserByOpenIdReq) (*user.GetUserByOpenIdResp, error) { - l := logic.NewGetUserByOpenIdLogic(ctx, s.svcCtx) - return l.GetUserByOpenId(in) -} - -// 验证Token有效性 -func (s *UserServiceServer) VerifyToken(ctx context.Context, in *user.VerifyTokenReq) (*user.VerifyTokenResp, error) { - l := logic.NewVerifyTokenLogic(ctx, s.svcCtx) - return l.VerifyToken(in) -} - -// 创建用户 -func (s *UserServiceServer) CreateUser(ctx context.Context, in *user.CreateUserReq) (*user.CreateUserResp, error) { - l := logic.NewCreateUserLogic(ctx, s.svcCtx) - return l.CreateUser(in) -} - -// 更新用户信息 -func (s *UserServiceServer) UpdateUser(ctx context.Context, in *user.UpdateUserReq) (*user.CommonResp, error) { - l := logic.NewUpdateUserLogic(ctx, s.svcCtx) - return l.UpdateUser(in) -} diff --git a/app/user/rpc/internal/svc/serviceContext.go b/app/user/rpc/internal/svc/serviceContext.go deleted file mode 100644 index 3f26150..0000000 --- a/app/user/rpc/internal/svc/serviceContext.go +++ /dev/null @@ -1,52 +0,0 @@ -package svc - -import ( - "sundynix-micro-go/app/user/model" - "sundynix-micro-go/app/user/rpc/internal/config" - "sundynix-micro-go/common/utils/jwt" - - "github.com/redis/go-redis/v9" - "github.com/zeromicro/go-zero/core/logx" - "gorm.io/driver/mysql" - "gorm.io/gorm" -) - -type ServiceContext struct { - Config config.Config - DB *gorm.DB - Redis *redis.Client - JWT *jwt.JWT -} - -func NewServiceContext(c config.Config) *ServiceContext { - // 初始化GORM - db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) - if err != nil { - logx.Errorf("连接数据库失败: %v", err) - panic(err) - } - - // 自动迁移 - if err := db.AutoMigrate(&model.SundynixUser{}, &model.SundynixUserRole{}); err != nil { - logx.Errorf("数据库迁移失败: %v", err) - } - - // 初始化Redis - var rdb *redis.Client - if len(c.Cache) > 0 { - rdb = redis.NewClient(&redis.Options{ - Addr: c.Cache[0].Host, - Password: c.Cache[0].Pass, - }) - } - - // 初始化JWT - jwtUtil := jwt.NewJWT(c.JwtAuth.AccessSecret) - - return &ServiceContext{ - Config: c, - DB: db, - Redis: rdb, - JWT: jwtUtil, - } -} diff --git a/app/user/rpc/pb/user.proto b/app/user/rpc/pb/user.proto deleted file mode 100644 index b3df709..0000000 --- a/app/user/rpc/pb/user.proto +++ /dev/null @@ -1,106 +0,0 @@ -syntax = "proto3"; - -package user; - -option go_package = "./user"; - -// ---------- 通用消息 ---------- - -message CommonResp { - int64 code = 1; - string msg = 2; -} - -// ---------- 用户信息 ---------- - -message UserInfo { - string id = 1; - string tenantId = 2; - string clientId = 3; - string name = 4; - string account = 5; - string nickName = 6; - string phone = 7; - string sessionKey = 8; - string unionId = 9; - string openId = 10; - string saOpenId = 11; - string avatarId = 12; - int32 gender = 13; - string country = 14; - string province = 15; - string city = 16; - string language = 17; - int32 isVip = 18; - int64 vipExpireAt = 19; - string lastLoginIp = 20; - int64 lastLoginAt = 21; - int64 createdAt = 22; - int64 updatedAt = 23; - string avatarUrl = 24; -} - -// ---------- 请求/响应消息 ---------- - -message GetUserByIdReq { - string id = 1; -} - -message GetUserByIdResp { - UserInfo user = 1; -} - -message GetUserByOpenIdReq { - string openId = 1; -} - -message GetUserByOpenIdResp { - UserInfo user = 1; -} - -message VerifyTokenReq { - string token = 1; -} - -message VerifyTokenResp { - bool valid = 1; - string userId = 2; - string account = 3; - int64 expiresAt = 4; -} - -message CreateUserReq { - string name = 1; - string openId = 2; - string sessionKey = 3; - string clientId = 4; - string phone = 5; -} - -message CreateUserResp { - UserInfo user = 1; -} - -message UpdateUserReq { - string id = 1; - string name = 2; - string account = 3; - string phone = 4; - string avatarId = 5; - string nickName = 6; -} - -// ---------- 服务定义 ---------- - -service UserService { - // 根据ID获取用户信息 - rpc GetUserById(GetUserByIdReq) returns (GetUserByIdResp); - // 根据OpenId获取用户信息 - rpc GetUserByOpenId(GetUserByOpenIdReq) returns (GetUserByOpenIdResp); - // 验证Token有效性 - rpc VerifyToken(VerifyTokenReq) returns (VerifyTokenResp); - // 创建用户 - rpc CreateUser(CreateUserReq) returns (CreateUserResp); - // 更新用户信息 - rpc UpdateUser(UpdateUserReq) returns (CommonResp); -} diff --git a/app/user/rpc/user.go b/app/user/rpc/user.go deleted file mode 100644 index 29eef58..0000000 --- a/app/user/rpc/user.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "flag" - "fmt" - - "sundynix-micro-go/app/user/rpc/internal/config" - "sundynix-micro-go/app/user/rpc/internal/server" - "sundynix-micro-go/app/user/rpc/internal/svc" - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/core/conf" - "github.com/zeromicro/go-zero/core/service" - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" - "google.golang.org/grpc/reflection" -) - -var configFile = flag.String("f", "etc/user.yaml", "the config file") - -func main() { - flag.Parse() - - var c config.Config - conf.MustLoad(*configFile, &c) - ctx := svc.NewServiceContext(c) - - s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { - user.RegisterUserServiceServer(grpcServer, server.NewUserServiceServer(ctx)) - - if c.Mode == service.DevMode || c.Mode == service.TestMode { - reflection.Register(grpcServer) - } - }) - defer s.Stop() - - fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) - s.Start() -} diff --git a/app/user/rpc/user/user.pb.go b/app/user/rpc/user/user.pb.go deleted file mode 100644 index 6ba5997..0000000 --- a/app/user/rpc/user/user.pb.go +++ /dev/null @@ -1,943 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v7.34.1 -// source: pb/user.proto - -package user - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CommonResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` - Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CommonResp) Reset() { - *x = CommonResp{} - mi := &file_pb_user_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CommonResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommonResp) ProtoMessage() {} - -func (x *CommonResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. -func (*CommonResp) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{0} -} - -func (x *CommonResp) GetCode() int64 { - if x != nil { - return x.Code - } - return 0 -} - -func (x *CommonResp) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -type UserInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - TenantId string `protobuf:"bytes,2,opt,name=tenantId,proto3" json:"tenantId,omitempty"` - ClientId string `protobuf:"bytes,3,opt,name=clientId,proto3" json:"clientId,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"` - NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` - Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty"` - SessionKey string `protobuf:"bytes,8,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` - UnionId string `protobuf:"bytes,9,opt,name=unionId,proto3" json:"unionId,omitempty"` - OpenId string `protobuf:"bytes,10,opt,name=openId,proto3" json:"openId,omitempty"` - SaOpenId string `protobuf:"bytes,11,opt,name=saOpenId,proto3" json:"saOpenId,omitempty"` - AvatarId string `protobuf:"bytes,12,opt,name=avatarId,proto3" json:"avatarId,omitempty"` - Gender int32 `protobuf:"varint,13,opt,name=gender,proto3" json:"gender,omitempty"` - Country string `protobuf:"bytes,14,opt,name=country,proto3" json:"country,omitempty"` - Province string `protobuf:"bytes,15,opt,name=province,proto3" json:"province,omitempty"` - City string `protobuf:"bytes,16,opt,name=city,proto3" json:"city,omitempty"` - Language string `protobuf:"bytes,17,opt,name=language,proto3" json:"language,omitempty"` - IsVip int32 `protobuf:"varint,18,opt,name=isVip,proto3" json:"isVip,omitempty"` - VipExpireAt int64 `protobuf:"varint,19,opt,name=vipExpireAt,proto3" json:"vipExpireAt,omitempty"` - LastLoginIp string `protobuf:"bytes,20,opt,name=lastLoginIp,proto3" json:"lastLoginIp,omitempty"` - LastLoginAt int64 `protobuf:"varint,21,opt,name=lastLoginAt,proto3" json:"lastLoginAt,omitempty"` - CreatedAt int64 `protobuf:"varint,22,opt,name=createdAt,proto3" json:"createdAt,omitempty"` - UpdatedAt int64 `protobuf:"varint,23,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` - AvatarUrl string `protobuf:"bytes,24,opt,name=avatarUrl,proto3" json:"avatarUrl,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserInfo) Reset() { - *x = UserInfo{} - mi := &file_pb_user_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserInfo) ProtoMessage() {} - -func (x *UserInfo) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserInfo.ProtoReflect.Descriptor instead. -func (*UserInfo) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{1} -} - -func (x *UserInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UserInfo) GetTenantId() string { - if x != nil { - return x.TenantId - } - return "" -} - -func (x *UserInfo) GetClientId() string { - if x != nil { - return x.ClientId - } - return "" -} - -func (x *UserInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UserInfo) GetAccount() string { - if x != nil { - return x.Account - } - return "" -} - -func (x *UserInfo) GetNickName() string { - if x != nil { - return x.NickName - } - return "" -} - -func (x *UserInfo) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *UserInfo) GetSessionKey() string { - if x != nil { - return x.SessionKey - } - return "" -} - -func (x *UserInfo) GetUnionId() string { - if x != nil { - return x.UnionId - } - return "" -} - -func (x *UserInfo) GetOpenId() string { - if x != nil { - return x.OpenId - } - return "" -} - -func (x *UserInfo) GetSaOpenId() string { - if x != nil { - return x.SaOpenId - } - return "" -} - -func (x *UserInfo) GetAvatarId() string { - if x != nil { - return x.AvatarId - } - return "" -} - -func (x *UserInfo) GetGender() int32 { - if x != nil { - return x.Gender - } - return 0 -} - -func (x *UserInfo) GetCountry() string { - if x != nil { - return x.Country - } - return "" -} - -func (x *UserInfo) GetProvince() string { - if x != nil { - return x.Province - } - return "" -} - -func (x *UserInfo) GetCity() string { - if x != nil { - return x.City - } - return "" -} - -func (x *UserInfo) GetLanguage() string { - if x != nil { - return x.Language - } - return "" -} - -func (x *UserInfo) GetIsVip() int32 { - if x != nil { - return x.IsVip - } - return 0 -} - -func (x *UserInfo) GetVipExpireAt() int64 { - if x != nil { - return x.VipExpireAt - } - return 0 -} - -func (x *UserInfo) GetLastLoginIp() string { - if x != nil { - return x.LastLoginIp - } - return "" -} - -func (x *UserInfo) GetLastLoginAt() int64 { - if x != nil { - return x.LastLoginAt - } - return 0 -} - -func (x *UserInfo) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *UserInfo) GetUpdatedAt() int64 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -func (x *UserInfo) GetAvatarUrl() string { - if x != nil { - return x.AvatarUrl - } - return "" -} - -type GetUserByIdReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserByIdReq) Reset() { - *x = GetUserByIdReq{} - mi := &file_pb_user_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserByIdReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserByIdReq) ProtoMessage() {} - -func (x *GetUserByIdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserByIdReq.ProtoReflect.Descriptor instead. -func (*GetUserByIdReq) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{2} -} - -func (x *GetUserByIdReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type GetUserByIdResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserByIdResp) Reset() { - *x = GetUserByIdResp{} - mi := &file_pb_user_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserByIdResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserByIdResp) ProtoMessage() {} - -func (x *GetUserByIdResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserByIdResp.ProtoReflect.Descriptor instead. -func (*GetUserByIdResp) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{3} -} - -func (x *GetUserByIdResp) GetUser() *UserInfo { - if x != nil { - return x.User - } - return nil -} - -type GetUserByOpenIdReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - OpenId string `protobuf:"bytes,1,opt,name=openId,proto3" json:"openId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserByOpenIdReq) Reset() { - *x = GetUserByOpenIdReq{} - mi := &file_pb_user_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserByOpenIdReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserByOpenIdReq) ProtoMessage() {} - -func (x *GetUserByOpenIdReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserByOpenIdReq.ProtoReflect.Descriptor instead. -func (*GetUserByOpenIdReq) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{4} -} - -func (x *GetUserByOpenIdReq) GetOpenId() string { - if x != nil { - return x.OpenId - } - return "" -} - -type GetUserByOpenIdResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserByOpenIdResp) Reset() { - *x = GetUserByOpenIdResp{} - mi := &file_pb_user_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserByOpenIdResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserByOpenIdResp) ProtoMessage() {} - -func (x *GetUserByOpenIdResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserByOpenIdResp.ProtoReflect.Descriptor instead. -func (*GetUserByOpenIdResp) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{5} -} - -func (x *GetUserByOpenIdResp) GetUser() *UserInfo { - if x != nil { - return x.User - } - return nil -} - -type VerifyTokenReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VerifyTokenReq) Reset() { - *x = VerifyTokenReq{} - mi := &file_pb_user_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VerifyTokenReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VerifyTokenReq) ProtoMessage() {} - -func (x *VerifyTokenReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VerifyTokenReq.ProtoReflect.Descriptor instead. -func (*VerifyTokenReq) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{6} -} - -func (x *VerifyTokenReq) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -type VerifyTokenResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` - UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` - Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` - ExpiresAt int64 `protobuf:"varint,4,opt,name=expiresAt,proto3" json:"expiresAt,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VerifyTokenResp) Reset() { - *x = VerifyTokenResp{} - mi := &file_pb_user_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VerifyTokenResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VerifyTokenResp) ProtoMessage() {} - -func (x *VerifyTokenResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VerifyTokenResp.ProtoReflect.Descriptor instead. -func (*VerifyTokenResp) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{7} -} - -func (x *VerifyTokenResp) GetValid() bool { - if x != nil { - return x.Valid - } - return false -} - -func (x *VerifyTokenResp) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *VerifyTokenResp) GetAccount() string { - if x != nil { - return x.Account - } - return "" -} - -func (x *VerifyTokenResp) GetExpiresAt() int64 { - if x != nil { - return x.ExpiresAt - } - return 0 -} - -type CreateUserReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - OpenId string `protobuf:"bytes,2,opt,name=openId,proto3" json:"openId,omitempty"` - SessionKey string `protobuf:"bytes,3,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` - ClientId string `protobuf:"bytes,4,opt,name=clientId,proto3" json:"clientId,omitempty"` - Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateUserReq) Reset() { - *x = CreateUserReq{} - mi := &file_pb_user_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateUserReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserReq) ProtoMessage() {} - -func (x *CreateUserReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead. -func (*CreateUserReq) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{8} -} - -func (x *CreateUserReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CreateUserReq) GetOpenId() string { - if x != nil { - return x.OpenId - } - return "" -} - -func (x *CreateUserReq) GetSessionKey() string { - if x != nil { - return x.SessionKey - } - return "" -} - -func (x *CreateUserReq) GetClientId() string { - if x != nil { - return x.ClientId - } - return "" -} - -func (x *CreateUserReq) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -type CreateUserResp struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateUserResp) Reset() { - *x = CreateUserResp{} - mi := &file_pb_user_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateUserResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserResp) ProtoMessage() {} - -func (x *CreateUserResp) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateUserResp.ProtoReflect.Descriptor instead. -func (*CreateUserResp) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{9} -} - -func (x *CreateUserResp) GetUser() *UserInfo { - if x != nil { - return x.User - } - return nil -} - -type UpdateUserReq struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` - AvatarId string `protobuf:"bytes,5,opt,name=avatarId,proto3" json:"avatarId,omitempty"` - NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateUserReq) Reset() { - *x = UpdateUserReq{} - mi := &file_pb_user_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateUserReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserReq) ProtoMessage() {} - -func (x *UpdateUserReq) ProtoReflect() protoreflect.Message { - mi := &file_pb_user_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead. -func (*UpdateUserReq) Descriptor() ([]byte, []int) { - return file_pb_user_proto_rawDescGZIP(), []int{10} -} - -func (x *UpdateUserReq) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UpdateUserReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateUserReq) GetAccount() string { - if x != nil { - return x.Account - } - return "" -} - -func (x *UpdateUserReq) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *UpdateUserReq) GetAvatarId() string { - if x != nil { - return x.AvatarId - } - return "" -} - -func (x *UpdateUserReq) GetNickName() string { - if x != nil { - return x.NickName - } - return "" -} - -var File_pb_user_proto protoreflect.FileDescriptor - -const file_pb_user_proto_rawDesc = "" + - "\n" + - "\rpb/user.proto\x12\x04user\"2\n" + - "\n" + - "CommonResp\x12\x12\n" + - "\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" + - "\x03msg\x18\x02 \x01(\tR\x03msg\"\x90\x05\n" + - "\bUserInfo\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + - "\btenantId\x18\x02 \x01(\tR\btenantId\x12\x1a\n" + - "\bclientId\x18\x03 \x01(\tR\bclientId\x12\x12\n" + - "\x04name\x18\x04 \x01(\tR\x04name\x12\x18\n" + - "\aaccount\x18\x05 \x01(\tR\aaccount\x12\x1a\n" + - "\bnickName\x18\x06 \x01(\tR\bnickName\x12\x14\n" + - "\x05phone\x18\a \x01(\tR\x05phone\x12\x1e\n" + - "\n" + - "sessionKey\x18\b \x01(\tR\n" + - "sessionKey\x12\x18\n" + - "\aunionId\x18\t \x01(\tR\aunionId\x12\x16\n" + - "\x06openId\x18\n" + - " \x01(\tR\x06openId\x12\x1a\n" + - "\bsaOpenId\x18\v \x01(\tR\bsaOpenId\x12\x1a\n" + - "\bavatarId\x18\f \x01(\tR\bavatarId\x12\x16\n" + - "\x06gender\x18\r \x01(\x05R\x06gender\x12\x18\n" + - "\acountry\x18\x0e \x01(\tR\acountry\x12\x1a\n" + - "\bprovince\x18\x0f \x01(\tR\bprovince\x12\x12\n" + - "\x04city\x18\x10 \x01(\tR\x04city\x12\x1a\n" + - "\blanguage\x18\x11 \x01(\tR\blanguage\x12\x14\n" + - "\x05isVip\x18\x12 \x01(\x05R\x05isVip\x12 \n" + - "\vvipExpireAt\x18\x13 \x01(\x03R\vvipExpireAt\x12 \n" + - "\vlastLoginIp\x18\x14 \x01(\tR\vlastLoginIp\x12 \n" + - "\vlastLoginAt\x18\x15 \x01(\x03R\vlastLoginAt\x12\x1c\n" + - "\tcreatedAt\x18\x16 \x01(\x03R\tcreatedAt\x12\x1c\n" + - "\tupdatedAt\x18\x17 \x01(\x03R\tupdatedAt\x12\x1c\n" + - "\tavatarUrl\x18\x18 \x01(\tR\tavatarUrl\" \n" + - "\x0eGetUserByIdReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\"5\n" + - "\x0fGetUserByIdResp\x12\"\n" + - "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\",\n" + - "\x12GetUserByOpenIdReq\x12\x16\n" + - "\x06openId\x18\x01 \x01(\tR\x06openId\"9\n" + - "\x13GetUserByOpenIdResp\x12\"\n" + - "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\"&\n" + - "\x0eVerifyTokenReq\x12\x14\n" + - "\x05token\x18\x01 \x01(\tR\x05token\"w\n" + - "\x0fVerifyTokenResp\x12\x14\n" + - "\x05valid\x18\x01 \x01(\bR\x05valid\x12\x16\n" + - "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x18\n" + - "\aaccount\x18\x03 \x01(\tR\aaccount\x12\x1c\n" + - "\texpiresAt\x18\x04 \x01(\x03R\texpiresAt\"\x8d\x01\n" + - "\rCreateUserReq\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + - "\x06openId\x18\x02 \x01(\tR\x06openId\x12\x1e\n" + - "\n" + - "sessionKey\x18\x03 \x01(\tR\n" + - "sessionKey\x12\x1a\n" + - "\bclientId\x18\x04 \x01(\tR\bclientId\x12\x14\n" + - "\x05phone\x18\x05 \x01(\tR\x05phone\"4\n" + - "\x0eCreateUserResp\x12\"\n" + - "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\"\x9b\x01\n" + - "\rUpdateUserReq\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + - "\aaccount\x18\x03 \x01(\tR\aaccount\x12\x14\n" + - "\x05phone\x18\x04 \x01(\tR\x05phone\x12\x1a\n" + - "\bavatarId\x18\x05 \x01(\tR\bavatarId\x12\x1a\n" + - "\bnickName\x18\x06 \x01(\tR\bnickName2\xbb\x02\n" + - "\vUserService\x12:\n" + - "\vGetUserById\x12\x14.user.GetUserByIdReq\x1a\x15.user.GetUserByIdResp\x12F\n" + - "\x0fGetUserByOpenId\x12\x18.user.GetUserByOpenIdReq\x1a\x19.user.GetUserByOpenIdResp\x12:\n" + - "\vVerifyToken\x12\x14.user.VerifyTokenReq\x1a\x15.user.VerifyTokenResp\x127\n" + - "\n" + - "CreateUser\x12\x13.user.CreateUserReq\x1a\x14.user.CreateUserResp\x123\n" + - "\n" + - "UpdateUser\x12\x13.user.UpdateUserReq\x1a\x10.user.CommonRespB\bZ\x06./userb\x06proto3" - -var ( - file_pb_user_proto_rawDescOnce sync.Once - file_pb_user_proto_rawDescData []byte -) - -func file_pb_user_proto_rawDescGZIP() []byte { - file_pb_user_proto_rawDescOnce.Do(func() { - file_pb_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_user_proto_rawDesc), len(file_pb_user_proto_rawDesc))) - }) - return file_pb_user_proto_rawDescData -} - -var file_pb_user_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_pb_user_proto_goTypes = []any{ - (*CommonResp)(nil), // 0: user.CommonResp - (*UserInfo)(nil), // 1: user.UserInfo - (*GetUserByIdReq)(nil), // 2: user.GetUserByIdReq - (*GetUserByIdResp)(nil), // 3: user.GetUserByIdResp - (*GetUserByOpenIdReq)(nil), // 4: user.GetUserByOpenIdReq - (*GetUserByOpenIdResp)(nil), // 5: user.GetUserByOpenIdResp - (*VerifyTokenReq)(nil), // 6: user.VerifyTokenReq - (*VerifyTokenResp)(nil), // 7: user.VerifyTokenResp - (*CreateUserReq)(nil), // 8: user.CreateUserReq - (*CreateUserResp)(nil), // 9: user.CreateUserResp - (*UpdateUserReq)(nil), // 10: user.UpdateUserReq -} -var file_pb_user_proto_depIdxs = []int32{ - 1, // 0: user.GetUserByIdResp.user:type_name -> user.UserInfo - 1, // 1: user.GetUserByOpenIdResp.user:type_name -> user.UserInfo - 1, // 2: user.CreateUserResp.user:type_name -> user.UserInfo - 2, // 3: user.UserService.GetUserById:input_type -> user.GetUserByIdReq - 4, // 4: user.UserService.GetUserByOpenId:input_type -> user.GetUserByOpenIdReq - 6, // 5: user.UserService.VerifyToken:input_type -> user.VerifyTokenReq - 8, // 6: user.UserService.CreateUser:input_type -> user.CreateUserReq - 10, // 7: user.UserService.UpdateUser:input_type -> user.UpdateUserReq - 3, // 8: user.UserService.GetUserById:output_type -> user.GetUserByIdResp - 5, // 9: user.UserService.GetUserByOpenId:output_type -> user.GetUserByOpenIdResp - 7, // 10: user.UserService.VerifyToken:output_type -> user.VerifyTokenResp - 9, // 11: user.UserService.CreateUser:output_type -> user.CreateUserResp - 0, // 12: user.UserService.UpdateUser:output_type -> user.CommonResp - 8, // [8:13] is the sub-list for method output_type - 3, // [3:8] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_pb_user_proto_init() } -func file_pb_user_proto_init() { - if File_pb_user_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_user_proto_rawDesc), len(file_pb_user_proto_rawDesc)), - NumEnums: 0, - NumMessages: 11, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_pb_user_proto_goTypes, - DependencyIndexes: file_pb_user_proto_depIdxs, - MessageInfos: file_pb_user_proto_msgTypes, - }.Build() - File_pb_user_proto = out.File - file_pb_user_proto_goTypes = nil - file_pb_user_proto_depIdxs = nil -} diff --git a/app/user/rpc/user/user_grpc.pb.go b/app/user/rpc/user/user_grpc.pb.go deleted file mode 100644 index cfb82a0..0000000 --- a/app/user/rpc/user/user_grpc.pb.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc v7.34.1 -// source: pb/user.proto - -package user - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - UserService_GetUserById_FullMethodName = "/user.UserService/GetUserById" - UserService_GetUserByOpenId_FullMethodName = "/user.UserService/GetUserByOpenId" - UserService_VerifyToken_FullMethodName = "/user.UserService/VerifyToken" - UserService_CreateUser_FullMethodName = "/user.UserService/CreateUser" - UserService_UpdateUser_FullMethodName = "/user.UserService/UpdateUser" -) - -// UserServiceClient is the client API for UserService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type UserServiceClient interface { - // 根据ID获取用户信息 - GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) - // 根据OpenId获取用户信息 - GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) - // 验证Token有效性 - VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) - // 创建用户 - CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) - // 更新用户信息 - UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) -} - -type userServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { - return &userServiceClient{cc} -} - -func (c *userServiceClient) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetUserByIdResp) - err := c.cc.Invoke(ctx, UserService_GetUserById_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetUserByOpenIdResp) - err := c.cc.Invoke(ctx, UserService_GetUserByOpenId_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(VerifyTokenResp) - err := c.cc.Invoke(ctx, UserService_VerifyToken_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CreateUserResp) - err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CommonResp) - err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// UserServiceServer is the server API for UserService service. -// All implementations must embed UnimplementedUserServiceServer -// for forward compatibility. -type UserServiceServer interface { - // 根据ID获取用户信息 - GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) - // 根据OpenId获取用户信息 - GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) - // 验证Token有效性 - VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error) - // 创建用户 - CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) - // 更新用户信息 - UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) - mustEmbedUnimplementedUserServiceServer() -} - -// UnimplementedUserServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedUserServiceServer struct{} - -func (UnimplementedUserServiceServer) GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetUserById not implemented") -} -func (UnimplementedUserServiceServer) GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) { - return nil, status.Error(codes.Unimplemented, "method GetUserByOpenId not implemented") -} -func (UnimplementedUserServiceServer) VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error) { - return nil, status.Error(codes.Unimplemented, "method VerifyToken not implemented") -} -func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) { - return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") -} -func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateUser not implemented") -} -func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} -func (UnimplementedUserServiceServer) testEmbeddedByValue() {} - -// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to UserServiceServer will -// result in compilation errors. -type UnsafeUserServiceServer interface { - mustEmbedUnimplementedUserServiceServer() -} - -func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { - // If the following call panics, it indicates UnimplementedUserServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&UserService_ServiceDesc, srv) -} - -func _UserService_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserByIdReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).GetUserById(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_GetUserById_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUserById(ctx, req.(*GetUserByIdReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_GetUserByOpenId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserByOpenIdReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).GetUserByOpenId(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_GetUserByOpenId_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUserByOpenId(ctx, req.(*GetUserByOpenIdReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_VerifyToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VerifyTokenReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).VerifyToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_VerifyToken_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).VerifyToken(ctx, req.(*VerifyTokenReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).CreateUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_CreateUser_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).UpdateUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_UpdateUser_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var UserService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "user.UserService", - HandlerType: (*UserServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetUserById", - Handler: _UserService_GetUserById_Handler, - }, - { - MethodName: "GetUserByOpenId", - Handler: _UserService_GetUserByOpenId_Handler, - }, - { - MethodName: "VerifyToken", - Handler: _UserService_VerifyToken_Handler, - }, - { - MethodName: "CreateUser", - Handler: _UserService_CreateUser_Handler, - }, - { - MethodName: "UpdateUser", - Handler: _UserService_UpdateUser_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "pb/user.proto", -} diff --git a/app/user/rpc/userservice/userService.go b/app/user/rpc/userservice/userService.go deleted file mode 100644 index 231017b..0000000 --- a/app/user/rpc/userservice/userService.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -// goctl 1.10.1 -// Source: user.proto - -package userservice - -import ( - "context" - - "sundynix-micro-go/app/user/rpc/user" - - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" -) - -type ( - CommonResp = user.CommonResp - CreateUserReq = user.CreateUserReq - CreateUserResp = user.CreateUserResp - GetUserByIdReq = user.GetUserByIdReq - GetUserByIdResp = user.GetUserByIdResp - GetUserByOpenIdReq = user.GetUserByOpenIdReq - GetUserByOpenIdResp = user.GetUserByOpenIdResp - UpdateUserReq = user.UpdateUserReq - UserInfo = user.UserInfo - VerifyTokenReq = user.VerifyTokenReq - VerifyTokenResp = user.VerifyTokenResp - - UserService interface { - // 根据ID获取用户信息 - GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) - // 根据OpenId获取用户信息 - GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) - // 验证Token有效性 - VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) - // 创建用户 - CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) - // 更新用户信息 - UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) - } - - defaultUserService struct { - cli zrpc.Client - } -) - -func NewUserService(cli zrpc.Client) UserService { - return &defaultUserService{ - cli: cli, - } -} - -// 根据ID获取用户信息 -func (m *defaultUserService) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { - client := user.NewUserServiceClient(m.cli.Conn()) - return client.GetUserById(ctx, in, opts...) -} - -// 根据OpenId获取用户信息 -func (m *defaultUserService) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { - client := user.NewUserServiceClient(m.cli.Conn()) - return client.GetUserByOpenId(ctx, in, opts...) -} - -// 验证Token有效性 -func (m *defaultUserService) VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) { - client := user.NewUserServiceClient(m.cli.Conn()) - return client.VerifyToken(ctx, in, opts...) -} - -// 创建用户 -func (m *defaultUserService) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { - client := user.NewUserServiceClient(m.cli.Conn()) - return client.CreateUser(ctx, in, opts...) -} - -// 更新用户信息 -func (m *defaultUserService) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { - client := user.NewUserServiceClient(m.cli.Conn()) - return client.UpdateUser(ctx, in, opts...) -} diff --git a/app/zero-gateway/etc/zero-gateway.yaml b/app/zero-gateway/etc/zero-gateway.yaml new file mode 100644 index 0000000..3bb496e --- /dev/null +++ b/app/zero-gateway/etc/zero-gateway.yaml @@ -0,0 +1,231 @@ +Name: zero-gateway +Host: 0.0.0.0 +Port: 8889 + +Log: + Encoding: plain + Mode: console + +# system-rpc 连接(用于写入操作日志) +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# JWT 密钥(与各 API 服务 Auth.AccessSecret 一致) +JwtSecret: "9149f2eb-d517-4a50-a03a-231dbcf0d872" + +# 跨域配置 +Cors: + AllowOrigins: + - "*" + AllowMethods: + - GET + - POST + - PUT + - DELETE + - OPTIONS + AllowHeaders: + - Content-Type + - Authorization + - X-Requested-With + - X-Client-Id + +# 鉴权白名单(无需 Token 的路径,精确匹配) +AuthWhitelist: + - /api/auth/login + - /api/auth/loginByPhone + - /api/auth/miniLogin + - /api/auth/captcha + - /api/plant/callback/wechatpay + +# 上游服务路由表(使用 go-zero 官方 HTTP 网关配置) +Upstreams: + # ==================== Auth API (9001) ==================== + - Name: auth-api + Http: + Target: 192.168.100.4:9001 + Prefix: /api/auth + Timeout: 5000 + Mappings: + # 无需鉴权 + - Method: POST + Path: /miniLogin + - Method: POST + Path: /loginByPhone + - Method: POST + Path: /login + - Method: GET + Path: /captcha + # 需要鉴权 + - Method: GET + Path: /info + - Method: POST + Path: /update + - Method: POST + Path: /changePassword + - Method: GET + Path: /location + - Method: GET + Path: /weather + + # ==================== File API (9002) ==================== + - Name: file-api + Http: + Target: 192.168.100.4:9002 + Prefix: /api/file + Timeout: 30000 + Mappings: + - Method: POST + Path: /upload + - Method: POST + Path: /delete + - Method: POST + Path: /list + - Method: GET + Path: /:id + + # ==================== System API (9003) ==================== + - Name: system-api + Http: + Target: 192.168.100.4:9003 + Prefix: /api/sys + Timeout: 5000 + Mappings: + # 客户端管理 + - Method: POST + Path: /client/create + - Method: POST + Path: /client/update + - Method: POST + Path: /client/delete + - Method: POST + Path: /client/list + # 角色管理 + - Method: POST + Path: /role/create + - Method: POST + Path: /role/update + - Method: POST + Path: /role/delete + - Method: POST + Path: /role/list + # 菜单管理 + - Method: POST + Path: /menu/create + - Method: POST + Path: /menu/update + - Method: POST + Path: /menu/delete + - Method: GET + Path: /menu/list + - Method: POST + Path: /menu/byRole + # 操作日志 + - Method: POST + Path: /log/list + - Method: POST + Path: /log/delete + # 字典管理 + - Method: POST + Path: /dict/create + - Method: POST + Path: /dict/update + - Method: POST + Path: /dict/delete + - Method: POST + Path: /dict/list + # 用户管理 + - Method: POST + Path: /user/list + - Method: POST + Path: /user/create + - Method: POST + Path: /user/update + - Method: POST + Path: /user/delete + - Method: POST + Path: /user/resetPassword + + # ==================== Plant API (9004) ==================== + - Name: plant-api + Http: + Target: 192.168.100.4:9004 + Prefix: /api/plant + Timeout: 10000 + Mappings: + # 回调(无鉴权) + - Method: POST + Path: /callback/wechatpay + # 我的植物 + - Method: POST + Path: /my/create + - Method: POST + Path: /my/update + - Method: POST + Path: /my/delete + - Method: POST + Path: /my/list + - Method: GET + Path: /my/:id + - Method: POST + Path: /my/carePlan + - Method: POST + Path: /my/careRecord + - Method: POST + Path: /my/growthRecord + # 百科 + - Method: POST + Path: /wiki/list + - Method: GET + Path: /wiki/:id + - Method: GET + Path: /wiki/class/list + - Method: POST + Path: /wiki/class/create + - Method: POST + Path: /wiki/star + # 帖子 + - Method: POST + Path: /post/create + - Method: POST + Path: /post/list + - Method: GET + Path: /post/:id + - Method: POST + Path: /post/delete + - Method: POST + Path: /post/comment + - Method: POST + Path: /post/like + # 话题 + - Method: GET + Path: /topic/list + - Method: POST + Path: /topic/create + - Method: POST + Path: /topic/delete + # OCR + - Method: POST + Path: /ocr/classify + # 兑换 + - Method: POST + Path: /exchange/list + - Method: POST + Path: /exchange/order + # AI + - Method: POST + Path: /ai/chat + - Method: GET + Path: /ai/history + # 用户资料 + - Method: GET + Path: /profile/info + - Method: POST + Path: /profile/update + # 等级/徽章配置 + - Method: POST + Path: /config/level/list + - Method: POST + Path: /config/badge/list diff --git a/app/zero-gateway/internal/config/config.go b/app/zero-gateway/internal/config/config.go new file mode 100644 index 0000000..c98a166 --- /dev/null +++ b/app/zero-gateway/internal/config/config.go @@ -0,0 +1,27 @@ +package config + +import ( + "github.com/zeromicro/go-zero/gateway" + "github.com/zeromicro/go-zero/zrpc" +) + +// Config zero-gateway 配置,嵌入官方 GatewayConf +type Config struct { + gateway.GatewayConf + + // system-rpc 连接(用于写入操作日志) + SystemRpc zrpc.RpcClientConf + + // JWT 密钥(与各 API 服务 Auth.AccessSecret 一致,用于网关层鉴权) + JwtSecret string `json:",optional"` + + // 跨域配置 + Cors struct { + AllowOrigins []string + AllowMethods []string + AllowHeaders []string + } + + // 无需鉴权的路径白名单(精确匹配) + AuthWhitelist []string `json:",optional"` +} diff --git a/app/zero-gateway/internal/middleware/auth.go b/app/zero-gateway/internal/middleware/auth.go new file mode 100644 index 0000000..e05b91b --- /dev/null +++ b/app/zero-gateway/internal/middleware/auth.go @@ -0,0 +1,142 @@ +package middleware + +import ( + "encoding/json" + "net/http" + "strings" + "time" + + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" +) + +// RefreshTokenHeader 续期后新 Token 放在此响应头里,前端读取后静默替换 +const RefreshTokenHeader = "X-Refresh-Token" + +// AuthMiddleware 网关鉴权 + 自动续期中间件 +type AuthMiddleware struct { + jwtSecret string + whitelist map[string]bool +} + +func NewAuthMiddleware(jwtSecret string, whitelist []string) *AuthMiddleware { + wl := make(map[string]bool, len(whitelist)) + for _, p := range whitelist { + wl[p] = true + } + return &AuthMiddleware{ + jwtSecret: jwtSecret, + whitelist: wl, + } +} + +func (m *AuthMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // OPTIONS 预检直接放行 + if r.Method == http.MethodOptions { + next(w, r) + return + } + + // 白名单路径放行(支持精确匹配和 /* 前缀通配) + if m.isWhitelisted(r.URL.Path) { + next(w, r) + return + } + + // 解析 Authorization 头 + authHeader := r.Header.Get("Authorization") + if authHeader == "" { + writeUnauthorized(w, "缺少 Authorization 请求头") + return + } + tokenStr := jwtUtil.GetTokenFromHeader(authHeader) + if tokenStr == "" { + writeUnauthorized(w, "Token 格式错误") + return + } + + j := jwtUtil.NewJWT(m.jwtSecret) + claims, err := j.ParseToken(tokenStr) + if err != nil { + logx.Infof("[zero-gateway] JWT 解析失败: %v, path: %s", err, r.URL.Path) + writeUnauthorized(w, err.Error()) + return + } + + // 将用户信息透传到上游,避免上游重复解析 JWT + r.Header.Set("X-User-Id", claims.BaseClaims.ID) + r.Header.Set("X-User-Account", claims.BaseClaims.Account) + + // ---- 滑动窗口续期 ---- + // 剩余有效时间 < BufferTime(存储在 token claims 里),说明进入缓冲窗口 + if newToken, ok := m.tryRefresh(j, claims); ok { + // 在响应头写入新 Token,前端收到后静默替换本地存储的 Token + w.Header().Set(RefreshTokenHeader, newToken) + logx.Infof("[zero-gateway] Token 已续期, userId: %s", claims.BaseClaims.ID) + } + + next(w, r) + } +} + +// tryRefresh 判断是否需要续期,需要则签发新 Token 并返回 +// 续期规则:剩余有效时间 < BufferTime → 以原始有效时长(ExpiresAt - NotBefore)重新签发 +func (m *AuthMiddleware) tryRefresh(j *jwtUtil.JWT, claims *jwtUtil.CustomClaims) (string, bool) { + bufferTime := time.Duration(claims.BufferTime) * time.Second + expiresAt := claims.RegisteredClaims.ExpiresAt.Time + remaining := time.Until(expiresAt) + + // 未进入缓冲窗口,无需续期 + if remaining >= bufferTime { + return "", false + } + + // 计算原始有效时长:ExpiresAt - NotBefore ≈ 当初登录时配置的 activeTimeout + notBefore := claims.RegisteredClaims.NotBefore.Time + originalDuration := expiresAt.Sub(notBefore) + + // 构建新 Claims,保持 BaseClaims 和 BufferTime 不变,重新计算有效期 + newClaims := jwtUtil.CustomClaims{ + BaseClaims: claims.BaseClaims, + BufferTime: claims.BufferTime, + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: claims.RegisteredClaims.Audience, + Issuer: claims.RegisteredClaims.Issuer, + NotBefore: jwtv5.NewNumericDate(time.Now()), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(originalDuration)), + }, + } + + newToken, err := j.CreateToken(newClaims) + if err != nil { + logx.Errorf("[zero-gateway] Token 续期失败: %v", err) + return "", false + } + return newToken, true +} + +// isWhitelisted 支持精确匹配和 /* 前缀通配 +func (m *AuthMiddleware) isWhitelisted(path string) bool { + if m.whitelist[path] { + return true + } + for p := range m.whitelist { + if strings.HasSuffix(p, "/*") && strings.HasPrefix(path, strings.TrimSuffix(p, "*")) { + return true + } + } + return false +} + +// writeUnauthorized 返回统一的 401 响应 +func writeUnauthorized(w http.ResponseWriter, msg string) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(http.StatusUnauthorized) + _ = json.NewEncoder(w).Encode(map[string]interface{}{ + "code": 401, + "msg": msg, + }) +} diff --git a/app/zero-gateway/internal/middleware/cors.go b/app/zero-gateway/internal/middleware/cors.go new file mode 100644 index 0000000..1415c7a --- /dev/null +++ b/app/zero-gateway/internal/middleware/cors.go @@ -0,0 +1,57 @@ +package middleware + +import ( + "net/http" + "strings" +) + +// CorsMiddleware 跨域中间件 +type CorsMiddleware struct { + allowOrigins []string + allowMethods []string + allowHeaders []string +} + +func NewCorsMiddleware(origins, methods, headers []string) *CorsMiddleware { + return &CorsMiddleware{ + allowOrigins: origins, + allowMethods: methods, + allowHeaders: headers, + } +} + +func (m *CorsMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + origin := r.Header.Get("Origin") + + allowed := false + for _, o := range m.allowOrigins { + if o == "*" || o == origin { + allowed = true + break + } + } + + if allowed { + allowOrigin := origin + if len(m.allowOrigins) == 1 && m.allowOrigins[0] == "*" { + allowOrigin = "*" + } + w.Header().Set("Access-Control-Allow-Origin", allowOrigin) + w.Header().Set("Access-Control-Allow-Methods", strings.Join(m.allowMethods, ", ")) + w.Header().Set("Access-Control-Allow-Headers", strings.Join(m.allowHeaders, ", ")) + w.Header().Set("Access-Control-Allow-Credentials", "true") + w.Header().Set("Access-Control-Max-Age", "3600") + // 允许前端 JS 读取自定义响应头(默认跨域只能读 6 个安全头) + w.Header().Set("Access-Control-Expose-Headers", "X-Refresh-Token") + } + + // 预检请求直接返回 204 + if r.Method == http.MethodOptions { + w.WriteHeader(http.StatusNoContent) + return + } + + next(w, r) + } +} diff --git a/app/zero-gateway/internal/middleware/operationLog.go b/app/zero-gateway/internal/middleware/operationLog.go new file mode 100644 index 0000000..79bd263 --- /dev/null +++ b/app/zero-gateway/internal/middleware/operationLog.go @@ -0,0 +1,168 @@ +package middleware + +import ( + "bytes" + "context" + "io" + "net/http" + "strings" + "time" + + "sundynix-micro-go/app/system/rpc/system" + "sundynix-micro-go/app/system/rpc/systemservice" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + "github.com/zeromicro/go-zero/core/logx" +) + +// OperationLogMiddleware 操作日志中间件(异步写入 system-rpc) +type OperationLogMiddleware struct { + systemRpc systemservice.SystemService + jwtSecret string + logChan chan *system.CreateOperationRecordReq +} + +func NewOperationLogMiddleware(systemRpc systemservice.SystemService, jwtSecret string) *OperationLogMiddleware { + m := &OperationLogMiddleware{ + systemRpc: systemRpc, + jwtSecret: jwtSecret, + logChan: make(chan *system.CreateOperationRecordReq, 500), + } + // 启动异步消费者,避免阻塞请求 + go m.consumer() + return m +} + +func (m *OperationLogMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // 跳过健康检查和 OPTIONS 预检 + if r.URL.Path == "/health" || r.Method == http.MethodOptions { + next(w, r) + return + } + + startTime := time.Now() + + // 读取并缓存请求体(限制大小,跳过文件上传) + var bodyStr string + if r.Body != nil && !strings.HasPrefix(r.Header.Get("Content-Type"), "multipart/form-data") { + bodyBytes, _ := io.ReadAll(io.LimitReader(r.Body, 2048)) + bodyStr = string(bodyBytes) + r.Body = io.NopCloser(bytes.NewBuffer(bodyBytes)) // 恢复以供上游读取 + } + + clientId := r.Header.Get("X-Client-Id") + userId := m.extractUserId(r) + clientIP := getClientIP(r) + + // 包装 ResponseWriter 捕获响应状态码和响应体 + rw := &responseCapture{ResponseWriter: w, statusCode: http.StatusOK} + + next(rw, r) + + latency := time.Since(startTime) + + record := &system.CreateOperationRecordReq{ + ClientId: clientId, + Ip: clientIP, + Method: r.Method, + Path: r.URL.Path, + Status: int32(rw.statusCode), + Latency: latency.Nanoseconds(), + Agent: truncate(r.UserAgent(), 500), + ErrorMessage: rw.errorMsg(), + Body: truncate(bodyStr, 2000), + Resp: truncate(rw.body.String(), 2000), + UserId: userId, + } + + // 异步写入,不阻塞响应 + select { + case m.logChan <- record: + default: + logx.Error("[zero-gateway] 操作日志缓冲区满,丢弃日志") + } + } +} + +// consumer 异步消费操作日志并通过 system-rpc 写入数据库 +func (m *OperationLogMiddleware) consumer() { + for record := range m.logChan { + _, err := m.systemRpc.CreateOperationRecord(context.Background(), record) + if err != nil { + logx.Errorf("[zero-gateway] 写入操作日志失败: %v", err) + } + } +} + +// extractUserId 从 Authorization 头解析 JWT 获取 userId +func (m *OperationLogMiddleware) extractUserId(r *http.Request) string { + // 优先从鉴权中间件注入的请求头获取(避免重复解析 JWT) + if uid := r.Header.Get("X-User-Id"); uid != "" { + return uid + } + // fallback: 自己解析 + authHeader := r.Header.Get("Authorization") + if authHeader == "" { + return "" + } + tokenStr := jwtUtil.GetTokenFromHeader(authHeader) + if tokenStr == "" { + return "" + } + j := jwtUtil.NewJWT(m.jwtSecret) + claims, err := j.ParseToken(tokenStr) + if err != nil { + return "" + } + return claims.BaseClaims.ID +} + +// responseCapture 捕获响应状态码和响应体 +type responseCapture struct { + http.ResponseWriter + statusCode int + body bytes.Buffer +} + +func (rc *responseCapture) WriteHeader(code int) { + rc.statusCode = code + rc.ResponseWriter.WriteHeader(code) +} + +func (rc *responseCapture) Write(b []byte) (int, error) { + if rc.body.Len() < 2048 { + rc.body.Write(b) + } + return rc.ResponseWriter.Write(b) +} + +func (rc *responseCapture) errorMsg() string { + if rc.statusCode >= 400 { + return rc.body.String() + } + return "" +} + +// getClientIP 获取真实客户端 IP +func getClientIP(r *http.Request) string { + if ip := r.Header.Get("X-Forwarded-For"); ip != "" { + return strings.Split(ip, ",")[0] + } + if ip := r.Header.Get("X-Real-Ip"); ip != "" { + return ip + } + addr := r.RemoteAddr + if idx := strings.LastIndex(addr, ":"); idx != -1 { + return addr[:idx] + } + return addr +} + +// truncate 截断字符串,防止写入过长内容 +func truncate(s string, maxLen int) string { + if len(s) > maxLen { + return s[:maxLen] + "..." + } + return s +} diff --git a/app/zero-gateway/zero-gateway.go b/app/zero-gateway/zero-gateway.go new file mode 100644 index 0000000..274000b --- /dev/null +++ b/app/zero-gateway/zero-gateway.go @@ -0,0 +1,68 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/system/rpc/systemservice" + "sundynix-micro-go/app/zero-gateway/internal/config" + "sundynix-micro-go/app/zero-gateway/internal/middleware" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/core/stat" + "github.com/zeromicro/go-zero/gateway" + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +var configFile = flag.String("f", "etc/zero-gateway.yaml", "the config file") + +func main() { + flag.Parse() + stat.DisableLog() + + var c config.Config + conf.MustLoad(*configFile, &c) + + // 初始化 system-rpc 客户端(用于异步写入操作日志) + systemRpc := systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)) + + // 构建各中间件实例 + corsMiddleware := middleware.NewCorsMiddleware( + c.Cors.AllowOrigins, + c.Cors.AllowMethods, + c.Cors.AllowHeaders, + ) + authMiddleware := middleware.NewAuthMiddleware(c.JwtSecret, c.AuthWhitelist) + opLogMiddleware := middleware.NewOperationLogMiddleware(systemRpc, c.JwtSecret) + + // 构建官方 Gateway,注入中间件(执行顺序:CORS → Auth → OpLog → 上游转发) + gw := gateway.MustNewServer(c.GatewayConf, + gateway.WithMiddleware( + rest.Middleware(corsMiddleware.Handle), // 跨域 + rest.Middleware(authMiddleware.Handle), // JWT 鉴权 + rest.Middleware(opLogMiddleware.Handle), // 操作日志(异步写入 system-rpc) + ), + ) + defer gw.Stop() + + fmt.Println("===== Sundynix Zero-Gateway (Official) =====") + logx.Infof("监听地址: %s:%d", c.Host, c.Port) + logx.Infof("上游服务: %d 个", len(c.Upstreams)) + logx.Infof("中间件: CORS | JWT鉴权 | 操作日志→system-rpc") + logx.Infof("鉴权白名单: %d 条", len(c.AuthWhitelist)) + for _, u := range c.Upstreams { + if u.Http.Target != "" { + logx.Infof(" [HTTP] %-15s -> %s (prefix: %s, routes: %d)", + u.Name, u.Http.Target, u.Http.Prefix, len(u.Mappings)) + } + if u.Grpc.Target != "" { + logx.Infof(" [gRPC] %-15s -> %s (routes: %d)", + u.Name, u.Grpc.Target, len(u.Mappings)) + } + } + fmt.Println("=============================================") + + gw.Start() +} diff --git a/common/utils/captcha/captcha.go b/common/utils/captcha/captcha.go new file mode 100644 index 0000000..9f28aad --- /dev/null +++ b/common/utils/captcha/captcha.go @@ -0,0 +1,66 @@ +package captcha + +import ( + "context" + "time" + + "github.com/mojocn/base64Captcha" + "github.com/redis/go-redis/v9" +) + +var store base64Captcha.Store + +// InitWithRedis 使用 Redis 存储初始化验证码 +func InitWithRedis(rdb *redis.Client) { + store = &redisStore{rdb: rdb, expiration: 5 * time.Minute} +} + +// Generate 生成图形验证码 +func Generate() (id string, b64s string, err error) { + if store == nil { + store = base64Captcha.DefaultMemStore // fallback + } + driver := base64Captcha.NewDriverDigit(80, 240, 5, 0.7, 80) + captcha := base64Captcha.NewCaptcha(driver, store) + id, b64s, _, err = captcha.Generate() + return +} + +// Verify 验证验证码(验证后自动清除) +func Verify(id, answer string) bool { + if store == nil { + return false + } + return store.Verify(id, answer, true) +} + +// =============== Redis Store 实现 =============== + +const keyPrefix = "captcha:" + +type redisStore struct { + rdb *redis.Client + expiration time.Duration +} + +func (s *redisStore) Set(id string, value string) error { + return s.rdb.Set(context.Background(), keyPrefix+id, value, s.expiration).Err() +} + +func (s *redisStore) Get(id string, clear bool) string { + ctx := context.Background() + key := keyPrefix + id + val, err := s.rdb.Get(ctx, key).Result() + if err != nil { + return "" + } + if clear { + s.rdb.Del(ctx, key) + } + return val +} + +func (s *redisStore) Verify(id, answer string, clear bool) bool { + v := s.Get(id, clear) + return v == answer +} diff --git a/common/utils/jwt/jwt.go b/common/utils/jwt/jwt.go index 9313772..c750cb6 100644 --- a/common/utils/jwt/jwt.go +++ b/common/utils/jwt/jwt.go @@ -18,7 +18,7 @@ var ( // BaseClaims 基础Claims type BaseClaims struct { - ID string `json:"id"` + ID string `json:"userId"` Account string `json:"account"` } diff --git a/deploy/Dockerfile b/deploy/Dockerfile new file mode 100644 index 0000000..cd27ec6 --- /dev/null +++ b/deploy/Dockerfile @@ -0,0 +1,18 @@ +# 纯运行镜像,不含 Go 编译环境 +# 二进制由本地 Mac 交叉编译后传入,构建更快 +FROM alpine:3.19 + +ARG SERVICE_NAME + +RUN apk add --no-cache ca-certificates tzdata && \ + cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + echo "Asia/Shanghai" > /etc/timezone + +WORKDIR /app + +# 从构建上下文拷贝预编译的二进制(由 build.sh 编译好) +COPY bin/${SERVICE_NAME} /app/service + +EXPOSE 8888 9001 9003 9103 + +ENTRYPOINT ["/app/service", "-f", "/app/etc/config.yaml"] diff --git a/deploy/build-origin.sh b/deploy/build-origin.sh new file mode 100755 index 0000000..c7b8be0 --- /dev/null +++ b/deploy/build-origin.sh @@ -0,0 +1,114 @@ +#!/bin/bash +set -e + +# ============================================ +# 本地交叉编译 + 推送 Harbor +# 用法: ./deploy/build.sh [服务名] +# ./deploy/build.sh # 构建全部 +# ./deploy/build.sh gateway # 只构建 gateway +# ============================================ + +HARBOR="192.168.100.140" +PROJECT="sundynix" +TAG="${BUILD_TAG:-latest}" + +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +DOCKERFILE="${ROOT_DIR}/deploy/Dockerfile" +BIN_DIR="${ROOT_DIR}/bin" + +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' + +log() { echo -e "${GREEN}[BUILD]${NC} $1"; } +err() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; } + +# 登录 Harbor +login_harbor() { + log "登录 Harbor: ${HARBOR}" + echo "sundynix" | docker login "${HARBOR}" -u admin --password-stdin 2>/dev/null \ + || err "Harbor 登录失败,请检查网络连接" + log "Harbor 登录成功 ✅" +} + +# 本地交叉编译(linux/amd64) +compile_service() { + local name=$1 + local path=$2 + + log "编译: ${name} (linux/amd64)" + mkdir -p "${BIN_DIR}" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ + -ldflags="-s -w" \ + -o "${BIN_DIR}/${name}" \ + "${ROOT_DIR}/${path}" + log "编译完成: bin/${name}" +} + +# 打包镜像并推送 +docker_push() { + local name=$1 + local image="${HARBOR}/${PROJECT}/${name}:${TAG}" + + log "打包镜像: ${image}" + docker build \ + --platform linux/amd64 \ + --build-arg SERVICE_NAME="${name}" \ + -t "${image}" \ + -f "${DOCKERFILE}" \ + "${ROOT_DIR}" + + log "推送: ${image}" + docker push "${image}" + log "${name} 推送完成 ✅" +} + +# 编译 + 推送单个服务 +build_service() { + local name=$1 + local path=$2 + + log "────────────────────────────────────" + log "服务: ${name}" + compile_service "$name" "$path" + docker_push "$name" +} + +build_all() { + build_service "system-rpc" "app/system/rpc" + build_service "auth-api" "app/auth/api" + build_service "system-api" "app/system/api" + build_service "gateway" "app/gateway" +} + +build_one() { + case "$1" in + system-rpc) build_service "system-rpc" "app/system/rpc" ;; + auth-api) build_service "auth-api" "app/auth/api" ;; + system-api) build_service "system-api" "app/system/api" ;; + gateway) build_service "gateway" "app/gateway" ;; + *) err "未知服务: $1\n可选: system-rpc | auth-api | system-api | gateway" ;; + esac +} + +main() { + cd "${ROOT_DIR}" + login_harbor + + if [ -n "$1" ]; then + build_one "$1" + else + build_all + fi + + # 清理编译产物 + rm -rf "${BIN_DIR}" + + echo "" + log "============================================" + log "构建推送完成 🎉" + log "镜像地址: ${HARBOR}/${PROJECT}/<服务名>:${TAG}" + log "============================================" +} + +main "$@" diff --git a/deploy/build.sh b/deploy/build.sh new file mode 100755 index 0000000..15abd96 --- /dev/null +++ b/deploy/build.sh @@ -0,0 +1,106 @@ +#!/bin/bash +set -e + +# ============================================ +# 本地交叉编译 → 打包镜像 → 通过 SSH 直传 dev 服务器 +# 不依赖 Harbor,绕过 HTTPS 问题 +# 用法: ./deploy/build.sh [服务名] +# ./deploy/build.sh # 全部 +# ./deploy/build.sh gateway # 单个 +# ============================================ + +DEV_HOST="192.168.100.128" +DEV_USER="root" +PROJECT="sundynix" +TAG="${BUILD_TAG:-latest}" + +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +DOCKERFILE="${ROOT_DIR}/deploy/Dockerfile" +BIN_DIR="${ROOT_DIR}/bin" + +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NC='\033[0m' + +log() { echo -e "${GREEN}[BUILD]${NC} $1"; } +warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } +err() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; } + +# 本地交叉编译(linux/amd64) +compile_service() { + local name=$1 + local path=$2 + log "编译: ${name} (linux/amd64)" + mkdir -p "${BIN_DIR}" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ + -ldflags="-s -w" \ + -o "${BIN_DIR}/${name}" \ + "${ROOT_DIR}/${path}" + log "编译完成 ✅" +} + +# 打包镜像并通过 SSH 直传 dev 服务器 +docker_deploy() { + local name=$1 + local image="${PROJECT}/${name}:${TAG}" + + log "打包镜像: ${image}" + DOCKER_BUILDKIT=0 docker build \ + --build-arg SERVICE_NAME="${name}" \ + -t "${image}" \ + -f "${DOCKERFILE}" \ + "${ROOT_DIR}" + + log "传输镜像到 ${DEV_HOST}(通过 SSH 管道,无需 Harbor)..." + docker save "${image}" | ssh ${DEV_USER}@${DEV_HOST} "docker load" + log "${name} 部署完成 ✅" +} + +# 编译 + 部署单个服务 +build_service() { + local name=$1 + local path=$2 + log "════════════════════════════════════" + log "服务: ${name}" + compile_service "$name" "$path" + docker_deploy "$name" +} + +build_all() { + build_service "system-rpc" "app/system/rpc" + build_service "auth-api" "app/auth/api" + build_service "system-api" "app/system/api" + build_service "gateway" "app/gateway" +} + +build_one() { + case "$1" in + system-rpc) build_service "system-rpc" "app/system/rpc" ;; + auth-api) build_service "auth-api" "app/auth/api" ;; + system-api) build_service "system-api" "app/system/api" ;; + gateway) build_service "gateway" "app/gateway" ;; + *) err "未知服务: $1\n可选: system-rpc | auth-api | system-api | gateway" ;; + esac +} + +main() { + cd "${ROOT_DIR}" + + if [ -n "$1" ]; then + build_one "$1" + else + build_all + fi + + # 清理本地编译产物 + rm -rf "${BIN_DIR}" + + echo "" + log "════════════════════════════════════" + log "全部完成 🎉 镜像已传至 ${DEV_HOST}" + log "在 dev 服务器上执行: cd /opt/sundynix && docker-compose up -d" + log "════════════════════════════════════" +} + +main "$@" diff --git a/deploy/deploy-dev.sh b/deploy/deploy-dev.sh new file mode 100755 index 0000000..a221a9b --- /dev/null +++ b/deploy/deploy-dev.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +# ============================================ +# 部署脚本 — 在 dev 服务器(192.168.100.128)上执行 +# 用法: +# 本地执行: ./deploy/deploy-dev.sh +# 会自动 SSH 到 dev 服务器完成部署 +# ============================================ + +DEV_HOST="192.168.100.128" +DEV_USER="root" +DEPLOY_DIR="/opt/sundynix" + +HARBOR="192.168.100.140" + +# 本地项目根目录 +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +CONFIG_DIR="${ROOT_DIR}/deploy/dev" + +echo "==========================================" +echo " Sundynix Dev 环境部署" +echo " 目标: ${DEV_USER}@${DEV_HOST}" +echo "==========================================" + +# 1. 在 dev 服务器上创建目录结构 +echo "[1/4] 创建远程目录..." +ssh ${DEV_USER}@${DEV_HOST} "mkdir -p ${DEPLOY_DIR}/config" + +# 2. 同步配置文件到 dev 服务器 +echo "[2/4] 同步配置文件..." +scp ${CONFIG_DIR}/system-rpc.yaml ${DEV_USER}@${DEV_HOST}:${DEPLOY_DIR}/config/ +scp ${CONFIG_DIR}/auth-api.yaml ${DEV_USER}@${DEV_HOST}:${DEPLOY_DIR}/config/ +scp ${CONFIG_DIR}/system-api.yaml ${DEV_USER}@${DEV_HOST}:${DEPLOY_DIR}/config/ +scp ${CONFIG_DIR}/gateway.yaml ${DEV_USER}@${DEV_HOST}:${DEPLOY_DIR}/config/ +scp ${CONFIG_DIR}/docker-compose.yml ${DEV_USER}@${DEV_HOST}:${DEPLOY_DIR}/ + +# 3. SSH 到 dev 服务器执行部署 +echo "[3/4] 拉取镜像并启动服务..." +ssh ${DEV_USER}@${DEV_HOST} << 'REMOTE_SCRIPT' +set -e +cd /opt/sundynix + +# 停止旧容器并用已加载的镜像启动 +docker compose down --remove-orphans 2>/dev/null || true +docker compose up -d + +# 等待 3 秒后检查状态 +sleep 3 +echo "" +echo "========== 容器状态 ==========" +docker compose ps +echo "" +echo "========== 最近日志 ==========" +docker compose logs --tail=10 +REMOTE_SCRIPT + +echo "" +echo "[4/4] 部署完成 ✅" +echo "" +echo " 网关地址: http://${DEV_HOST}:8888" +echo " auth-api: http://${DEV_HOST}:9001" +echo " system-api: http://${DEV_HOST}:9003" +echo " system-rpc: ${DEV_HOST}:9103" +echo "" +echo " 验证: curl http://${DEV_HOST}:8888/api/auth/captcha" diff --git a/deploy/dev/auth-api.yaml b/deploy/dev/auth-api.yaml new file mode 100644 index 0000000..964e463 --- /dev/null +++ b/deploy/dev/auth-api.yaml @@ -0,0 +1,23 @@ +Name: auth-api + +Log: + Encoding: plain +Host: 0.0.0.0 +Port: 9001 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# system-rpc +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# Redis(验证码存储,DB2) +Redis: + Host: 192.168.100.127:6379 + Pass: sundynix + DB: 2 diff --git a/deploy/dev/docker-compose.yml b/deploy/dev/docker-compose.yml new file mode 100644 index 0000000..047e0f7 --- /dev/null +++ b/deploy/dev/docker-compose.yml @@ -0,0 +1,61 @@ +version: "3.8" + +# Sundynix Dev 环境 +# 部署到 192.168.100.128 +# 镜像从 Harbor 192.168.100.140 拉取 + +services: + system-rpc: + image: sundynix/system-rpc:latest + container_name: system-rpc + restart: always + ports: + - "9103:9103" + volumes: + - ./config/system-rpc.yaml:/app/etc/config.yaml + networks: + - sundynix + + auth-api: + image: sundynix/auth-api:latest + container_name: auth-api + restart: always + ports: + - "9001:9001" + volumes: + - ./config/auth-api.yaml:/app/etc/config.yaml + depends_on: + - system-rpc + networks: + - sundynix + + system-api: + image: sundynix/system-api:latest + container_name: system-api + restart: always + ports: + - "9003:9003" + volumes: + - ./config/system-api.yaml:/app/etc/config.yaml + depends_on: + - system-rpc + networks: + - sundynix + + gateway: + image: sundynix/gateway:latest + container_name: gateway + restart: always + ports: + - "8888:8888" + volumes: + - ./config/gateway.yaml:/app/etc/config.yaml + depends_on: + - auth-api + - system-api + networks: + - sundynix + +networks: + sundynix: + driver: bridge diff --git a/deploy/dev/gateway.yaml b/deploy/dev/gateway.yaml new file mode 100644 index 0000000..70ba8ff --- /dev/null +++ b/deploy/dev/gateway.yaml @@ -0,0 +1,49 @@ +Name: gateway +Host: 0.0.0.0 +Port: 8888 + +Log: + Encoding: plain + Mode: console + +# 跨域配置 +Cors: + Enable: true + AllowOrigins: + - "*" + AllowMethods: + - GET + - POST + - PUT + - DELETE + - OPTIONS + AllowHeaders: + - Content-Type + - Authorization + - X-Requested-With + - X-Client-Id + +# system-rpc 连接(用于写入操作日志) +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# JWT 密钥 +JwtSecret: "9149f2eb-d517-4a50-a03a-231dbcf0d872" + +# 鉴权白名单 +AuthWhitelist: + - /api/auth/login + - /api/auth/loginByPhone + - /api/auth/miniLogin + - /api/auth/captcha + - /api/plant/callback/wechatpay + +# 上游服务路由表(使用 docker-compose 服务名) +Upstreams: + - Prefix: /api/auth + Target: http://auth-api:9001 + - Prefix: /api/sys + Target: http://system-api:9003 diff --git a/app/user/api/etc/user-api.yaml b/deploy/dev/system-api.yaml similarity index 60% rename from app/user/api/etc/user-api.yaml rename to deploy/dev/system-api.yaml index 98bafc0..8356a14 100644 --- a/app/user/api/etc/user-api.yaml +++ b/deploy/dev/system-api.yaml @@ -1,17 +1,16 @@ -Name: user-api +Name: system-api Log: Encoding: plain Host: 0.0.0.0 -Port: 9001 +Port: 9003 Auth: AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 - AccessExpire: 7200 + AccessExpire: 604800 -# user-rpc 服务配置 -UserRpc: +SystemRpc: Etcd: Hosts: - 192.168.100.127:2379 - Key: user.rpc + Key: system.rpc diff --git a/app/radio/rpc/etc/radio.yaml b/deploy/dev/system-rpc.yaml similarity index 73% rename from app/radio/rpc/etc/radio.yaml rename to deploy/dev/system-rpc.yaml index 295c337..e76f2dc 100644 --- a/app/radio/rpc/etc/radio.yaml +++ b/deploy/dev/system-rpc.yaml @@ -1,12 +1,13 @@ -Name: radio.rpc +Name: system.rpc Log: Encoding: plain -ListenOn: 0.0.0.0:9015 +ListenOn: 0.0.0.0:9103 Etcd: Hosts: - 192.168.100.127:2379 - Key: radio.rpc + Key: system.rpc +# MySQL DB: DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local diff --git a/docs/API_DOCS.md b/docs/API_DOCS.md index c2c2b51..06fc153 100644 --- a/docs/API_DOCS.md +++ b/docs/API_DOCS.md @@ -1,22 +1,131 @@ -# Sundynix 微服务 API 文档 +# Sundynix 前端接入文档 -> Base URL 约定: 各服务独立部署,通过 Nginx 统一代理 +> 网关地址:`http://{GATEWAY_HOST}:8888` +> 所有接口统一经过网关转发,前端只需对接网关地址 --- -## 一、用户服务 (user-api) — 端口 9001 +## 一、全局约定 -### 1.1 公开接口(无需鉴权) +### 1.1 统一响应格式 + +所有接口返回 **HTTP 200**,通过 `code` 区分业务状态: -#### POST /api/user/miniLogin — 微信小程序登录 -**请求体:** ```json { - "code": "微信wx.login获取的code", - "clientId": "客户端标识(plant/radio)" + "code": 200, + "msg": "success", + "data": { ... } } ``` -**响应:** + +| code | 含义 | +|:----:|------| +| 200 | 成功 | +| 400 | 业务错误(参数错误、逻辑异常等) | +| 401 | 未授权(Token 缺失/过期/无效) | + +### 1.2 鉴权机制 + +需要鉴权的接口必须携带以下请求头: + +``` +Authorization: Bearer +X-Client-Id: <客户端标识> +``` + +> [!IMPORTANT] +> - `Authorization` 从登录接口获取 +> - `X-Client-Id` 由后台管理端配置的客户端标识(如 `sundynix-admin`、`mini-app`) + +### 1.3 Token 自动续期 + +网关内置**滑动窗口续期**机制。当 Token 剩余有效时间 < 1 小时时,响应头会携带新 Token: + +``` +X-Refresh-Token: +``` + +前端需要在响应拦截器中处理: + +```ts +// axios 响应拦截器 +axios.interceptors.response.use((response) => { + const newToken = response.headers['x-refresh-token'] + if (newToken) { + // 静默替换本地存储的 Token + useUserStore().setToken(newToken) + } + return response +}) +``` + +### 1.4 CORS 说明 + +网关已配置跨域,前端无需额外处理。已暴露自定义响应头 `X-Refresh-Token`。 + +--- + +## 二、Auth 服务(`/api/auth`) + +### 2.1 获取图形验证码 + +> 🔓 无需鉴权 + +``` +GET /api/auth/captcha +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "captchaId": "abc123", + "captchaImg": "data:image/png;base64,iVBOR..." + } +} +``` + +| 字段 | 类型 | 说明 | +|------|------|------| +| captchaId | string | 验证码 ID,登录时回传 | +| captchaImg | string | Base64 图片,直接赋给 `` | + +--- + +### 2.2 账号密码登录 + +> 🔓 无需鉴权 + +``` +POST /api/auth/login +``` + +**请求头**: +``` +X-Client-Id: sundynix-admin +``` + +**请求体**: +```json +{ + "account": "admin", + "password": "123456", + "captchaId": "abc123", + "captcha": "5xmn" +} +``` + +| 字段 | 必填 | 说明 | +|------|:----:|------| +| account | ✅ | 账号 | +| password | ✅ | 密码 | +| captchaId | ✅ | 验证码 ID(从 captcha 接口获取) | +| captcha | ✅ | 用户输入的验证码 | + +**响应**: ```json { "code": 200, @@ -24,14 +133,13 @@ "data": { "token": "eyJhbGciOiJIUzI1NiIs...", "userInfo": { - "id": "uuid", - "name": "用户u278bb", - "nickName": "", - "phone": "", - "openId": "oXxx...", - "avatarId": "", - "gender": 0, - "isVip": 0 + "id": "1234567890", + "name": "张三", + "account": "admin", + "nickName": "管理员", + "phone": "13800138000", + "avatarId": "file-id-xxx", + "gender": 1 } } } @@ -39,364 +147,904 @@ --- -#### POST /api/user/loginByPhone — 手机号登录 -**请求体:** +### 2.3 微信小程序登录 + +> 🔓 无需鉴权 + +``` +POST /api/auth/miniLogin +``` + +**请求体**: ```json { - "code": "微信getPhoneNumber获取的code", + "code": "wx_login_code_from_wx.login()", + "clientId": "mini-app" +} +``` + +**响应**:同 2.2 的响应格式 + +--- + +### 2.4 手机号登录 + +> 🔓 无需鉴权 + +``` +POST /api/auth/loginByPhone +``` + +**请求体**: +```json +{ + "code": "phone_code_from_getPhoneNumber", "openId": "用户openId", - "clientId": "客户端标识" + "clientId": "mini-app" } ``` -**响应:** 同 miniLogin + +**响应**:同 2.2 的响应格式 --- -#### POST /api/user/login — 账号密码登录 -**请求体:** -```json -{ - "account": "账号", - "password": "密码" -} +### 2.5 获取当前用户信息(含角色、菜单) + +> 🔒 需要鉴权 + +``` +GET /api/auth/info ``` -**响应:** 同 miniLogin ---- - -### 1.2 鉴权接口(Header: Authorization: Bearer {token}) - -#### GET /api/user/info — 获取当前用户信息 -**响应:** +**响应**: ```json { "code": 200, "msg": "success", "data": { - "userInfo": { /* 用户完整信息 */ } + "id": "1234567890", + "name": "张三", + "account": "admin", + "nickName": "管理员", + "phone": "13800138000", + "avatarId": "file-id-xxx", + "gender": 1, + "roles": ["admin", "editor"], + "menus": [ + { + "id": "m1", + "parentId": "0", + "category": 1, + "name": "Dashboard", + "title": "仪表盘", + "code": "dashboard", + "path": "/dashboard", + "permission": "", + "locale": "menu.dashboard", + "icon": "icon-dashboard", + "sort": 1, + "children": [ + { + "id": "m2", + "parentId": "m1", + "name": "Workplace", + "title": "工作台", + "path": "/dashboard/workplace", + "sort": 1, + "children": [] + } + ] + } + ], + "createdAt": 1714000000 } } ``` +> [!TIP] +> - `roles` 是角色 code 数组,用于前端权限判断 +> - `menus` 是树形结构,已按 `sort` 排序,前端直接渲染侧边栏 +> - `createdAt` 是 Unix 时间戳(秒) + --- -#### PUT /api/user/update — 更新用户信息 -**请求体:** +### 2.6 更新个人信息 + +> 🔒 需要鉴权 + +``` +POST /api/auth/update +``` + +**请求体**(所有字段可选,只传需要修改的): ```json { - "name": "新名字", - "account": "新账号", - "phone": "13800138000", - "avatarId": "文件ID", - "nickName": "昵称" + "name": "李四", + "nickName": "小李", + "phone": "13900139000", + "avatarId": "new-file-id" } ``` ---- - -#### PUT /api/user/changePassword — 修改密码 +**响应**: ```json -{ "oldPassword": "旧密码", "newPassword": "新密码" } +{ "code": 200, "msg": "success" } ``` --- -#### POST /api/user/list — 用户列表(管理后台) -```json -{ "current": 1, "pageSize": 10, "account": "", "phone": "" } -``` -**响应:** -```json -{ - "code": 200, - "data": { "list": [], "total": 0, "current": 1, "size": 10 } -} -``` +## 三、System 服务(`/api/sys`) + +> [!IMPORTANT] +> 以下所有接口均需要鉴权(`Authorization: Bearer `) --- -#### DELETE /api/user/delete — 删除用户 -```json -{ "ids": ["id1", "id2"] } -``` - ---- - -#### GET /api/user/location?longitude=116.40&latitude=39.90 — 获取位置 - -#### GET /api/user/weather?adcode=110000 — 获取天气 - ---- - -## 二、文件服务 (file-api) — 端口 9002 - -> 所有接口需要鉴权 - -#### POST /api/file/upload — 上传文件 -**请求:** `multipart/form-data`,字段名 `file` -**响应:** -```json -{ - "code": 200, - "data": { - "id": "文件ID", - "name": "filename.jpg", - "url": "https://res.sundynix.cn/...", - "suffix": "jpg", - "md5": "abc123..." - } -} -``` - ---- - -#### DELETE /api/file/delete — 删除文件 -```json -{ "ids": ["fileId1", "fileId2"] } -``` - ---- - -#### POST /api/file/list — 文件列表 -```json -{ "current": 1, "pageSize": 10, "name": "" } -``` - ---- - -#### GET /api/file/:id — 获取文件详情 - ---- - -## 三、系统服务 (system-api) — 端口 9003 - -> 所有接口需要鉴权 - ### 3.1 客户端管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/sys/client/create | 创建客户端 | -| PUT | /api/sys/client/update | 更新客户端 | -| DELETE | /api/sys/client/delete | 删除客户端 | -| POST | /api/sys/client/list | 客户端列表 | -### 3.2 角色管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/sys/role/create | 创建角色 | -| PUT | /api/sys/role/update | 更新角色 | -| DELETE | /api/sys/role/delete | 删除角色 | -| POST | /api/sys/role/list | 角色列表 | +#### 创建客户端 -### 3.3 菜单管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/sys/menu/create | 创建菜单 | -| PUT | /api/sys/menu/update | 更新菜单 | -| DELETE | /api/sys/menu/delete | 删除菜单 | -| GET | /api/sys/menu/list | 菜单树形列表 | -| POST | /api/sys/menu/byRole | 根据角色获取菜单 | - -### 3.4 操作日志 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/sys/log/list | 操作日志列表 | -| DELETE | /api/sys/log/delete | 删除日志 | - -### 3.5 字典管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/sys/dict/create | 创建字典 | -| PUT | /api/sys/dict/update | 更新字典 | -| DELETE | /api/sys/dict/delete | 删除字典 | -| POST | /api/sys/dict/list | 字典列表 | - ---- - -## 四、植物服务 (plant-api) — 端口 9004 - -### 4.1 公开接口 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/plant/callback/wechatpay | 微信支付回调 | - -### 4.2 我的植物(需鉴权) -| 方法 | 路径 | 说明 | 请求体示例 | -|------|------|------|-----------| -| POST | /api/plant/my/create | 创建植物 | `{name, plantTime, placement, imgIds[]}` | -| PUT | /api/plant/my/update | 更新植物 | `{id, name, status, ...}` | -| DELETE | /api/plant/my/delete | 删除植物 | `{ids[]}` | -| POST | /api/plant/my/list | 植物列表 | `{current, pageSize, name}` | -| GET | /api/plant/my/:id | 植物详情 | — | -| POST | /api/plant/my/carePlan | 添加养护计划 | `{plantId, name, targetAction, period}` | -| POST | /api/plant/my/careRecord | 添加养护记录 | `{plantId, planId, action}` | -| POST | /api/plant/my/growthRecord | 添加成长记录 | `{plantId, content, imgIds[]}` | - -### 4.3 百科 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/plant/wiki/list | 百科列表 | -| GET | /api/plant/wiki/:id | 百科详情 | -| GET | /api/plant/wiki/class/list | 分类列表 | -| POST | /api/plant/wiki/class/create | 创建分类 | -| POST | /api/plant/wiki/star | 收藏/取消百科 | - -### 4.4 社区帖子 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/plant/post/create | 发布帖子 | -| POST | /api/plant/post/list | 帖子列表 | -| GET | /api/plant/post/:id | 帖子详情 | -| DELETE | /api/plant/post/delete | 删除帖子 | -| POST | /api/plant/post/comment | 评论帖子 | -| POST | /api/plant/post/like | 点赞帖子 | - -### 4.5 其他 -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | /api/plant/topic/list | 话题列表 | -| POST | /api/plant/topic/create | 创建话题 | -| POST | /api/plant/ocr/classify | OCR植物识别 | -| POST | /api/plant/exchange/list | 兑换商品列表 | -| POST | /api/plant/exchange/order | 兑换商品 | -| POST | /api/plant/ai/chat | AI问答 | -| GET | /api/plant/ai/history | 聊天历史 | -| GET | /api/plant/profile/info | 获取用户资料 | -| PUT | /api/plant/profile/update | 更新用户资料 | -| POST | /api/plant/config/level/list | 等级配置列表 | -| POST | /api/plant/config/badge/list | 徽章配置列表 | - ---- - -## 五、电台服务 (radio-api) — 端口 9005 - -### 5.1 公开接口 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/callback/wechatpay | 微信支付回调 | - -### 5.2 分类管理(需鉴权) -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/category/create | 创建分类 | -| PUT | /api/radio/category/update | 更新分类 | -| DELETE | /api/radio/category/delete | 删除分类 | -| POST | /api/radio/category/list | 分类列表 | - -### 5.3 频道管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/channel/create | 创建频道 | -| PUT | /api/radio/channel/update | 更新频道 | -| DELETE | /api/radio/channel/delete | 删除频道 | -| POST | /api/radio/channel/list | 频道列表 | -| GET | /api/radio/channel/:id | 频道详情 | - -### 5.4 节目管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/program/create | 创建节目 | -| PUT | /api/radio/program/update | 更新节目 | -| DELETE | /api/radio/program/delete | 删除节目 | -| POST | /api/radio/program/list | 节目列表 | -| GET | /api/radio/program/:id | 节目详情 | -| POST | /api/radio/program/tts | TTS生成音频 | - -### 5.5 音色管理 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/voice/create | 创建音色 | -| PUT | /api/radio/voice/update | 更新音色 | -| DELETE | /api/radio/voice/delete | 删除音色 | -| POST | /api/radio/voice/list | 音色列表 | - -### 5.6 用户互动 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/interaction/like | 点赞/取消 | -| POST | /api/radio/interaction/favorite | 收藏/取消 | -| POST | /api/radio/interaction/comment | 评论节目 | -| POST | /api/radio/interaction/history | 记录播放历史 | -| POST | /api/radio/interaction/history/list | 播放历史 | -| POST | /api/radio/interaction/favorite/list | 收藏列表 | - -### 5.7 订阅/支付/VIP -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | /api/radio/subscription/list | 我的订阅 | -| POST | /api/radio/pay/create | 创建支付订单 | -| POST | /api/radio/vip/list | VIP配置列表 | -| GET | /api/radio/vip/info | 我的VIP信息 | - -### 5.8 数据分析 -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/radio/analytics/overview | 数据概览 | -| POST | /api/radio/analytics/channel | 频道数据 | -| POST | /api/radio/analytics/user | 用户数据 | - ---- - -## 六、统一规约 - -### 6.1 鉴权方式 -所有需要鉴权的接口,请在请求头中携带: ``` -Authorization: Bearer {token} +POST /api/sys/client/create ``` -### 6.2 统一响应格式 ```json { - "code": 200, // 200成功,400失败,401未授权 - "msg": "success", - "data": {} // 具体数据 + "clientId": "sundynix-admin", + "name": "Web管理端", + "grantType": "password", + "additionalInfo": "", + "activeTimeout": 7200 } ``` -### 6.3 分页请求格式 -```json -{ "current": 1, "pageSize": 10 } +| 字段 | 必填 | 说明 | +|------|:----:|------| +| clientId | ✅ | 客户端唯一标识 | +| name | ✅ | 客户端名称 | +| grantType | ❌ | 授权类型 | +| additionalInfo | ❌ | 附加信息 | +| activeTimeout | ❌ | Token 有效期(秒),默认 7200 | + +#### 更新客户端 + +``` +POST /api/sys/client/update ``` -### 6.4 分页响应格式 ```json { - "list": [], - "total": 100, - "current": 1, - "size": 10 + "id": "客户端记录ID", + "name": "新名称", + "activeTimeout": 3600 } ``` -### 6.5 删除请求格式 +#### 删除客户端 + +``` +POST /api/sys/client/delete +``` + ```json { "ids": ["id1", "id2"] } ``` +#### 客户端列表 + +``` +POST /api/sys/client/list +``` + +```json +{ + "current": 1, + "pageSize": 10, + "name": "" +} +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "list": [ + { + "id": "xxx", + "clientId": "sundynix-admin", + "name": "Web管理端", + "grantType": "password", + "additionalInfo": "", + "activeTimeout": 7200 + } + ], + "total": 1, + "current": 1, + "size": 10 + } +} +``` + --- -## 七、数据库设计说明 +### 3.2 角色管理 -### 7.1 用户扩展表设计 - -基础用户表 `sundynix_user` 只存储**认证和通用信息**(账号、密码、OpenID、手机号等),各业务服务通过扩展表存储业务特有的用户数据: +#### 创建角色 ``` -sundynix_user (基础) - ├── sundynix_plant_user_profile (植物服务扩展:等级、阳光值、养护统计) - └── sundynix_radio_user_profile (电台服务扩展:VIP状态、VIP到期时间) +POST /api/sys/role/create ``` -**设计原则:** 新增业务产品时,只需创建新的扩展表,无需修改基础用户表。 +```json +{ + "name": "管理员", + "code": "admin", + "sort": 1, + "menuIds": ["menu-id-1", "menu-id-2"] +} +``` -### 7.2 数据库拆分 +#### 更新角色 -| 数据库 | 包含的表 | -|--------|---------| -| sundynix_user | sundynix_user, sundynix_user_role | -| sundynix_file | sundynix_oss | -| sundynix_system | sundynix_client, sundynix_role, sundynix_menu, sundynix_role_menu, sundynix_user_role, sundynix_dict, sundynix_operation_record | -| sundynix_plant | sundynix_plant_user_profile, sundynix_my_plant, sundynix_care_plan, sundynix_care_record, sundynix_care_task, sundynix_growth_record, sundynix_wiki, sundynix_wiki_class, sundynix_post, sundynix_post_comment, sundynix_post_like, sundynix_post_topic, sundynix_user_star, sundynix_exchange_item, sundynix_exchange_order, sundynix_level_config, sundynix_badge_config, sundynix_user_badge, sundynix_ai_chat_history | -| sundynix_radio | sundynix_radio_user_profile, sundynix_radio_category, sundynix_radio_channel, sundynix_radio_program, sundynix_radio_voice, sundynix_radio_like, sundynix_radio_favorite, sundynix_radio_comment, sundynix_radio_history, sundynix_radio_subscription, sundynix_radio_subscription_order, sundynix_radio_pay_notify, sundynix_radio_vip_config, sundynix_radio_listen_log | +``` +POST /api/sys/role/update +``` +```json +{ + "id": "角色ID", + "name": "超级管理员", + "code": "super-admin", + "sort": 0, + "menuIds": ["menu-id-1", "menu-id-2", "menu-id-3"] +} +``` + +> [!NOTE] +> `menuIds` 是**全量替换**,传什么就关联什么。不传或空数组则清除所有菜单关联。 + +#### 删除角色 + +``` +POST /api/sys/role/delete +``` + +```json +{ "ids": ["role-id-1"] } +``` + +#### 角色列表 + +``` +POST /api/sys/role/list +``` + +```json +{ + "current": 1, + "pageSize": 10, + "name": "" +} +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "list": [ + { + "id": "xxx", + "name": "管理员", + "code": "admin", + "sort": 1, + "menuIds": ["m1", "m2"] + } + ], + "total": 1 + } +} +``` + +--- + +### 3.3 菜单管理 + +#### 创建菜单 + +``` +POST /api/sys/menu/create +``` + +```json +{ + "parentId": "0", + "category": 1, + "name": "Dashboard", + "title": "仪表盘", + "code": "dashboard", + "path": "/dashboard", + "permission": "", + "locale": "menu.dashboard", + "icon": "icon-dashboard", + "sort": 1 +} +``` + +| 字段 | 说明 | +|------|------| +| parentId | 父级ID,顶级菜单传 `"0"` 或空字符串 | +| category | 类型:1=菜单 2=按钮/权限 | +| name | 路由 name(英文,如 `Dashboard`) | +| title | 显示标题(中文,如 `仪表盘`) | +| code | 权限标识(如 `dashboard`) | +| path | 路由路径(如 `/dashboard`) | +| permission | 操作权限标识 | +| locale | 国际化 key | +| icon | 图标名称 | +| sort | 排序值,越小越靠前 | + +#### 更新菜单 + +``` +POST /api/sys/menu/update +``` + +```json +{ + "id": "菜单ID", + "title": "新标题", + "sort": 2 +} +``` + +#### 删除菜单 + +``` +POST /api/sys/menu/delete +``` + +```json +{ "ids": ["menu-id-1"] } +``` + +> [!WARNING] +> 删除菜单会同步清除该菜单与所有角色的关联关系 + +#### 菜单列表(树形) + +``` +GET /api/sys/menu/list +``` + +无参数。返回完整的树形菜单结构。 + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": [ + { + "id": "m1", + "parentId": "0", + "category": 1, + "name": "System", + "title": "系统管理", + "code": "system", + "path": "/system", + "icon": "icon-settings", + "sort": 99, + "children": [ + { + "id": "m2", + "parentId": "m1", + "name": "User", + "title": "用户管理", + "path": "/system/user", + "sort": 1, + "children": [] + } + ] + } + ] +} +``` + +#### 根据角色获取菜单 + +``` +POST /api/sys/menu/byRole +``` + +```json +{ "id": "角色ID" } +``` + +**响应**:同菜单列表格式,但只包含该角色关联的菜单 + +--- + +### 3.4 用户管理(后台管理) + +#### 用户列表 + +``` +POST /api/sys/user/list +``` + +```json +{ + "current": 1, + "pageSize": 10, + "name": "", + "account": "" +} +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "list": [ + { + "id": "xxx", + "name": "张三", + "account": "admin", + "nickName": "管理员", + "phone": "13800138000", + "gender": 1, + "createdAt": 1714000000 + } + ], + "total": 1 + } +} +``` + +#### 创建用户 + +``` +POST /api/sys/user/create +``` + +```json +{ + "name": "张三", + "account": "zhangsan", + "password": "123456", + "phone": "13800138000", + "nickName": "小张", + "roleIds": ["role-id-1", "role-id-2"] +} +``` + +| 字段 | 必填 | 说明 | +|------|:----:|------| +| name | ✅ | 姓名 | +| account | ✅ | 账号(唯一) | +| password | ✅ | 密码 | +| phone | ❌ | 手机号 | +| nickName | ❌ | 昵称 | +| roleIds | ❌ | 关联角色ID数组 | + +#### 更新用户 + +``` +POST /api/sys/user/update +``` + +```json +{ + "id": "用户ID", + "name": "李四", + "phone": "13900139000", + "roleIds": ["role-id-1"] +} +``` + +#### 删除用户 + +``` +POST /api/sys/user/delete +``` + +```json +{ "ids": ["user-id-1", "user-id-2"] } +``` + +#### 重置密码 + +``` +POST /api/sys/user/resetPassword +``` + +```json +{ + "id": "用户ID", + "password": "newpassword123" +} +``` + +--- + +### 3.5 字典管理 + +#### 创建字典 + +``` +POST /api/sys/dict/create +``` + +```json +{ + "type": "gender", + "label": "男", + "value": "1", + "sort": 1, + "desc": "性别-男" +} +``` + +#### 更新字典 + +``` +POST /api/sys/dict/update +``` + +```json +{ + "id": "字典ID", + "label": "女", + "value": "2" +} +``` + +#### 删除字典 + +``` +POST /api/sys/dict/delete +``` + +```json +{ "ids": ["dict-id-1"] } +``` + +#### 字典列表 + +``` +POST /api/sys/dict/list +``` + +```json +{ + "current": 1, + "pageSize": 10, + "type": "gender" +} +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "list": [ + { + "id": "xxx", + "type": "gender", + "label": "男", + "value": "1", + "sort": 1, + "desc": "性别-男" + } + ], + "total": 2 + } +} +``` + +--- + +### 3.6 操作日志 + +#### 日志列表 + +``` +POST /api/sys/log/list +``` + +```json +{ + "current": 1, + "pageSize": 20, + "method": "POST", + "path": "/api/auth/login", + "status": 200 +} +``` + +**响应**: +```json +{ + "code": 200, + "msg": "success", + "data": { + "list": [ + { + "id": "xxx", + "clientId": "sundynix-admin", + "ip": "192.168.1.100", + "method": "POST", + "path": "/api/auth/login", + "status": 200, + "latency": 52000000, + "agent": "Mozilla/5.0...", + "errorMessage": "", + "body": "{\"account\":\"admin\"...}", + "resp": "{\"code\":200...}", + "userId": "user-id-xxx", + "createdAt": 1714000000 + } + ], + "total": 100 + } +} +``` + +> [!NOTE] +> `latency` 单位是纳秒,前端显示时需转换:`(latency / 1000000).toFixed(0) + 'ms'` + +#### 删除日志 + +``` +POST /api/sys/log/delete +``` + +```json +{ "ids": ["log-id-1", "log-id-2"] } +``` + +--- + +## 四、前端接入参考 + +### 4.1 Axios 封装建议 + +```ts +import axios from 'axios' + +const request = axios.create({ + baseURL: 'http://192.168.100.4:8888', // 网关地址 + timeout: 10000, +}) + +// 请求拦截器 +request.interceptors.request.use((config) => { + const token = localStorage.getItem('token') + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + config.headers['X-Client-Id'] = 'sundynix-admin' // 你的客户端标识 + return config +}) + +// 响应拦截器 +request.interceptors.response.use((response) => { + // Token 自动续期 + const newToken = response.headers['x-refresh-token'] + if (newToken) { + localStorage.setItem('token', newToken) + } + + const { code, msg, data } = response.data + if (code === 401) { + // 跳转登录 + window.location.href = '/login' + return Promise.reject(new Error(msg)) + } + if (code !== 200) { + return Promise.reject(new Error(msg)) + } + return data +}) + +export default request +``` + +### 4.2 API 分组 + +```ts +// api/auth.ts +export const authApi = { + captcha: () => request.get('/api/auth/captcha'), + login: (data: LoginReq) => request.post('/api/auth/login', data), + getUserInfo: () => request.get('/api/auth/info'), + updateUser: (data: UpdateUserReq) => request.post('/api/auth/update', data), +} + +// api/system.ts +export const clientApi = { + list: (data: PageReq) => request.post('/api/sys/client/list', data), + create: (data: ClientReq) => request.post('/api/sys/client/create', data), + update: (data: ClientUpdateReq) => request.post('/api/sys/client/update', data), + delete: (ids: string[]) => request.post('/api/sys/client/delete', { ids }), +} + +export const roleApi = { + list: (data: PageReq) => request.post('/api/sys/role/list', data), + create: (data: RoleReq) => request.post('/api/sys/role/create', data), + update: (data: RoleUpdateReq) => request.post('/api/sys/role/update', data), + delete: (ids: string[]) => request.post('/api/sys/role/delete', { ids }), +} + +export const menuApi = { + list: () => request.get('/api/sys/menu/list'), + byRole: (id: string) => request.post('/api/sys/menu/byRole', { id }), + create: (data: MenuReq) => request.post('/api/sys/menu/create', data), + update: (data: MenuUpdateReq) => request.post('/api/sys/menu/update', data), + delete: (ids: string[]) => request.post('/api/sys/menu/delete', { ids }), +} + +export const userApi = { + list: (data: UserListReq) => request.post('/api/sys/user/list', data), + create: (data: UserCreateReq) => request.post('/api/sys/user/create', data), + update: (data: UserUpdateReq) => request.post('/api/sys/user/update', data), + delete: (ids: string[]) => request.post('/api/sys/user/delete', { ids }), + resetPassword: (data: ResetPasswordReq) => request.post('/api/sys/user/resetPassword', data), +} + +export const dictApi = { + list: (data: DictListReq) => request.post('/api/sys/dict/list', data), + create: (data: DictReq) => request.post('/api/sys/dict/create', data), + update: (data: DictUpdateReq) => request.post('/api/sys/dict/update', data), + delete: (ids: string[]) => request.post('/api/sys/dict/delete', { ids }), +} + +export const logApi = { + list: (data: LogListReq) => request.post('/api/sys/log/list', data), + delete: (ids: string[]) => request.post('/api/sys/log/delete', { ids }), +} +``` + +### 4.3 TypeScript 类型定义 + +```ts +// ========== Auth ========== +interface LoginReq { + account: string + password: string + captchaId: string + captcha: string +} + +interface LoginResp { + token: string + userInfo: UserInfo +} + +interface UserInfo { + id: string + name: string + account: string + nickName: string + phone: string + avatarId: string + gender: number // 0=未知 1=男 2=女 + roles?: string[] // 角色 code 列表(仅 /info 接口返回) + menus?: MenuItem[] // 菜单树(仅 /info 接口返回) + createdAt?: number // Unix 时间戳(秒) +} + +interface MenuItem { + id: string + parentId: string + category: number // 1=菜单 2=按钮 + name: string // 路由名(英文) + title: string // 显示标题(中文) + code: string + path: string + permission: string + locale: string + icon: string + sort: number + children: MenuItem[] +} + +// ========== System ========== +interface ClientInfo { + id: string + clientId: string + name: string + grantType: string + additionalInfo: string + activeTimeout: number // Token有效期(秒) +} + +interface RoleInfo { + id: string + name: string + code: string + sort: number + menuIds: string[] +} + +interface DictInfo { + id: string + type: string + label: string + value: string + sort: number + desc: string +} + +interface OperationRecordInfo { + id: string + clientId: string + ip: string + method: string + path: string + status: number + latency: number // 纳秒 + agent: string + errorMessage: string + body: string + resp: string + userId: string + createdAt: number // Unix 时间戳(秒) +} + +// ========== 通用 ========== +interface PageReq { + current?: number + pageSize?: number +} + +interface PageResp { + list: T[] + total: number +} +``` + +--- + +## 五、接口速查表 + +| 模块 | 方法 | 路径 | 鉴权 | 说明 | +|------|:----:|------|:----:|------| +| **Auth** | GET | `/api/auth/captcha` | ❌ | 获取验证码 | +| | POST | `/api/auth/login` | ❌ | 账号密码登录 | +| | POST | `/api/auth/miniLogin` | ❌ | 小程序登录 | +| | POST | `/api/auth/loginByPhone` | ❌ | 手机号登录 | +| | GET | `/api/auth/info` | ✅ | 获取用户信息+角色+菜单 | +| | POST | `/api/auth/update` | ✅ | 更新个人信息 | +| **客户端** | POST | `/api/sys/client/create` | ✅ | 创建客户端 | +| | POST | `/api/sys/client/update` | ✅ | 更新客户端 | +| | POST | `/api/sys/client/delete` | ✅ | 删除客户端 | +| | POST | `/api/sys/client/list` | ✅ | 客户端列表 | +| **角色** | POST | `/api/sys/role/create` | ✅ | 创建角色 | +| | POST | `/api/sys/role/update` | ✅ | 更新角色 | +| | POST | `/api/sys/role/delete` | ✅ | 删除角色 | +| | POST | `/api/sys/role/list` | ✅ | 角色列表 | +| **菜单** | POST | `/api/sys/menu/create` | ✅ | 创建菜单 | +| | POST | `/api/sys/menu/update` | ✅ | 更新菜单 | +| | POST | `/api/sys/menu/delete` | ✅ | 删除菜单 | +| | GET | `/api/sys/menu/list` | ✅ | 菜单列表(树形) | +| | POST | `/api/sys/menu/byRole` | ✅ | 按角色查菜单 | +| **用户** | POST | `/api/sys/user/list` | ✅ | 用户列表 | +| | POST | `/api/sys/user/create` | ✅ | 创建用户 | +| | POST | `/api/sys/user/update` | ✅ | 更新用户 | +| | POST | `/api/sys/user/delete` | ✅ | 删除用户 | +| | POST | `/api/sys/user/resetPassword` | ✅ | 重置密码 | +| **字典** | POST | `/api/sys/dict/create` | ✅ | 创建字典 | +| | POST | `/api/sys/dict/update` | ✅ | 更新字典 | +| | POST | `/api/sys/dict/delete` | ✅ | 删除字典 | +| | POST | `/api/sys/dict/list` | ✅ | 字典列表 | +| **日志** | POST | `/api/sys/log/list` | ✅ | 操作日志列表 | +| | POST | `/api/sys/log/delete` | ✅ | 删除日志 | diff --git a/go.mod b/go.mod index 88097d7..1eeb96b 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/uuid v1.6.0 github.com/minio/minio-go/v7 v7.0.100 + github.com/mojocn/base64Captcha v1.3.8 github.com/redis/go-redis/v9 v9.18.0 github.com/zeromicro/go-zero v1.10.1 golang.org/x/crypto v0.50.0 @@ -20,15 +21,20 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect github.com/fatih/color v1.18.0 // indirect + github.com/fullstorydev/grpcurl v1.9.3 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-ini/ini v1.67.0 // indirect + github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect @@ -37,12 +43,15 @@ require ( github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/grafana/pyroscope-go v1.2.8 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect + github.com/jhump/protoreflect v1.18.0 // indirect + github.com/jhump/protoreflect/v2 v2.0.0-beta.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -60,8 +69,10 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/pelletier/go-toml/v2 v2.3.0 // indirect + github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -69,6 +80,7 @@ require ( github.com/prometheus/procfs v0.16.1 // indirect github.com/rs/xid v1.6.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect github.com/tinylib/msgp v1.6.1 // indirect github.com/titanous/json5 v1.0.0 // indirect github.com/x448/float16 v0.8.4 // indirect @@ -93,8 +105,10 @@ require ( go.uber.org/zap v1.24.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/image v0.23.0 // indirect golang.org/x/net v0.52.0 // indirect golang.org/x/oauth2 v0.34.0 // indirect + golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.43.0 // indirect golang.org/x/term v0.42.0 // indirect golang.org/x/text v0.36.0 // indirect diff --git a/go.sum b/go.sum index 5e690f4..91a94fe 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,14 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w= +github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= @@ -28,12 +32,20 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/envoyproxy/go-control-plane/envoy v1.36.0 h1:yg/JjO5E7ubRyKX3m07GF3reDNEnfOboJ0QySbH736g= +github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98= +github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4= +github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fullstorydev/grpcurl v1.9.3 h1:PC1Xi3w+JAvEE2Tg2Gf2RfVgPbf9+tbuQr1ZkyVU3jk= +github.com/fullstorydev/grpcurl v1.9.3/go.mod h1:/b4Wxe8bG6ndAjlfSUjwseQReUDUvBJiFEB7UllOlUE= github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -59,10 +71,13 @@ github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXe github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -78,6 +93,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= +github.com/jhump/protoreflect v1.18.0 h1:TOz0MSR/0JOZ5kECB/0ufGnC2jdsgZ123Rd/k4Z5/2w= +github.com/jhump/protoreflect v1.18.0/go.mod h1:ezWcltJIVF4zYdIFM+D/sHV4Oh5LNU08ORzCGfwvTz8= +github.com/jhump/protoreflect/v2 v2.0.0-beta.1 h1:Dw1rslK/VotaUGYsv53XVWITr+5RCPXfvvlGrM/+B6w= +github.com/jhump/protoreflect/v2 v2.0.0-beta.1/go.mod h1:D9LBEowZyv8/iSu97FU2zmXG3JxVTmNw21mu63niFzU= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= @@ -111,6 +130,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI= github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= @@ -123,6 +144,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mojocn/base64Captcha v1.3.8 h1:rrN9BhCwXKS8ht1e21kvR3iTaMgf4qPC9sRoV52bqEg= +github.com/mojocn/base64Captcha v1.3.8/go.mod h1:QFZy927L8HVP3+VV5z2b1EAEiv1KxVJKZbAucVgLUy4= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= @@ -133,10 +156,14 @@ github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7s github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf421CaM= github.com/pelletier/go-toml/v2 v2.3.0/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 h1:KPpdlQLZcHfTMQRi6bFQ7ogNO0ltFT4PmtwTLW4W+14= +github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= @@ -151,6 +178,8 @@ github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzM github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs= github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.2.1 h1:FVP0PJ0AHIjC+N4pKCG9yCDz6LHNPCwi/GKID5pGGF0= github.com/robertkrimen/otto v0.2.1/go.mod h1:UPwtJ1Xu7JrLcZjNWN8orJaM5n5YEtqL//farB5FlRY= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -161,6 +190,8 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo= +github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -180,6 +211,7 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= @@ -235,14 +267,32 @@ go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= +golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= @@ -250,17 +300,49 @@ golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwE golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= @@ -269,6 +351,10 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -288,6 +374,8 @@ google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= +gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= diff --git a/scripts/seed_rbac.sql b/scripts/seed_rbac.sql new file mode 100644 index 0000000..4d77683 --- /dev/null +++ b/scripts/seed_rbac.sql @@ -0,0 +1,118 @@ +-- ================================================================ +-- Sundynix RBAC 基础数据初始化脚本 +-- 数据库: sundynix_micro_go +-- 执行前请确保表已通过 AutoMigrate 自动创建 +-- ================================================================ + +USE sundynix_micro_go; + +-- ================================================================ +-- 1. 客户端 (sundynix_client) +-- ================================================================ +INSERT INTO sundynix_client (id, client_id, name, grant_type, additional_info, active_timeout, created_at, updated_at) VALUES +('cd67bf8d-81dc-404a-8dc8-4beaf9091cc8', 'sundynix-pc', 'PC管理后台', 'password', '{"platform":"web"}', 86400, NOW(), NOW()), +('8fa30b91-850c-42a8-9951-3d3ebe9c9a0d', 'sundynix-mini', '微信小程序端', 'wechat_mini', '{"platform":"mini"}', 604800, NOW(), NOW()), +('bae0f342-0778-4d80-90fc-08837a7e5c50', 'sundynix-app', '移动APP端', 'password', '{"platform":"app"}', 2592000, NOW(), NOW()); + +-- ================================================================ +-- 2. 角色 (sundynix_role) +-- ================================================================ +INSERT INTO sundynix_role (id, name, code, sort, created_at, updated_at) VALUES +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '超级管理员', 'admin', 1, NOW(), NOW()), +('2cfa0b60-d09e-4b14-8238-962feed60a0c', '普通用户', 'user', 2, NOW(), NOW()), +('23f0622e-baf7-4733-9447-733dbea1fae4', '运维人员', 'editor', 3, NOW(), NOW()); + +-- ================================================================ +-- 3. 菜单 (sundynix_menu) +-- category: 1=菜单 2=按钮/权限 +-- ================================================================ + +-- -------- 一级菜单 -------- +INSERT INTO sundynix_menu (id, parent_id, category, name, title, code, path, permission, locale, icon, sort, created_at, updated_at) VALUES +('41c44269-4dbb-404a-bcd4-bc5734dfa1f5', '0', 1, 'Dashboard', '仪表盘', 'dashboard', '/dashboard', '', 'menu.dashboard', 'IconDashboard', 1, NOW(), NOW()), +('8bc27535-ca46-4d09-8c43-a8a058883552', '0', 1, 'System', '系统管理', 'system', '/system', '', 'menu.system', 'IconSettings', 2, NOW(), NOW()), +('f719df64-7927-481e-b178-48052bf93104', '0', 1, 'UserCenter', '用户中心', 'userCenter', '/user', '', 'menu.user', 'IconUser', 3, NOW(), NOW()), +('11d945a2-5c05-422f-9608-3b293eabc90f', '0', 1, 'Plant', '植物服务', 'plant', '/plant', '', 'menu.plant', 'IconLeaf', 4, NOW(), NOW()); + +-- -------- System 子菜单 -------- +INSERT INTO sundynix_menu (id, parent_id, category, name, title, code, path, permission, locale, icon, sort, created_at, updated_at) VALUES +('b94c6c49-3224-4bf3-8c19-8a0435579198', '8bc27535-ca46-4d09-8c43-a8a058883552', 1, 'RoleManage', '角色管理', 'systemRole', '/system/role', '', 'menu.system.role', 'IconUserGroup', 1, NOW(), NOW()), +('8768117d-3542-4adc-ba05-b506901a07c1', '8bc27535-ca46-4d09-8c43-a8a058883552', 1, 'MenuManage', '菜单管理', 'systemMenu', '/system/menu', '', 'menu.system.menu', 'IconMenu', 2, NOW(), NOW()), +('e2e51e57-2a49-4480-95f3-1b3d4e97c2af', '8bc27535-ca46-4d09-8c43-a8a058883552', 1, 'DictManage', '字典管理', 'systemDict', '/system/dict', '', 'menu.system.dict', 'IconBook', 3, NOW(), NOW()), +('72c2cd9c-c794-484a-8aab-7c2bccdbcc83', '8bc27535-ca46-4d09-8c43-a8a058883552', 1, 'ClientManage', '客户端管理', 'systemClient', '/system/client', '', 'menu.system.client', 'IconDesktop', 4, NOW(), NOW()), +('78722dc5-0632-4560-a99d-9d1abbc3cec9', '8bc27535-ca46-4d09-8c43-a8a058883552', 1, 'LogManage', '操作日志', 'systemLog', '/system/log', '', 'menu.system.log', 'IconFile', 5, NOW(), NOW()); + +-- -------- UserCenter 子菜单 -------- +INSERT INTO sundynix_menu (id, parent_id, category, name, title, code, path, permission, locale, icon, sort, created_at, updated_at) VALUES +('fdd5dc3f-22c1-4226-b534-e527c3d713ed', 'f719df64-7927-481e-b178-48052bf93104', 1, 'UserList', '用户列表', 'userList', '/user/list', '', 'menu.user.list', 'IconList', 1, NOW(), NOW()), +('038fdb2c-f21f-4540-b822-c0b9037eaec7', 'f719df64-7927-481e-b178-48052bf93104', 1, 'UserProfile', '个人中心', 'userProfile', '/user/profile', '', 'menu.user.profile', 'IconIdcard', 2, NOW(), NOW()); + +-- -------- 按钮级权限 (category=2) -------- +INSERT INTO sundynix_menu (id, parent_id, category, name, title, code, path, permission, locale, icon, sort, created_at, updated_at) VALUES +('d9c19b2a-1b51-4f37-ba3e-4a12259a9918', 'b94c6c49-3224-4bf3-8c19-8a0435579198', 2, 'RoleAdd', '新增角色', 'roleAdd', '', 'sys:role:add', '', '', 1, NOW(), NOW()), +('cc837307-21ec-4a8d-a562-3bb0f4a43c27', 'b94c6c49-3224-4bf3-8c19-8a0435579198', 2, 'RoleEdit', '编辑角色', 'roleEdit', '', 'sys:role:edit', '', '', 2, NOW(), NOW()), +('80873067-fa1c-4ea2-bc02-20979eab4363', 'b94c6c49-3224-4bf3-8c19-8a0435579198', 2, 'RoleDelete', '删除角色', 'roleDelete', '', 'sys:role:delete', '', '', 3, NOW(), NOW()), +('98f56888-8861-4b01-9db4-2461f5a4ea3b', 'fdd5dc3f-22c1-4226-b534-e527c3d713ed', 2, 'UserAdd', '新增用户', 'userAdd', '', 'sys:user:add', '', '', 1, NOW(), NOW()), +('d1d313d0-a51a-4c45-a89b-e31c68eaf3d9', 'fdd5dc3f-22c1-4226-b534-e527c3d713ed', 2, 'UserEdit', '编辑用户', 'userEdit', '', 'sys:user:edit', '', '', 2, NOW(), NOW()), +('1114c4ac-7da9-4e03-a314-482ac669337e', 'fdd5dc3f-22c1-4226-b534-e527c3d713ed', 2, 'UserDelete', '删除用户', 'userDelete', '', 'sys:user:delete', '', '', 3, NOW(), NOW()); + +-- ================================================================ +-- 4. 角色-菜单关联 (sundynix_role_menu) +-- ================================================================ + +-- admin 拥有所有菜单 +INSERT INTO sundynix_role_menu (role_id, menu_id) VALUES +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '41c44269-4dbb-404a-bcd4-bc5734dfa1f5'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '8bc27535-ca46-4d09-8c43-a8a058883552'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'f719df64-7927-481e-b178-48052bf93104'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '11d945a2-5c05-422f-9608-3b293eabc90f'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'b94c6c49-3224-4bf3-8c19-8a0435579198'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '8768117d-3542-4adc-ba05-b506901a07c1'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'e2e51e57-2a49-4480-95f3-1b3d4e97c2af'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '72c2cd9c-c794-484a-8aab-7c2bccdbcc83'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '78722dc5-0632-4560-a99d-9d1abbc3cec9'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'fdd5dc3f-22c1-4226-b534-e527c3d713ed'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '038fdb2c-f21f-4540-b822-c0b9037eaec7'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'd9c19b2a-1b51-4f37-ba3e-4a12259a9918'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'cc837307-21ec-4a8d-a562-3bb0f4a43c27'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '80873067-fa1c-4ea2-bc02-20979eab4363'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '98f56888-8861-4b01-9db4-2461f5a4ea3b'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', 'd1d313d0-a51a-4c45-a89b-e31c68eaf3d9'), +('091881d9-10d8-4c01-aa20-22c3988e2a2a', '1114c4ac-7da9-4e03-a314-482ac669337e'); + +-- user 只有 Dashboard + 个人中心 +INSERT INTO sundynix_role_menu (role_id, menu_id) VALUES +('2cfa0b60-d09e-4b14-8238-962feed60a0c', '41c44269-4dbb-404a-bcd4-bc5734dfa1f5'), +('2cfa0b60-d09e-4b14-8238-962feed60a0c', 'f719df64-7927-481e-b178-48052bf93104'), +('2cfa0b60-d09e-4b14-8238-962feed60a0c', '038fdb2c-f21f-4540-b822-c0b9037eaec7'); + +-- editor 有 Dashboard + 用户中心(只读) + 植物服务 +INSERT INTO sundynix_role_menu (role_id, menu_id) VALUES +('23f0622e-baf7-4733-9447-733dbea1fae4', '41c44269-4dbb-404a-bcd4-bc5734dfa1f5'), +('23f0622e-baf7-4733-9447-733dbea1fae4', 'f719df64-7927-481e-b178-48052bf93104'), +('23f0622e-baf7-4733-9447-733dbea1fae4', '11d945a2-5c05-422f-9608-3b293eabc90f'), +('23f0622e-baf7-4733-9447-733dbea1fae4', 'fdd5dc3f-22c1-4226-b534-e527c3d713ed'), +('23f0622e-baf7-4733-9447-733dbea1fae4', '038fdb2c-f21f-4540-b822-c0b9037eaec7'); + +-- ================================================================ +-- 5. 用户 (sundynix_user) +-- ================================================================ +INSERT INTO sundynix_user (id, tenant_id, client_id, name, account, password, nick_name, phone, gender, created_at, updated_at) VALUES +('b47eae1d-59e5-4cc5-a088-9aaaaba4dddd', '1', 'sundynix-pc', '超级管理员', 'sundynix', '$2a$10$YRTuwceTYOa10c3R5mMBB.8fHKOFL6DO1OprwSFjnc20R.qDv3PTq', 'Admin', '13800000000', 0, NOW(), NOW()), +('11abce94-082c-4f5f-b395-aee14262ec22', '1', 'sundynix-pc', '测试用户', 'test', '$2a$10$trQ.ZH6g.8of45pG/527y.01pSrgJCQX0yoWOezXF8acoKfVlxWeO', 'Tester', '13800000001', 0, NOW(), NOW()), +('c9d1610b-512f-4a27-aac0-e0a26db76ee3', '1', 'sundynix-pc', '运维人员', 'editor', '$2a$10$trQ.ZH6g.8of45pG/527y.01pSrgJCQX0yoWOezXF8acoKfVlxWeO', 'Editor', '13800000002', 0, NOW(), NOW()); + +-- ================================================================ +-- 6. 用户-角色关联 (sundynix_user_role) +-- ================================================================ +INSERT INTO sundynix_user_role (user_id, role_id) VALUES +('b47eae1d-59e5-4cc5-a088-9aaaaba4dddd', '091881d9-10d8-4c01-aa20-22c3988e2a2a'), -- sundynix -> 超级管理员 +('11abce94-082c-4f5f-b395-aee14262ec22', '2cfa0b60-d09e-4b14-8238-962feed60a0c'), -- test -> 普通用户 +('c9d1610b-512f-4a27-aac0-e0a26db76ee3', '23f0622e-baf7-4733-9447-733dbea1fae4'); -- editor -> 运维人员 + +-- ================================================================ +-- 完成!测试账号: +-- sundynix / sundynix (超级管理员,全部权限) +-- test / 123456 (普通用户,仅 Dashboard + 个人中心) +-- editor / 123456 (运维人员,Dashboard + 用户中心 + 植物服务) +-- ================================================================ diff --git a/scripts/start.sh b/scripts/start.sh index f437577..786163a 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,7 +1,7 @@ #!/bin/bash # Sundynix 微服务启动脚本 # 用法: ./scripts/start.sh [服务名] -# 例如: ./scripts/start.sh user-rpc +# 例如: ./scripts/start.sh system-rpc # ./scripts/start.sh all (启动所有) # ./scripts/start.sh gateway @@ -23,11 +23,8 @@ start_service() { } case "${1:-help}" in - user-rpc) - start_service "user-rpc" "$APP_DIR/user/rpc" "user.go" "etc/user.yaml" - ;; - user-api) - start_service "user-api" "$APP_DIR/user/api" "user.go" "etc/user-api.yaml" + auth-api) + start_service "auth-api" "$APP_DIR/auth/api" "auth.go" "etc/auth-api.yaml" ;; file-rpc) start_service "file-rpc" "$APP_DIR/file/rpc" "file.go" "etc/file.yaml" @@ -47,29 +44,23 @@ case "${1:-help}" in plant-api) start_service "plant-api" "$APP_DIR/plant/api" "plant.go" "etc/plant-api.yaml" ;; - radio-rpc) - start_service "radio-rpc" "$APP_DIR/radio/rpc" "radio.go" "etc/radio.yaml" - ;; - radio-api) - start_service "radio-api" "$APP_DIR/radio/api" "radio.go" "etc/radio-api.yaml" - ;; + gateway) start_service "gateway" "$APP_DIR/gateway" "gateway.go" "etc/gateway.yaml" ;; all) echo "===== 启动 RPC 层 =====" - start_service "user-rpc" "$APP_DIR/user/rpc" "user.go" "etc/user.yaml" start_service "file-rpc" "$APP_DIR/file/rpc" "file.go" "etc/file.yaml" start_service "system-rpc" "$APP_DIR/system/rpc" "system.go" "etc/system.yaml" start_service "plant-rpc" "$APP_DIR/plant/rpc" "plant.go" "etc/plant.yaml" - start_service "radio-rpc" "$APP_DIR/radio/rpc" "radio.go" "etc/radio.yaml" + sleep 3 echo "===== 启动 API 层 =====" - start_service "user-api" "$APP_DIR/user/api" "user.go" "etc/user-api.yaml" + start_service "auth-api" "$APP_DIR/auth/api" "auth.go" "etc/auth-api.yaml" start_service "file-api" "$APP_DIR/file/api" "file.go" "etc/file-api.yaml" start_service "system-api" "$APP_DIR/system/api" "system.go" "etc/system-api.yaml" start_service "plant-api" "$APP_DIR/plant/api" "plant.go" "etc/plant-api.yaml" - start_service "radio-api" "$APP_DIR/radio/api" "radio.go" "etc/radio-api.yaml" + sleep 2 echo "===== 启动网关 =====" start_service "gateway" "$APP_DIR/gateway" "gateway.go" "etc/gateway.yaml" @@ -83,6 +74,6 @@ case "${1:-help}" in echo "✅ 已停止" ;; *) - echo "用法: $0 {user-rpc|user-api|file-rpc|file-api|system-rpc|system-api|plant-rpc|plant-api|radio-rpc|radio-api|gateway|all|stop}" + echo "用法: $0 {auth-api|file-rpc|file-api|system-rpc|system-api|plant-rpc|plant-api|gateway|all|stop}" ;; esac