From 0c345856491c8bccbf82e8482bec47ee6880ad4c Mon Sep 17 00:00:00 2001 From: Yangtao Date: Wed, 19 Nov 2025 14:24:13 +0800 Subject: [PATCH] feat(app): update --- main.go | 29 ++ pkg/client/http.go | 2 +- pkg/client/mongo.go | 10 +- pkg/client/netease/IMService.go | 10 +- pkg/client/netease/live_person.go | 2 +- pkg/client/tencent.go | 2 +- pkg/client/weichat_notice.go | 2 +- pkg/comm/p_vars.go | 5 - pkg/common/ConstVar.go | 2 +- pkg/common/HyTools/StringBuilder.go | 4 +- pkg/common/es/document/user.go | 26 +- pkg/common/es/es_client.go | 14 +- pkg/common/es/es_client_test.go | 2 +- pkg/common/http/response/Activity.go | 10 +- pkg/common/messages/event_message.go | 8 +- pkg/common/netease/ImClient.go | 6 +- pkg/common/netease/ImResponse.go | 4 +- pkg/common/network/response.go | 8 +- pkg/common/pinyin/pinyin.go | 4 +- pkg/common/util/string_util.go | 4 +- pkg/datasource/fields/field.go | 4 +- pkg/dto/AccessTokenDTO.go | 6 + pkg/dto/ActivityAttackRankDTO.go | 10 + pkg/dto/AppHomePageDTO.go | 123 ++++++ pkg/dto/BannerDTO.go | 22 + pkg/dto/BroadCastDTO.go | 9 + pkg/dto/CharmJournalDTO.go | 12 + pkg/dto/ChatroomActivityDTO.go | 13 + pkg/dto/ChatroomCmdResult.go | 39 ++ pkg/dto/ChatroomDTO.go | 69 ++++ pkg/dto/ChatroomDispatchOrderDTO.go | 12 + pkg/dto/ChatroomEmojiDTO.go | 14 + pkg/dto/ChatroomListUserDTO.go | 27 ++ pkg/dto/ChatroomTemplateDTO.go | 7 + pkg/dto/DiamindJournalDTO.go | 22 + pkg/dto/DispatchOrderCenterDataDTO.go | 56 +++ pkg/dto/DispatchOrderDetailDTO.go | 39 ++ pkg/dto/DispatchOrderSkillDTO.go | 9 + pkg/dto/EnterChatroomDTO.go | 8 + pkg/dto/EnterRoomSceneDTO.go | 25 ++ pkg/dto/ExamDTO.go | 53 +++ pkg/dto/FriendShipRoomRuleDTO.go | 43 ++ pkg/dto/GiftTagDTO.go | 13 + pkg/dto/GiftWallDTO.go | 10 + pkg/dto/GoodsExchangeConfigDTO.go | 14 + pkg/dto/GoodsTagDTO.go | 13 + pkg/dto/GuildDTO.go | 25 ++ pkg/dto/HitEggResult.go | 79 ++++ pkg/dto/HobbiesDTO.go | 32 ++ pkg/dto/HomeTabDTO.go | 12 + pkg/dto/ListChatroomDTO.go | 118 ++++++ pkg/dto/ListOrderDTO.go | 47 +++ pkg/dto/ListUserDTO.go | 49 +++ pkg/dto/MainTabBarDTO.go | 11 + pkg/dto/MessageOrderDTO.go | 34 ++ pkg/dto/MinePageMenuDTO.go | 8 + pkg/dto/MusicDTO.go | 15 + pkg/dto/OrderRateDTO.go | 32 ++ pkg/dto/PresentIdAndUserId.go | 7 + pkg/dto/QeekStarDto.go | 7 + pkg/dto/RankDTO.go | 49 +++ pkg/dto/RegionCodeDTO.go | 6 + pkg/dto/RevenueExchangeConfigDTO.go | 6 + pkg/dto/RockSkewerResultDTO.go | 8 + pkg/dto/ShareDTO.go | 16 + pkg/dto/SkillLevelPriceDTO.go | 51 +++ pkg/dto/SkillListDTO.go | 109 +++++ pkg/dto/SkillOrderDetailDTO.go | 36 ++ pkg/dto/TaxDTO.go | 7 + pkg/dto/TimelineCategoryDTO.go | 7 + pkg/dto/TimelineDTO.go | 63 +++ pkg/dto/TimelineReplyDTO.go | 46 +++ pkg/dto/TopUsersDTO.go | 9 + pkg/dto/UserAliasNameDTO.go | 6 + pkg/dto/UserGiftBoxDTO.go | 30 ++ pkg/dto/UserInfoDTO.go | 145 +++++++ pkg/dto/UserStoreGoodsDTO.go | 33 ++ pkg/dto/UserTakedDispathOrderDTO.go | 28 ++ pkg/dto/UserVipIconDTO.go | 26 ++ pkg/dto/VisitUserDTO.go | 13 + pkg/dto/activity/BossBasicDTO.go | 16 + pkg/dto/activity/BossHpAndAttackRankDTO.go | 23 ++ pkg/dto/activity/ChatRoomLuckPrizeDTO.go | 19 + pkg/dto/activity/GeneralRankGiftDTO.go | 18 + pkg/dto/activity/WeekStarDTO.go | 29 ++ pkg/dto/activity/WeekStarGiftGrantDTO.go | 11 + pkg/dto/admin/diamond.go | 8 + pkg/dto/admin/skill.go | 378 +++++++++++++++++ pkg/dto/admin/user.go | 44 ++ pkg/dto/applepay/IapReceiptData.go | 51 +++ pkg/dto/dataDTO.go | 14 + pkg/dto/inner/AppealOrderRequest.go | 17 + pkg/dto/inner/AttackBossRequest.go | 39 ++ pkg/dto/inner/BuyLuckBoxKeysRequest.go | 34 ++ pkg/dto/inner/GetActivityBossRequest.go | 26 ++ pkg/dto/inner/GetOpenBoxRankRequest.go | 25 ++ pkg/dto/inner/GetRoomWeeklyTopListRequest.go | 18 + pkg/dto/inner/GetSkillPrizeRequest.go | 25 ++ .../inner/GetUserActivityAttackRankRequest.go | 81 ++++ pkg/dto/inner/GetUserInfoRequest.go | 43 ++ pkg/dto/inner/GetVipConfigRequest.go | 18 + pkg/dto/inner/ManualRechargeRequest.go | 30 ++ pkg/dto/inner/MwebRechargeRequest.go | 68 ++++ pkg/dto/inner/OpenBoxRequest.go | 29 ++ pkg/dto/inner/OperationAddDiamondRequest.go | 25 ++ pkg/dto/inner/OperationAddRevenueRequest.go | 32 ++ pkg/dto/inner/OrderRechargeRequest.go | 28 ++ pkg/dto/inner/PayToCustomerByAlipayRequest.go | 40 ++ pkg/dto/inner/ReturnWithdrawRevenueRequest.go | 20 + pkg/dto/inner/SendOfficalNoticeRequest.go | 28 ++ pkg/dto/inner/UpdateYunXinUserInfoRequest.go | 18 + pkg/dto/refund/refund_dto.go | 26 ++ pkg/dto/request/AddToBlackListRequest.go | 24 ++ pkg/dto/request/AgentRequest.go | 91 +++++ pkg/dto/request/AgentTransferRequest.go | 51 +++ pkg/dto/request/BaseDispatchOrerIdRequest.go | 24 ++ pkg/dto/request/BaseOrerIdRequest.go | 153 +++++++ pkg/dto/request/BasePageRequest.go | 31 ++ pkg/dto/request/BasePagingReqest.go | 34 ++ pkg/dto/request/BaseRequest.go | 62 +++ pkg/dto/request/BaseSkillRequest.go | 24 ++ pkg/dto/request/BaseTimelineRequest.go | 24 ++ pkg/dto/request/BaseUserSkillRequest.go | 24 ++ pkg/dto/request/BuyChatroomEmojiRequest.go | 25 ++ pkg/dto/request/BuyerRateSkillOrderRequest.go | 120 ++++++ pkg/dto/request/ChangePasswordRequest.go | 30 ++ pkg/dto/request/ChatRoomBaseRequest.go | 77 ++++ pkg/dto/request/ChatRoomCmdRequest.go | 52 +++ pkg/dto/request/ChatRoomKickOutUserRequest.go | 31 ++ pkg/dto/request/ChatRoomRankRequest.go | 25 ++ pkg/dto/request/ChatroomBuyGuardSeat.go | 54 +++ pkg/dto/request/ChatroomRockSkewerRequest.go | 27 ++ pkg/dto/request/ClearChatroomCharmRequest.go | 40 ++ pkg/dto/request/CollectRoomRequest.go | 30 ++ pkg/dto/request/CommonRequest.go | 10 + pkg/dto/request/CompleteUserInfoRequest.go | 43 ++ pkg/dto/request/CreateMallOrderRequest.go | 32 ++ pkg/dto/request/CreatePointOrderRequest.go | 30 ++ pkg/dto/request/CreateSkillOrderRequest.go | 95 +++++ pkg/dto/request/CreateTimelineRequest.go | 69 ++++ pkg/dto/request/DataRequest.go | 24 ++ pkg/dto/request/DeleteReplyRequest.go | 24 ++ pkg/dto/request/DeleteTimelineRequest.go | 24 ++ pkg/dto/request/DeleteUserCheckRequest.go | 69 ++++ pkg/dto/request/DeleteUserPhotoRequest.go | 24 ++ pkg/dto/request/DispatchOrderRequest.go | 131 ++++++ pkg/dto/request/EnterRoomRequest.go | 22 + pkg/dto/request/ExamOrderRequest.go | 69 ++++ pkg/dto/request/ExamRequest.go | 173 ++++++++ pkg/dto/request/FindTreasureRequest.go | 45 ++ pkg/dto/request/FirstTimeBindMobileRequest.go | 32 ++ .../request/FirstTimeSetPasswordRequest.go | 24 ++ pkg/dto/request/FollowUserRequest.go | 24 ++ pkg/dto/request/GeneralRankRequest.go | 18 + pkg/dto/request/GetBannerListRequest.go | 20 + pkg/dto/request/GetChatRoomActivityRequest.go | 25 ++ .../request/GetChatRoomBlackReasonRequest.go | 24 ++ pkg/dto/request/GetChatroomListRequest.go | 56 +++ .../GetChatroomOnlineGuardListRequest.go | 30 ++ .../GetDispatchOrderCenterDataListRequest.go | 58 +++ .../request/GetGoodsExchangeConfigRequest.go | 23 ++ pkg/dto/request/GetGoodsOrderListRequest.go | 26 ++ pkg/dto/request/GetHomeDataRequest.go | 20 + pkg/dto/request/GetHostGuardListRequest.go | 24 ++ pkg/dto/request/GetLocalMobileRequest.go | 25 ++ pkg/dto/request/GetMusicListRequest.go | 32 ++ .../request/GetMyHitEggPrizeListRequest.go | 26 ++ pkg/dto/request/GetSkillLevelListRequest.go | 58 +++ pkg/dto/request/GetSkillSkuListH5Request.go | 27 ++ pkg/dto/request/GetSkillSkuListRequest.go | 56 +++ pkg/dto/request/GetSkillUserListRequest.go | 37 ++ .../request/GetTimelineByCategoryRequest.go | 33 ++ .../GetTimelineReplyChildrenRequest.go | 31 ++ .../request/GetTimelineReplyListRequest.go | 26 ++ pkg/dto/request/GetUserAccountRequest.go | 18 + pkg/dto/request/GetUserChatroomRequest.go | 20 + pkg/dto/request/GetUserDetailRequest.go | 56 +++ .../request/GetUserDiamondJournalRequest.go | 38 ++ pkg/dto/request/GetUserGuardSeatRequest.go | 27 ++ .../request/GetUserSkillDetailH5Request.go | 19 + pkg/dto/request/GetUserSkillDetailRequest.go | 24 ++ .../request/GetUserSkillRateListH5Request.go | 21 + .../request/GetUserSkillRateListRequest.go | 45 ++ pkg/dto/request/GetUserStoreModelRequest.go | 25 ++ pkg/dto/request/GetUserTimelineRequest.go | 26 ++ pkg/dto/request/GetUserVisitLogRequest.go | 25 ++ pkg/dto/request/GoodsExchangeRequest.go | 31 ++ pkg/dto/request/Guild.go | 16 + pkg/dto/request/HeaderModel.go | 31 ++ pkg/dto/request/HitEggRequest.go | 31 ++ pkg/dto/request/LeaveRoomRequest.go | 24 ++ pkg/dto/request/NoticeRequest.go | 51 +++ pkg/dto/request/OpenRoomRequest.go | 135 ++++++ pkg/dto/request/PraiseReplyRequest.go | 56 +++ .../PresentActivityGiftFromChatRoomRequest.go | 65 +++ .../request/PresentGiftFromChatRoomRequest.go | 172 ++++++++ pkg/dto/request/RefreshAccessTokenRequest.go | 18 + pkg/dto/request/RefundReq.go | 30 ++ pkg/dto/request/RelationCancelRequest.go | 22 + pkg/dto/request/RelationGiftRequest.go | 31 ++ pkg/dto/request/RelationInviteApplyRequest.go | 21 + pkg/dto/request/RelationInviteRequest.go | 27 ++ pkg/dto/request/RemoveFromBlackListRequest.go | 24 ++ pkg/dto/request/ReplyTimelineRequest.go | 31 ++ pkg/dto/request/ReportChatroomRequest.go | 32 ++ pkg/dto/request/ReportTimelineRequest.go | 32 ++ pkg/dto/request/ReportUserRequest.go | 125 ++++++ pkg/dto/request/ResetPasswordRequest.go | 30 ++ .../request/RevenueExchangeDiamondRequest.go | 31 ++ pkg/dto/request/RichRequest.go | 27 ++ pkg/dto/request/SearchFollowUserRequest.go | 24 ++ pkg/dto/request/SearchUserByUserNoRequest.go | 47 +++ pkg/dto/request/SearchUserRequest.go | 31 ++ pkg/dto/request/SendMobileCodeRequest.go | 32 ++ pkg/dto/request/SendVericodeRequest.go | 51 +++ .../request/SetChatroomAdminUserRequest.go | 42 ++ .../request/SetChatroomBlackUserRequest.go | 31 ++ pkg/dto/request/SetChatroomHostUserRequest.go | 42 ++ pkg/dto/request/SetChatroomPwdRequest.go | 25 ++ pkg/dto/request/SetChildModeRequest.go | 24 ++ pkg/dto/request/SetRoomBackgroundRequest.go | 31 ++ pkg/dto/request/SetServiceStatusRequest.go | 31 ++ pkg/dto/request/SetSkillPriceRequest.go | 31 ++ pkg/dto/request/SetUpSeatTypeRequest.go | 31 ++ pkg/dto/request/SetUserAliasNameRequest.go | 30 ++ pkg/dto/request/SetUserBankInfoRequest.go | 36 ++ pkg/dto/request/SetUserHobbiesRequest.go | 20 + pkg/dto/request/SetUserPrivacyRequest.go | 30 ++ pkg/dto/request/SignWithAppleRequest.go | 18 + pkg/dto/request/SkillApplyRequest.go | 89 ++++ pkg/dto/request/SkillEditRequest.go | 90 ++++ pkg/dto/request/TakeOffStoreGoodsRequest.go | 24 ++ pkg/dto/request/TaskUpdateRequest.go | 26 ++ .../request/TransferToAliAccountRequest.go | 20 + pkg/dto/request/UnFollowUserRequest.go | 25 ++ pkg/dto/request/UpdateChatroomInfoRequest.go | 47 +++ .../UpdateChatroomNameAndNoticeRequest.go | 32 ++ .../request/UpdateChatroomSeatTypeRequest.go | 25 ++ pkg/dto/request/UpdateMobileRequest.go | 31 ++ pkg/dto/request/UpdateUserAvatarRequest.go | 25 ++ pkg/dto/request/UpdateUserBirthdayRequest.go | 25 ++ pkg/dto/request/UpdateUserNickNameRequest.go | 30 ++ .../request/UpdateUserPhotoIndexRequest.go | 24 ++ pkg/dto/request/UpdateUserSignRequest.go | 47 +++ pkg/dto/request/UpdateUserVideoRequest.go | 25 ++ pkg/dto/request/UploadMusicRequest.go | 49 +++ pkg/dto/request/UploadUserPhotoRequest.go | 25 ++ .../UseHaveRandResultEmojiRequestRequest.go | 31 ++ pkg/dto/request/UseStoreGoodsRequest.go | 24 ++ pkg/dto/request/UserCertifyApplyAliRequest.go | 32 ++ pkg/dto/request/UserCertifyApplyRequest.go | 223 ++++++++++ pkg/dto/request/UserCharmWithdrawRequest.go | 61 +++ .../request/UserIapRechargePreCheckRequest.go | 24 ++ pkg/dto/request/UserNcoinWithdrawRequest.go | 54 +++ pkg/dto/request/UserRechargeRequest.go | 110 +++++ pkg/dto/request/UserSignInRequest.go | 75 ++++ pkg/dto/request/UserSignUpRequest.go | 105 +++++ pkg/dto/request/UserSignUpRobotRequest.go | 52 +++ pkg/dto/request/VerifyNickNameRequest.go | 18 + pkg/dto/request/VerifyVericodeRequest.go | 30 ++ pkg/dto/request/ZhimaCertifyConfirmRequest.go | 24 ++ .../request/admin/GeneralRankRewarRequest.go | 16 + pkg/dto/response/Activity.go | 19 + pkg/dto/response/BasePagingResponse.go | 9 + pkg/dto/response/BaseResponse.go | 91 +++++ .../response/ChatroomPresentGiftResponse.go | 15 + .../response/DispatchOrderEmployedResponse.go | 12 + pkg/dto/response/FindTreasureResponse.go | 8 + pkg/dto/response/GetAppVersionResponse.go | 12 + .../GetChatroomCurrentRoundCharmResponse.go | 17 + .../GetChatroomSeatAndQueueInfoResponse.go | 21 + .../response/GetCreateOrderDataResponse.go | 20 + .../GetDispatchOrderCenterDataListResponse.go | 12 + pkg/dto/response/GetHomeTopUsersResponse.go | 8 + pkg/dto/response/GetHostGuardListResponse.go | 29 ++ pkg/dto/response/GetMyWithdrawPageResponse.go | 14 + pkg/dto/response/GetUserAccountResponse.go | 12 + pkg/dto/response/GetUserBankInfoResponse.go | 10 + pkg/dto/response/GetUserChatroomResponse.go | 12 + pkg/dto/response/GetUserDetailResponse.go | 45 ++ pkg/dto/response/GetUserGuardSeatResponse.go | 7 + pkg/dto/response/GetUserRoomBgResponse.go | 8 + .../response/GetUserSkillDetailResponse.go | 42 ++ pkg/dto/response/Guild.go | 32 ++ pkg/dto/response/MddResponse.go | 57 +++ pkg/dto/response/NoticeResponse.go | 23 ++ pkg/dto/response/OpenRoomResponse.go | 5 + .../PresentGiftFromChatRoomResponse.go | 6 + pkg/dto/response/QiNiuTokenResponse.go | 6 + .../response/RefreshAccessTokenResponse.go | 7 + pkg/dto/response/Response.go | 32 ++ pkg/dto/response/SearchResponse.go | 14 + pkg/dto/response/SendVericodeResponse.go | 6 + pkg/dto/response/SubmailResponse.go | 11 + pkg/dto/response/UserGoodsDTO.go | 21 + pkg/dto/response/UserSignInResponse.go | 7 + pkg/dto/yunxin/ImChatroomBizData.go | 384 ++++++++++++++++++ pkg/dto/yunxin/ImChatroomOnlineMember.go | 10 + pkg/dto/yunxin/ImUserExtData.go | 9 + pkg/dto/yunxin/UpdateRoomInfoRequest.go | 7 + pkg/helper/AliAudio.go | 12 +- pkg/helper/NetHelper.go | 2 +- pkg/helper/string_util.go | 2 +- pkg/htools/StringBuilder.go | 2 +- pkg/htools/Tools.go | 10 +- pkg/log/zap.go | 26 +- pkg/middleware/global_panic.go | 5 +- pkg/partner/Apple/AppleClient.go | 6 +- pkg/partner/WxPay/WxPayClient.go | 2 +- pkg/partner/YiDun/YiDunClient.go | 6 +- pkg/partner/mq/message/message_event.go | 8 +- pkg/partner/mq/message_client.go | 4 +- pkg/partner/wxpay_utility/util.go | 2 +- pkg/repo/admin_privilege.gen.go | 22 +- pkg/repo/admin_role.gen.go | 22 +- pkg/repo/admin_role_privilege.gen.go | 22 +- pkg/repo/admin_user.gen.go | 22 +- pkg/repo/admin_user_role.gen.go | 22 +- pkg/repo/data_attach.gen.go | 22 +- pkg/repo/game.gen.go | 22 +- pkg/repo/trade_commodity.gen.go | 22 +- pkg/repo/user.gen.go | 22 +- pkg/repo/user_game_role.gen.go | 22 +- pkg/repo/user_game_role_prop.gen.go | 22 +- pkg/res/abstract.go | 22 +- pkg/res/match.go | 70 ++-- pkg/secure/jwt.go | 2 +- pkg/tools/jwt.go | 2 +- pkg/utils/time_tool.go | 5 +- 329 files changed, 10760 insertions(+), 281 deletions(-) create mode 100644 main.go delete mode 100644 pkg/comm/p_vars.go create mode 100644 pkg/dto/AccessTokenDTO.go create mode 100644 pkg/dto/ActivityAttackRankDTO.go create mode 100644 pkg/dto/AppHomePageDTO.go create mode 100644 pkg/dto/BannerDTO.go create mode 100644 pkg/dto/BroadCastDTO.go create mode 100644 pkg/dto/CharmJournalDTO.go create mode 100644 pkg/dto/ChatroomActivityDTO.go create mode 100644 pkg/dto/ChatroomCmdResult.go create mode 100644 pkg/dto/ChatroomDTO.go create mode 100644 pkg/dto/ChatroomDispatchOrderDTO.go create mode 100644 pkg/dto/ChatroomEmojiDTO.go create mode 100644 pkg/dto/ChatroomListUserDTO.go create mode 100644 pkg/dto/ChatroomTemplateDTO.go create mode 100644 pkg/dto/DiamindJournalDTO.go create mode 100644 pkg/dto/DispatchOrderCenterDataDTO.go create mode 100644 pkg/dto/DispatchOrderDetailDTO.go create mode 100644 pkg/dto/DispatchOrderSkillDTO.go create mode 100644 pkg/dto/EnterChatroomDTO.go create mode 100644 pkg/dto/EnterRoomSceneDTO.go create mode 100644 pkg/dto/ExamDTO.go create mode 100644 pkg/dto/FriendShipRoomRuleDTO.go create mode 100644 pkg/dto/GiftTagDTO.go create mode 100644 pkg/dto/GiftWallDTO.go create mode 100644 pkg/dto/GoodsExchangeConfigDTO.go create mode 100644 pkg/dto/GoodsTagDTO.go create mode 100644 pkg/dto/GuildDTO.go create mode 100644 pkg/dto/HitEggResult.go create mode 100644 pkg/dto/HobbiesDTO.go create mode 100644 pkg/dto/HomeTabDTO.go create mode 100644 pkg/dto/ListChatroomDTO.go create mode 100644 pkg/dto/ListOrderDTO.go create mode 100644 pkg/dto/ListUserDTO.go create mode 100644 pkg/dto/MainTabBarDTO.go create mode 100644 pkg/dto/MessageOrderDTO.go create mode 100644 pkg/dto/MinePageMenuDTO.go create mode 100644 pkg/dto/MusicDTO.go create mode 100644 pkg/dto/OrderRateDTO.go create mode 100644 pkg/dto/PresentIdAndUserId.go create mode 100644 pkg/dto/QeekStarDto.go create mode 100644 pkg/dto/RankDTO.go create mode 100644 pkg/dto/RegionCodeDTO.go create mode 100644 pkg/dto/RevenueExchangeConfigDTO.go create mode 100644 pkg/dto/RockSkewerResultDTO.go create mode 100644 pkg/dto/ShareDTO.go create mode 100644 pkg/dto/SkillLevelPriceDTO.go create mode 100644 pkg/dto/SkillListDTO.go create mode 100644 pkg/dto/SkillOrderDetailDTO.go create mode 100644 pkg/dto/TaxDTO.go create mode 100644 pkg/dto/TimelineCategoryDTO.go create mode 100644 pkg/dto/TimelineDTO.go create mode 100644 pkg/dto/TimelineReplyDTO.go create mode 100644 pkg/dto/TopUsersDTO.go create mode 100644 pkg/dto/UserAliasNameDTO.go create mode 100644 pkg/dto/UserGiftBoxDTO.go create mode 100644 pkg/dto/UserInfoDTO.go create mode 100644 pkg/dto/UserStoreGoodsDTO.go create mode 100644 pkg/dto/UserTakedDispathOrderDTO.go create mode 100644 pkg/dto/UserVipIconDTO.go create mode 100644 pkg/dto/VisitUserDTO.go create mode 100644 pkg/dto/activity/BossBasicDTO.go create mode 100644 pkg/dto/activity/BossHpAndAttackRankDTO.go create mode 100644 pkg/dto/activity/ChatRoomLuckPrizeDTO.go create mode 100644 pkg/dto/activity/GeneralRankGiftDTO.go create mode 100644 pkg/dto/activity/WeekStarDTO.go create mode 100644 pkg/dto/activity/WeekStarGiftGrantDTO.go create mode 100644 pkg/dto/admin/diamond.go create mode 100644 pkg/dto/admin/skill.go create mode 100644 pkg/dto/admin/user.go create mode 100644 pkg/dto/applepay/IapReceiptData.go create mode 100644 pkg/dto/dataDTO.go create mode 100644 pkg/dto/inner/AppealOrderRequest.go create mode 100644 pkg/dto/inner/AttackBossRequest.go create mode 100644 pkg/dto/inner/BuyLuckBoxKeysRequest.go create mode 100644 pkg/dto/inner/GetActivityBossRequest.go create mode 100644 pkg/dto/inner/GetOpenBoxRankRequest.go create mode 100644 pkg/dto/inner/GetRoomWeeklyTopListRequest.go create mode 100644 pkg/dto/inner/GetSkillPrizeRequest.go create mode 100644 pkg/dto/inner/GetUserActivityAttackRankRequest.go create mode 100644 pkg/dto/inner/GetUserInfoRequest.go create mode 100644 pkg/dto/inner/GetVipConfigRequest.go create mode 100644 pkg/dto/inner/ManualRechargeRequest.go create mode 100644 pkg/dto/inner/MwebRechargeRequest.go create mode 100644 pkg/dto/inner/OpenBoxRequest.go create mode 100644 pkg/dto/inner/OperationAddDiamondRequest.go create mode 100644 pkg/dto/inner/OperationAddRevenueRequest.go create mode 100644 pkg/dto/inner/OrderRechargeRequest.go create mode 100644 pkg/dto/inner/PayToCustomerByAlipayRequest.go create mode 100644 pkg/dto/inner/ReturnWithdrawRevenueRequest.go create mode 100644 pkg/dto/inner/SendOfficalNoticeRequest.go create mode 100644 pkg/dto/inner/UpdateYunXinUserInfoRequest.go create mode 100644 pkg/dto/refund/refund_dto.go create mode 100644 pkg/dto/request/AddToBlackListRequest.go create mode 100644 pkg/dto/request/AgentRequest.go create mode 100644 pkg/dto/request/AgentTransferRequest.go create mode 100644 pkg/dto/request/BaseDispatchOrerIdRequest.go create mode 100644 pkg/dto/request/BaseOrerIdRequest.go create mode 100644 pkg/dto/request/BasePageRequest.go create mode 100644 pkg/dto/request/BasePagingReqest.go create mode 100644 pkg/dto/request/BaseRequest.go create mode 100644 pkg/dto/request/BaseSkillRequest.go create mode 100644 pkg/dto/request/BaseTimelineRequest.go create mode 100644 pkg/dto/request/BaseUserSkillRequest.go create mode 100644 pkg/dto/request/BuyChatroomEmojiRequest.go create mode 100644 pkg/dto/request/BuyerRateSkillOrderRequest.go create mode 100644 pkg/dto/request/ChangePasswordRequest.go create mode 100644 pkg/dto/request/ChatRoomBaseRequest.go create mode 100644 pkg/dto/request/ChatRoomCmdRequest.go create mode 100644 pkg/dto/request/ChatRoomKickOutUserRequest.go create mode 100644 pkg/dto/request/ChatRoomRankRequest.go create mode 100644 pkg/dto/request/ChatroomBuyGuardSeat.go create mode 100644 pkg/dto/request/ChatroomRockSkewerRequest.go create mode 100644 pkg/dto/request/ClearChatroomCharmRequest.go create mode 100644 pkg/dto/request/CollectRoomRequest.go create mode 100644 pkg/dto/request/CommonRequest.go create mode 100644 pkg/dto/request/CompleteUserInfoRequest.go create mode 100644 pkg/dto/request/CreateMallOrderRequest.go create mode 100644 pkg/dto/request/CreatePointOrderRequest.go create mode 100644 pkg/dto/request/CreateSkillOrderRequest.go create mode 100644 pkg/dto/request/CreateTimelineRequest.go create mode 100644 pkg/dto/request/DataRequest.go create mode 100644 pkg/dto/request/DeleteReplyRequest.go create mode 100644 pkg/dto/request/DeleteTimelineRequest.go create mode 100644 pkg/dto/request/DeleteUserCheckRequest.go create mode 100644 pkg/dto/request/DeleteUserPhotoRequest.go create mode 100644 pkg/dto/request/DispatchOrderRequest.go create mode 100644 pkg/dto/request/EnterRoomRequest.go create mode 100644 pkg/dto/request/ExamOrderRequest.go create mode 100644 pkg/dto/request/ExamRequest.go create mode 100644 pkg/dto/request/FindTreasureRequest.go create mode 100644 pkg/dto/request/FirstTimeBindMobileRequest.go create mode 100644 pkg/dto/request/FirstTimeSetPasswordRequest.go create mode 100644 pkg/dto/request/FollowUserRequest.go create mode 100644 pkg/dto/request/GeneralRankRequest.go create mode 100644 pkg/dto/request/GetBannerListRequest.go create mode 100644 pkg/dto/request/GetChatRoomActivityRequest.go create mode 100644 pkg/dto/request/GetChatRoomBlackReasonRequest.go create mode 100644 pkg/dto/request/GetChatroomListRequest.go create mode 100644 pkg/dto/request/GetChatroomOnlineGuardListRequest.go create mode 100644 pkg/dto/request/GetDispatchOrderCenterDataListRequest.go create mode 100644 pkg/dto/request/GetGoodsExchangeConfigRequest.go create mode 100644 pkg/dto/request/GetGoodsOrderListRequest.go create mode 100644 pkg/dto/request/GetHomeDataRequest.go create mode 100644 pkg/dto/request/GetHostGuardListRequest.go create mode 100644 pkg/dto/request/GetLocalMobileRequest.go create mode 100644 pkg/dto/request/GetMusicListRequest.go create mode 100644 pkg/dto/request/GetMyHitEggPrizeListRequest.go create mode 100644 pkg/dto/request/GetSkillLevelListRequest.go create mode 100644 pkg/dto/request/GetSkillSkuListH5Request.go create mode 100644 pkg/dto/request/GetSkillSkuListRequest.go create mode 100644 pkg/dto/request/GetSkillUserListRequest.go create mode 100644 pkg/dto/request/GetTimelineByCategoryRequest.go create mode 100644 pkg/dto/request/GetTimelineReplyChildrenRequest.go create mode 100644 pkg/dto/request/GetTimelineReplyListRequest.go create mode 100644 pkg/dto/request/GetUserAccountRequest.go create mode 100644 pkg/dto/request/GetUserChatroomRequest.go create mode 100644 pkg/dto/request/GetUserDetailRequest.go create mode 100644 pkg/dto/request/GetUserDiamondJournalRequest.go create mode 100644 pkg/dto/request/GetUserGuardSeatRequest.go create mode 100644 pkg/dto/request/GetUserSkillDetailH5Request.go create mode 100644 pkg/dto/request/GetUserSkillDetailRequest.go create mode 100644 pkg/dto/request/GetUserSkillRateListH5Request.go create mode 100644 pkg/dto/request/GetUserSkillRateListRequest.go create mode 100644 pkg/dto/request/GetUserStoreModelRequest.go create mode 100644 pkg/dto/request/GetUserTimelineRequest.go create mode 100644 pkg/dto/request/GetUserVisitLogRequest.go create mode 100644 pkg/dto/request/GoodsExchangeRequest.go create mode 100644 pkg/dto/request/Guild.go create mode 100644 pkg/dto/request/HeaderModel.go create mode 100644 pkg/dto/request/HitEggRequest.go create mode 100644 pkg/dto/request/LeaveRoomRequest.go create mode 100644 pkg/dto/request/NoticeRequest.go create mode 100644 pkg/dto/request/OpenRoomRequest.go create mode 100644 pkg/dto/request/PraiseReplyRequest.go create mode 100644 pkg/dto/request/PresentActivityGiftFromChatRoomRequest.go create mode 100644 pkg/dto/request/PresentGiftFromChatRoomRequest.go create mode 100644 pkg/dto/request/RefreshAccessTokenRequest.go create mode 100644 pkg/dto/request/RefundReq.go create mode 100644 pkg/dto/request/RelationCancelRequest.go create mode 100644 pkg/dto/request/RelationGiftRequest.go create mode 100644 pkg/dto/request/RelationInviteApplyRequest.go create mode 100644 pkg/dto/request/RelationInviteRequest.go create mode 100644 pkg/dto/request/RemoveFromBlackListRequest.go create mode 100644 pkg/dto/request/ReplyTimelineRequest.go create mode 100644 pkg/dto/request/ReportChatroomRequest.go create mode 100644 pkg/dto/request/ReportTimelineRequest.go create mode 100644 pkg/dto/request/ReportUserRequest.go create mode 100644 pkg/dto/request/ResetPasswordRequest.go create mode 100644 pkg/dto/request/RevenueExchangeDiamondRequest.go create mode 100644 pkg/dto/request/RichRequest.go create mode 100644 pkg/dto/request/SearchFollowUserRequest.go create mode 100644 pkg/dto/request/SearchUserByUserNoRequest.go create mode 100644 pkg/dto/request/SearchUserRequest.go create mode 100644 pkg/dto/request/SendMobileCodeRequest.go create mode 100644 pkg/dto/request/SendVericodeRequest.go create mode 100644 pkg/dto/request/SetChatroomAdminUserRequest.go create mode 100644 pkg/dto/request/SetChatroomBlackUserRequest.go create mode 100644 pkg/dto/request/SetChatroomHostUserRequest.go create mode 100644 pkg/dto/request/SetChatroomPwdRequest.go create mode 100644 pkg/dto/request/SetChildModeRequest.go create mode 100644 pkg/dto/request/SetRoomBackgroundRequest.go create mode 100644 pkg/dto/request/SetServiceStatusRequest.go create mode 100644 pkg/dto/request/SetSkillPriceRequest.go create mode 100644 pkg/dto/request/SetUpSeatTypeRequest.go create mode 100644 pkg/dto/request/SetUserAliasNameRequest.go create mode 100644 pkg/dto/request/SetUserBankInfoRequest.go create mode 100644 pkg/dto/request/SetUserHobbiesRequest.go create mode 100644 pkg/dto/request/SetUserPrivacyRequest.go create mode 100644 pkg/dto/request/SignWithAppleRequest.go create mode 100644 pkg/dto/request/SkillApplyRequest.go create mode 100644 pkg/dto/request/SkillEditRequest.go create mode 100644 pkg/dto/request/TakeOffStoreGoodsRequest.go create mode 100644 pkg/dto/request/TaskUpdateRequest.go create mode 100644 pkg/dto/request/TransferToAliAccountRequest.go create mode 100644 pkg/dto/request/UnFollowUserRequest.go create mode 100644 pkg/dto/request/UpdateChatroomInfoRequest.go create mode 100644 pkg/dto/request/UpdateChatroomNameAndNoticeRequest.go create mode 100644 pkg/dto/request/UpdateChatroomSeatTypeRequest.go create mode 100644 pkg/dto/request/UpdateMobileRequest.go create mode 100644 pkg/dto/request/UpdateUserAvatarRequest.go create mode 100644 pkg/dto/request/UpdateUserBirthdayRequest.go create mode 100644 pkg/dto/request/UpdateUserNickNameRequest.go create mode 100644 pkg/dto/request/UpdateUserPhotoIndexRequest.go create mode 100644 pkg/dto/request/UpdateUserSignRequest.go create mode 100644 pkg/dto/request/UpdateUserVideoRequest.go create mode 100644 pkg/dto/request/UploadMusicRequest.go create mode 100644 pkg/dto/request/UploadUserPhotoRequest.go create mode 100644 pkg/dto/request/UseHaveRandResultEmojiRequestRequest.go create mode 100644 pkg/dto/request/UseStoreGoodsRequest.go create mode 100644 pkg/dto/request/UserCertifyApplyAliRequest.go create mode 100644 pkg/dto/request/UserCertifyApplyRequest.go create mode 100644 pkg/dto/request/UserCharmWithdrawRequest.go create mode 100644 pkg/dto/request/UserIapRechargePreCheckRequest.go create mode 100644 pkg/dto/request/UserNcoinWithdrawRequest.go create mode 100644 pkg/dto/request/UserRechargeRequest.go create mode 100644 pkg/dto/request/UserSignInRequest.go create mode 100644 pkg/dto/request/UserSignUpRequest.go create mode 100644 pkg/dto/request/UserSignUpRobotRequest.go create mode 100644 pkg/dto/request/VerifyNickNameRequest.go create mode 100644 pkg/dto/request/VerifyVericodeRequest.go create mode 100644 pkg/dto/request/ZhimaCertifyConfirmRequest.go create mode 100644 pkg/dto/request/admin/GeneralRankRewarRequest.go create mode 100644 pkg/dto/response/Activity.go create mode 100644 pkg/dto/response/BasePagingResponse.go create mode 100644 pkg/dto/response/BaseResponse.go create mode 100644 pkg/dto/response/ChatroomPresentGiftResponse.go create mode 100644 pkg/dto/response/DispatchOrderEmployedResponse.go create mode 100644 pkg/dto/response/FindTreasureResponse.go create mode 100644 pkg/dto/response/GetAppVersionResponse.go create mode 100644 pkg/dto/response/GetChatroomCurrentRoundCharmResponse.go create mode 100644 pkg/dto/response/GetChatroomSeatAndQueueInfoResponse.go create mode 100644 pkg/dto/response/GetCreateOrderDataResponse.go create mode 100644 pkg/dto/response/GetDispatchOrderCenterDataListResponse.go create mode 100644 pkg/dto/response/GetHomeTopUsersResponse.go create mode 100644 pkg/dto/response/GetHostGuardListResponse.go create mode 100644 pkg/dto/response/GetMyWithdrawPageResponse.go create mode 100644 pkg/dto/response/GetUserAccountResponse.go create mode 100644 pkg/dto/response/GetUserBankInfoResponse.go create mode 100644 pkg/dto/response/GetUserChatroomResponse.go create mode 100644 pkg/dto/response/GetUserDetailResponse.go create mode 100644 pkg/dto/response/GetUserGuardSeatResponse.go create mode 100644 pkg/dto/response/GetUserRoomBgResponse.go create mode 100644 pkg/dto/response/GetUserSkillDetailResponse.go create mode 100644 pkg/dto/response/Guild.go create mode 100644 pkg/dto/response/MddResponse.go create mode 100644 pkg/dto/response/NoticeResponse.go create mode 100644 pkg/dto/response/OpenRoomResponse.go create mode 100644 pkg/dto/response/PresentGiftFromChatRoomResponse.go create mode 100644 pkg/dto/response/QiNiuTokenResponse.go create mode 100644 pkg/dto/response/RefreshAccessTokenResponse.go create mode 100644 pkg/dto/response/Response.go create mode 100644 pkg/dto/response/SearchResponse.go create mode 100644 pkg/dto/response/SendVericodeResponse.go create mode 100644 pkg/dto/response/SubmailResponse.go create mode 100644 pkg/dto/response/UserGoodsDTO.go create mode 100644 pkg/dto/response/UserSignInResponse.go create mode 100644 pkg/dto/yunxin/ImChatroomBizData.go create mode 100644 pkg/dto/yunxin/ImChatroomOnlineMember.go create mode 100644 pkg/dto/yunxin/ImUserExtData.go create mode 100644 pkg/dto/yunxin/UpdateRoomInfoRequest.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..fc97b96 --- /dev/null +++ b/main.go @@ -0,0 +1,29 @@ +package main + +import ( + _ "gitea.ddegame.cn/open/servicebase/pkg/authmeta" + _ "gitea.ddegame.cn/open/servicebase/pkg/cache" + _ "gitea.ddegame.cn/open/servicebase/pkg/cerrors" + _ "gitea.ddegame.cn/open/servicebase/pkg/client" + _ "gitea.ddegame.cn/open/servicebase/pkg/common" + _ "gitea.ddegame.cn/open/servicebase/pkg/constant" + _ "gitea.ddegame.cn/open/servicebase/pkg/datasource" + _ "gitea.ddegame.cn/open/servicebase/pkg/dto" + _ "gitea.ddegame.cn/open/servicebase/pkg/helper" + _ "gitea.ddegame.cn/open/servicebase/pkg/htools" + _ "gitea.ddegame.cn/open/servicebase/pkg/log" + _ "gitea.ddegame.cn/open/servicebase/pkg/middleware" + _ "gitea.ddegame.cn/open/servicebase/pkg/model" + _ "gitea.ddegame.cn/open/servicebase/pkg/partner/mq" + _ "gitea.ddegame.cn/open/servicebase/pkg/repo" + _ "gitea.ddegame.cn/open/servicebase/pkg/req" + _ "gitea.ddegame.cn/open/servicebase/pkg/res" + _ "gitea.ddegame.cn/open/servicebase/pkg/secure" + _ "gitea.ddegame.cn/open/servicebase/pkg/starter" + _ "gitea.ddegame.cn/open/servicebase/pkg/tools" + _ "gitea.ddegame.cn/open/servicebase/pkg/utils" +) + +func main() { + println("pkg main") +} diff --git a/pkg/client/http.go b/pkg/client/http.go index 876a508..24374a8 100644 --- a/pkg/client/http.go +++ b/pkg/client/http.go @@ -51,7 +51,7 @@ func Get(url string, headers map[string]string, params map[string]string) (res [ return } -func Post(url string, headers map[string]string, body map[string]interface{}) (res []byte, e error) { +func Post(url string, headers map[string]string, body map[string]any) (res []byte, e error) { var ( client = NewClient() resp *http.Response diff --git a/pkg/client/mongo.go b/pkg/client/mongo.go index 3369efd..fc30e70 100644 --- a/pkg/client/mongo.go +++ b/pkg/client/mongo.go @@ -47,35 +47,35 @@ func CheckTable(c context.Context, table string) error { return nil } -func InsertOne(c context.Context, table string, record interface{}) (*mongo.InsertOneResult, error) { +func InsertOne(c context.Context, table string, record any) (*mongo.InsertOneResult, error) { if e := CheckTable(c, table); e != nil { return nil, e } return DB.Collection(table).InsertOne(c, record) } -func SaveOne(c context.Context, table string, filter, record interface{}) (*mongo.UpdateResult, error) { +func SaveOne(c context.Context, table string, filter, record any) (*mongo.UpdateResult, error) { if e := CheckTable(c, table); e != nil { return nil, e } return DB.Collection(table).ReplaceOne(c, filter, record, options.Replace().SetUpsert(true)) } -func DeleteOne(c context.Context, table string, record interface{}) (*mongo.DeleteResult, error) { +func DeleteOne(c context.Context, table string, record any) (*mongo.DeleteResult, error) { if e := CheckTable(c, table); e != nil { return nil, e } return DB.Collection(table).DeleteOne(c, record) } -func UpdateByID(c context.Context, table string, id interface{}, record interface{}) (*mongo.UpdateResult, error) { +func UpdateByID(c context.Context, table string, id any, record any) (*mongo.UpdateResult, error) { if e := CheckTable(c, table); e != nil { return nil, e } return DB.Collection(table).UpdateByID(c, id, bson.D{{Key: "$set", Value: record}}) } -func Page(c context.Context, table string, page req.Page, filter bson.D, results interface{}) (int64, error) { +func Page(c context.Context, table string, page req.Page, filter bson.D, results any) (int64, error) { if e := CheckTable(c, table); e != nil { return 0, e } diff --git a/pkg/client/netease/IMService.go b/pkg/client/netease/IMService.go index e64fae1..dc22ed0 100644 --- a/pkg/client/netease/IMService.go +++ b/pkg/client/netease/IMService.go @@ -26,15 +26,15 @@ type ImService struct { // ImMsgBodyAttach IM消息 body对象 type ImMsgBodyAttach struct { - TypeCode string `json:"TypeCode"` - BizData interface{} `json:"BizData"` - Msg string `json:"msg,omitempty"` + TypeCode string `json:"TypeCode"` + BizData any `json:"BizData"` + Msg string `json:"msg,omitempty"` } // ChatRoomMsgAttach 聊天室自定义消息 type ChatRoomMsgAttach struct { - TypeCode string `json:"TypeCode"` - BizData interface{} `json:"BizData"` + TypeCode string `json:"TypeCode"` + BizData any `json:"BizData"` } // SendCustomMsgToChatroomByChatroomManager 向聊天室发消息 diff --git a/pkg/client/netease/live_person.go b/pkg/client/netease/live_person.go index 201164c..554fa14 100644 --- a/pkg/client/netease/live_person.go +++ b/pkg/client/netease/live_person.go @@ -58,7 +58,7 @@ type H5ReCheckLivePersonTokenRsp struct { IsPayed int64 `json:"isPayed"` SimilarityScore float64 `json:"similarityScore"` FaceMatched int64 `json:"faceMatched"` - FaceAttributeInfo interface{} `json:"faceAttributeInfo"` + FaceAttributeInfo any `json:"faceAttributeInfo"` ExtInfo ExtInfoEntity `json:"extInfo"` } diff --git a/pkg/client/tencent.go b/pkg/client/tencent.go index 10045e9..feb48a1 100644 --- a/pkg/client/tencent.go +++ b/pkg/client/tencent.go @@ -13,7 +13,7 @@ import ( sms "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms/v20210111" // 引入sms ) -func _SmsFullContent(template string, param []interface{}) string { +func _SmsFullContent(template string, param []any) string { var smsTemplateContentMap = map[string]string{ viper.GetString("tencent.smsTemplateCode"): "验证码为:{1},您正在登录,若非本人操作,请勿泄露。", } diff --git a/pkg/client/weichat_notice.go b/pkg/client/weichat_notice.go index dc1686c..ed34556 100644 --- a/pkg/client/weichat_notice.go +++ b/pkg/client/weichat_notice.go @@ -37,7 +37,7 @@ func WeSendMessage(openID, templateID string, message WeSendMessageReq, token st return } } - gotRes, err := Post(strings.ReplaceAll(SendMessageURL, "ACCESS_TOKEN", token), nil, map[string]interface{}{ + gotRes, err := Post(strings.ReplaceAll(SendMessageURL, "ACCESS_TOKEN", token), nil, map[string]any{ "template_id": templateID, "touser": openID, "data": message, diff --git a/pkg/comm/p_vars.go b/pkg/comm/p_vars.go deleted file mode 100644 index 3e83e6d..0000000 --- a/pkg/comm/p_vars.go +++ /dev/null @@ -1,5 +0,0 @@ -package comm - -const ( - ApiDomain = "https://www.jx3api.com" -) diff --git a/pkg/common/ConstVar.go b/pkg/common/ConstVar.go index 1bcd0dc..27b53a1 100644 --- a/pkg/common/ConstVar.go +++ b/pkg/common/ConstVar.go @@ -135,7 +135,7 @@ const ( RISK_TYPE_TEXT_COMMENT = "comment_detection" //评论检测 ) -func LogJson(v interface{}) { +func LogJson(v any) { b, _ := json.Marshal(v) logs.Info(string(b)) } diff --git a/pkg/common/HyTools/StringBuilder.go b/pkg/common/HyTools/StringBuilder.go index c6c0974..bfa8ed9 100644 --- a/pkg/common/HyTools/StringBuilder.go +++ b/pkg/common/HyTools/StringBuilder.go @@ -14,7 +14,7 @@ func NewStringBuilder() *StringBuilder { return &StringBuilder{buf: bytes.Buffer{}} } -func (this *StringBuilder) Append(obj interface{}) *StringBuilder { +func (this *StringBuilder) Append(obj any) *StringBuilder { this.buf.WriteString(fmt.Sprintf("%v", obj)) return this } @@ -24,7 +24,7 @@ func (this *StringBuilder) ToString() string { } // 字符串转int32 -func JsonStr(v interface{}) string { +func JsonStr(v any) string { bys, _ := json.Marshal(v) return string(bys) } diff --git a/pkg/common/es/document/user.go b/pkg/common/es/document/user.go index 03b4bf4..313180c 100644 --- a/pkg/common/es/document/user.go +++ b/pkg/common/es/document/user.go @@ -37,15 +37,15 @@ type User struct { WellNoIcon string } -//字符串: text keyword -//整数 : byte, short, integer, long -//浮点数: float, double -//布尔型: boolean -//日期: date -var UserIndex = map[string]interface{}{ - "settings": map[string]interface{}{"number_of_shards": 5, "number_of_replicas": 1}, - "mappings": map[string]interface{}{ - "properties": map[string]interface{}{ +// 字符串: text keyword +// 整数 : byte, short, integer, long +// 浮点数: float, double +// 布尔型: boolean +// 日期: date +var UserIndex = map[string]any{ + "settings": map[string]any{"number_of_shards": 5, "number_of_replicas": 1}, + "mappings": map[string]any{ + "properties": map[string]any{ "ActiveTime": map[string]string{"type": "date", "format": "yyyy-MM-dd HH:mm:ssZ||yyyy-MM-dd HH:mm:ss.SSSZ||yyyy-MM-ddZ||epoch_millis||epoch_second"}, "AlipayAccount": map[string]string{"type": "keyword"}, "AuthFailReason": map[string]string{"type": "text", "analyzer": "ik_max_word"}, @@ -83,10 +83,10 @@ var UserIndex = map[string]interface{}{ }, } -var MessageIndex = map[string]interface{}{ - "settings": map[string]interface{}{"number_of_shards": 5, "number_of_replicas": 1}, - "mappings": map[string]interface{}{ - "properties": map[string]interface{}{ +var MessageIndex = map[string]any{ + "settings": map[string]any{"number_of_shards": 5, "number_of_replicas": 1}, + "mappings": map[string]any{ + "properties": map[string]any{ "id": map[string]string{"type": "keyword"}, "curTime": map[string]string{"type": "date", "format": "yyyy-MM-dd HH:mm:ssZ||yyyy-MM-dd HH:mm:ss.SSSZ||yyyy-MM-ddZ||epoch_millis||epoch_second"}, }, diff --git a/pkg/common/es/es_client.go b/pkg/common/es/es_client.go index 6a52546..5392c42 100644 --- a/pkg/common/es/es_client.go +++ b/pkg/common/es/es_client.go @@ -70,7 +70,7 @@ func _connect() (c *elastic.Client) { } // 创建记录 -func (*EsClient) Create(index, id string, model interface{}) (body string, success bool, msg string) { +func (*EsClient) Create(index, id string, model any) (body string, success bool, msg string) { client := _connect() _, e := client.Index().Index(index).Id(id).BodyJson(model).Do(context.Background()) if e != nil { @@ -99,7 +99,7 @@ func (*EsClient) Exists(index, id string) (exists, success bool, msg string, e e } // 更新记录 -func (*EsClient) Update(index, id string, model interface{}) (body string, success bool, msg string) { +func (*EsClient) Update(index, id string, model any) (body string, success bool, msg string) { client := _connect() _, e := client.Update().Index(index).Id(id).Doc(model).Do(context.Background()) if e != nil { @@ -112,7 +112,7 @@ func (*EsClient) Update(index, id string, model interface{}) (body string, succe } // 搜索 -func (*EsClient) Search(index string, key string, fields ...string) (body []interface{}, success bool, msg string) { +func (*EsClient) Search(index string, key string, fields ...string) (body []any, success bool, msg string) { client := _connect() logs.Info("ES Search index =", index, " key =", key, " fields =", fields) var list []*elastic.WildcardQuery @@ -165,7 +165,7 @@ type ESSort struct { } // 搜索消息 -func (*EsClient) SearchMulti(index string, filter ESFilter, page, size int) (result interface{}, success bool, msg string) { +func (*EsClient) SearchMulti(index string, filter ESFilter, page, size int) (result any, success bool, msg string) { client := _connect() var list []elastic.Query for _, item := range filter.Queries { @@ -217,14 +217,14 @@ func (*EsClient) SearchMulti(index string, filter ESFilter, page, size int) (res if e != nil { return } - var body []interface{} + var body []any for _, item := range res.Hits.Hits { b, _ := item.Source.MarshalJSON() - m := make(map[string]interface{}) + m := make(map[string]any) _ = json.Unmarshal(b, &m) body = append(body, m) } - result = map[string]interface{}{ + result = map[string]any{ "Status": res.Status, "Total": res.Hits.TotalHits, "List": body, diff --git a/pkg/common/es/es_client_test.go b/pkg/common/es/es_client_test.go index 22306a1..51c9c36 100644 --- a/pkg/common/es/es_client_test.go +++ b/pkg/common/es/es_client_test.go @@ -45,7 +45,7 @@ func _testConnect() (c *elastic.Client) { func TestClientNew(t *testing.T) { var client EsClient - client.Create("es_index_message", "003", map[string]interface{}{ + client.Create("es_index_message", "003", map[string]any{ "id": "003", "curTime": 1440570500855, "f1": 1234, diff --git a/pkg/common/http/response/Activity.go b/pkg/common/http/response/Activity.go index 30bc083..d5d83b0 100644 --- a/pkg/common/http/response/Activity.go +++ b/pkg/common/http/response/Activity.go @@ -4,7 +4,7 @@ import "gitea.ddegame.cn/open/servicebase/pkg/common/http/dto" type CommonResponse struct { Code string - Result interface{} + Result any Msg string } @@ -22,15 +22,15 @@ type UserInviteSummaryResponse struct { Msg string } -func Success(data interface{}) (res CommonResponse) { +func Success(data any) (res CommonResponse) { res.Code = "6000" res.Result = data return } -func Page(data interface{}, count int64) (res CommonResponse) { +func Page(data any, count int64) (res CommonResponse) { res.Code = "6000" - res.Result = map[string]interface{}{ + res.Result = map[string]any{ "list": data, "count": count, } @@ -43,7 +43,7 @@ func Failed(msg string) (res CommonResponse) { return } -func Gen(code, msg string, result interface{}) (res CommonResponse) { +func Gen(code, msg string, result any) (res CommonResponse) { res.Code = code res.Msg = msg res.Result = result diff --git a/pkg/common/messages/event_message.go b/pkg/common/messages/event_message.go index f2af3a1..14c20e4 100644 --- a/pkg/common/messages/event_message.go +++ b/pkg/common/messages/event_message.go @@ -9,10 +9,10 @@ import ( // 事件 type Event struct { MessageId string - Tag EventTag // 消息标签:EventTagUser=用户 - Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新 - EventId string // 事件ID - EventContent interface{} // 事件内容 + Tag EventTag // 消息标签:EventTagUser=用户 + Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新 + EventId string // 事件ID + EventContent any // 事件内容 } type EventTag string diff --git a/pkg/common/netease/ImClient.go b/pkg/common/netease/ImClient.go index d742985..354a994 100644 --- a/pkg/common/netease/ImClient.go +++ b/pkg/common/netease/ImClient.go @@ -108,7 +108,7 @@ func (client *ImClient) CreateImUser(userId, nickName, avatar string) error { logs.Info("YunXin_SignUp_Success_AccID_%s:"+res, userId) } } - var body map[string]interface{} + var body map[string]any if errJson := json.Unmarshal([]byte(res), &body); errJson != nil { return errJson } @@ -129,7 +129,7 @@ func (client *ImClient) GetImUserInfo(userId string) error { sb.Append("accids=" + string(byteData)) res, err := HyTools.HttpDo(httpMethod, url, header, sb.ToString()) logs.Info("#" + "查询云信用户信息结果:" + res + "#") - var body map[string]interface{} + var body map[string]any if errJson := json.Unmarshal([]byte(res), &body); errJson != nil { return errJson } @@ -423,7 +423,7 @@ func (client *ImClient) UpdateRoomInfo(request yunxin.UpdateRoomInfoRequest) (er return } - resMap := make(map[string]interface{}) + resMap := make(map[string]any) jsonErr := json.Unmarshal([]byte(res), &resMap) if jsonErr != nil { diff --git a/pkg/common/netease/ImResponse.go b/pkg/common/netease/ImResponse.go index 5eb53cf..da096e0 100644 --- a/pkg/common/netease/ImResponse.go +++ b/pkg/common/netease/ImResponse.go @@ -1,8 +1,8 @@ package Netease type ImResponse struct { - Code int `json:"code"` - Desc interface{} `json:"desc"` + Code int `json:"code"` + Desc any `json:"desc"` } // 获取聊天室在线列表返回对象 diff --git a/pkg/common/network/response.go b/pkg/common/network/response.go index 4b5a87f..46e32cc 100644 --- a/pkg/common/network/response.go +++ b/pkg/common/network/response.go @@ -13,7 +13,7 @@ const ( type Response struct { Code string - Result interface{} + Result any Msg string } @@ -31,13 +31,13 @@ func Invalid() string { return string(str) } -func Success(data interface{}) Response { +func Success(data any) Response { response := Response{Code: SuccessCode, Result: data} return response } -func Page(data interface{}, count int64) Response { - response := Response{Code: SuccessCode, Result: map[string]interface{}{ +func Page(data any, count int64) Response { + response := Response{Code: SuccessCode, Result: map[string]any{ "List": data, "Count": count, }} diff --git a/pkg/common/pinyin/pinyin.go b/pkg/common/pinyin/pinyin.go index 4f69e6e..33b57af 100644 --- a/pkg/common/pinyin/pinyin.go +++ b/pkg/common/pinyin/pinyin.go @@ -20,7 +20,7 @@ var ( ) var ( - pinyinTemp map[vowel]interface{} + pinyinTemp map[vowel]any toneTemp map[vowel]vowel ) @@ -38,7 +38,7 @@ func LoadingPYFile(filename string) { if err != nil { panic(err) } - pinyinTemp = make(map[vowel]interface{}, 0) + pinyinTemp = make(map[vowel]any, 0) toneTemp = make(map[vowel]vowel) for i, t := range ys { toneTemp[t] = ws[i] diff --git a/pkg/common/util/string_util.go b/pkg/common/util/string_util.go index 09a6d43..6e29893 100644 --- a/pkg/common/util/string_util.go +++ b/pkg/common/util/string_util.go @@ -73,12 +73,12 @@ func ListToSet(list []string) (set []string) { return } -func ToJson(source interface{}) []byte { +func ToJson(source any) []byte { b, _ := json.Marshal(source) return b } -func ToJsonString(source interface{}) string { +func ToJsonString(source any) string { return string(ToJson(source)) } diff --git a/pkg/datasource/fields/field.go b/pkg/datasource/fields/field.go index df2e45e..88ac2f8 100644 --- a/pkg/datasource/fields/field.go +++ b/pkg/datasource/fields/field.go @@ -122,7 +122,7 @@ func (p Point) Value() (driver.Value, error) { return fmt.Sprintf("POINT(%f %f)", p.Lng, p.Lat), nil } -func (p *Point) Scan(src interface{}) error { +func (p *Point) Scan(src any) error { switch src.(type) { case []byte: var b = src.([]byte) @@ -156,7 +156,7 @@ func (loc Point) GormDataType() string { func (loc Point) GormValue(ctx context.Context, db *gorm.DB) clause.Expr { return clause.Expr{ SQL: "ST_PointFromText(?)", - Vars: []interface{}{fmt.Sprintf("POINT(%f %f)", loc.Lng, loc.Lat)}, + Vars: []any{fmt.Sprintf("POINT(%f %f)", loc.Lng, loc.Lat)}, } } diff --git a/pkg/dto/AccessTokenDTO.go b/pkg/dto/AccessTokenDTO.go new file mode 100644 index 0000000..3cb0233 --- /dev/null +++ b/pkg/dto/AccessTokenDTO.go @@ -0,0 +1,6 @@ +package dto + +type AccessTokenDTO struct { + AccessToken string + ExpireTime string +} diff --git a/pkg/dto/ActivityAttackRankDTO.go b/pkg/dto/ActivityAttackRankDTO.go new file mode 100644 index 0000000..282f128 --- /dev/null +++ b/pkg/dto/ActivityAttackRankDTO.go @@ -0,0 +1,10 @@ +package dto + +type ActivityAttackBossRankDTO struct { + BossId string + MonsterId string + MonsterName string + MonsterIcon string + BossDieAt string + Rank string +} diff --git a/pkg/dto/AppHomePageDTO.go b/pkg/dto/AppHomePageDTO.go new file mode 100644 index 0000000..85ef1e4 --- /dev/null +++ b/pkg/dto/AppHomePageDTO.go @@ -0,0 +1,123 @@ +package dto + +// 首页数据配置列表 +type HomePageDataConfig struct { + DataType HomePageDataTypeEnum // 数据类型 + DataSubjectId string // BANNER_LIST、SKILL_LIST为空,SKILL_SKU_LIST时SKILLID,ROOM_LIST时TABID + LayoutType HomePageDataLayoutTypeEnum + MaxCount string // 最大多少个数量 + Title string + GroupIcon string // 分组的ICON + +} + +// 首页列表数据类型枚举 +type HomePageDataTypeEnum string + +const ( + BroadCastList HomePageDataTypeEnum = "BROADCAST_LIST" // 广播列表 + BannerList HomePageDataTypeEnum = "BANNER_LIST" //BANNER列表 + SkillList HomePageDataTypeEnum = "SKILL_LIST" // 技能分类列表 + SkillSkuList HomePageDataTypeEnum = "SKILL_SKU_LIST" // 大神的资质列表 + RoomList HomePageDataTypeEnum = "ROOM_LIST" // 房间列表 + RoomCategory HomePageDataTypeEnum = "ROOM_CATEGORY" // 房间分类 + FastEnterRoom HomePageDataTypeEnum = "FAST_ENTER_ROOM" // 快速进房 + AnchorList HomePageDataTypeEnum = "ANCHOR_LIST" // 主播列表 + FunctionList HomePageDataTypeEnum = "FUNCTION_LIST" // 功能列表 + +) + +// 首页列表数据布局枚举 数据类型为SKILL_SKU_LIST时, slide=幻灯片滑动 grid=四方格 +type HomePageDataLayoutTypeEnum string + +const ( + Slide HomePageDataLayoutTypeEnum = "slide" + Grid HomePageDataLayoutTypeEnum = "grid" +) + +// 首页分组数据对象 +type HomeListDataDTO struct { + GroupName string // 标题 + DataType HomePageDataTypeEnum // 数据类型 + LayoutType HomePageDataLayoutTypeEnum // 布局方式 + MoreText string // 更多的文本 为空不显示 + MoreScheme string // 更多链接 + DataList interface{} + GroupIcon string // 分组的ICON + Ext interface{} `json:"Ext,omitempty"` // 扩展信息 +} + +// 技能SKU对象 +type SkillSkuDTO struct { + UserId string + NickName string + Gender string + Birthday string + SkillId string + UserSkillId string + SkillName string + SkillMode string + SkillLevel string + SkillCompanionType string + SkillAuth string // 技术认证信息 + BriefDesc string // 描述 + LocationDesc string // 位置描述 + LevelBgColor string + SkillLevelIcon string // 技能等级ICON + Avatar string + TotalOrderCount string + Price string `json:"Price,omitempty"` + UnitName string + AvgRateScore string + AudioTime string `json:"AudioTime,omitempty"` + SkillAudioUrl string `json:"SkillAudioUrl,omitempty"` + OnlineTime string // 在线时间 + SchemeLink string `json:"SchemeLink,omitempty"` // 跳转链接 + HornTagIcon string `json:"HornTagIcon,omitempty"` // 列表左上角ICON + GoodRate string // 好评率 + CreateTime string + PlayTimeUnit string + OrderStatus string `json:"OrderStatus,omitempty"` + Playing bool + PlayTimeRange []SkillSkuPlayRange + SmallIcon string + ColorFrom string + ColorTo string + SkuMedalList []VipIconDTO + NameTextColor string + LevelTextColor string + PropTimbre []PropDTO // 音色信息 + Props []PropDTO // 音色信息 - 为了兼容 + OrderRank *SkillSkuOrderRank `json:"OrderRank,omitempty"` // 订单排行 城市排行 + Distance string + LocationCountry string + LocationProvince string + LocationCity string + + GuildBase +} + +type SkillSkuPlayRange struct { + Start string + End string +} + +type SkillSkuOrderRank struct { + Type string // country province city + Icon string // 图标 + Rank int64 // 排名 + SkillColor string // 技能颜色 + SkillDesc string // 技能描述 + RankColor string // 排名颜色 + RankDesc string // 排名描述 + BgColor string // 背景色 +} + +type HomeUserTimbreRes struct { + UserId string + NickName string + Avatar string + IsFollowTa string `json:"IsFollowTa,omitempty"` // 是否关注他 + TimbreValue string + TimbreUrl string +} diff --git a/pkg/dto/BannerDTO.go b/pkg/dto/BannerDTO.go new file mode 100644 index 0000000..1819e29 --- /dev/null +++ b/pkg/dto/BannerDTO.go @@ -0,0 +1,22 @@ +package dto + +type BannerDTO struct { + BannerId string + Title string + ImageUrl string + LinkUrl string + BackgroundUrl string + ShareIconUrl string + ShareLinkUrl string + ShareTitle string + ShareDescription string + Scheme string + MinApiNum string + BeginViewAt string + EndViewAt string +} + +type FunctionDTO struct { + ImageUrl string + Scheme string +} diff --git a/pkg/dto/BroadCastDTO.go b/pkg/dto/BroadCastDTO.go new file mode 100644 index 0000000..6a17856 --- /dev/null +++ b/pkg/dto/BroadCastDTO.go @@ -0,0 +1,9 @@ +package dto + +type BroadCastDTO struct { + BroadcastId string + Title string + Content string + SchemeLink string + TextColor string +} diff --git a/pkg/dto/CharmJournalDTO.go b/pkg/dto/CharmJournalDTO.go new file mode 100644 index 0000000..0cb67ce --- /dev/null +++ b/pkg/dto/CharmJournalDTO.go @@ -0,0 +1,12 @@ +package dto + +// 魅力流水明细 +type CharmJournalDTO struct { + JournalId string + CharmNum string // 魅力值数量 + CreateTime string // 交易时间 + InOrOut string // 进出 + SectionTitle string // 时间年月 + Description string // 交易说明 + Balance string +} diff --git a/pkg/dto/ChatroomActivityDTO.go b/pkg/dto/ChatroomActivityDTO.go new file mode 100644 index 0000000..fc934d1 --- /dev/null +++ b/pkg/dto/ChatroomActivityDTO.go @@ -0,0 +1,13 @@ +package dto + +type ChatroomActivityDTO struct { + ActivityId string + ActivityName string + ActivityImageUrl string + ActivityScheme string + AmountType string + OpenType string + ActionType string // 操作类型 1=打开scheme链接 2=购买赠送 + ActPrice string // 显示的价格 + ActTagIcon string +} diff --git a/pkg/dto/ChatroomCmdResult.go b/pkg/dto/ChatroomCmdResult.go new file mode 100644 index 0000000..3e931b9 --- /dev/null +++ b/pkg/dto/ChatroomCmdResult.go @@ -0,0 +1,39 @@ +package dto + +// 聊天室命令执行返回结果 +type ChatroomCmdResult struct { + Version string // 命令版本号 + ChatroomId string // 聊天室Id + CmdCode string // 命令代码 + RoomName string // 聊天室名称 + TemplateId string // 聊天室模板ID + SeatIndex string // 位置索引 + UserId string // 用户ID + UserNo string // 用户No + Avatar string // 用户头像 + Birthday string // 用户生日 + Gender string // 用户性别 + NickName string // 用户昵称 + VipLevel string // 用户vip等级 + IsAdmin string // 是否管理员 + Charm string // 用户魅力值 + SelectIndex string `json:"SelectIndex,omitempty"` // 交友模板用 选择的座位号 + SelectUserId string `json:"SelectUserId,omitempty"` // 交友模板用 选择的用户ID + SelectAvatar string `json:"SelectAvatar,omitempty"` // 交友模板用 选择的用户头像 + SelectNickName string `json:"SelectNickName,omitempty"` // 交友模板用 选择的用户头像 + InLove string `json:"InLove,omitempty"` // 交友模板用 互相选择 + SeatType string `json:"SeatType,omitempty"` // 座位类型 + AvatarDecoration string `json:"AvatarDecoration,omitempty"` // 头饰 上麦命令传用户头饰 + DecorationFormat string `json:"DecorationFormat,omitempty"` // 头饰格式 + CountDown string `json:"CountDown,omitempty"` //SeatIndex的座位倒计时 + NameColor string `json:"NameColor,omitempty"` // 用户昵称的颜色 + NobilitySeatNameColor []string `json:"NobilitySeatNameColor,omitempty"` // 贵族麦上昵称颜色 + VipConfig UserVipConfigDTO // 用户VIP CONFIG + InLoveScene FriendShipRoomSceneDTO // 交友模板用 牵手场景 + AllowQueue string // 禁麦= 不允许排队 开麦=允许排队 + DownUserId string // 下麦人 105 + DownSeatIndex string // 下麦位置 105 + UpUserId string // 上麦位置 105 + UpSeatIndex string // 上麦人 105 + UpSeatMute string // 105 上麦后是否禁麦 1=禁麦 0=开麦 +} diff --git a/pkg/dto/ChatroomDTO.go b/pkg/dto/ChatroomDTO.go new file mode 100644 index 0000000..fd085bc --- /dev/null +++ b/pkg/dto/ChatroomDTO.go @@ -0,0 +1,69 @@ +package dto + +type ChatroomDTO struct { + ChatroomId string // 房间ID + RoomNo string // 房间NO + TotalIncome string // 总收入 + WeeklyTotalIncome string // 周榜收入 + RoomName string // 房间名称 + MessageRoomId string // 云信消息聊天室ID + OnlineUserCount string // 在线人数 + TemplateId string // 模板ID + RoomPwd string // 房间密码 + IsLocked string // 是否有锁 + RoomOwner ListUserDTO // 房主信息 + AdminList []string // 管理员ID列表 + IsCollect string // 是否收藏该房间 + UserSeat string // 用户座位框 + IsSuperAdmin string // 是否超管 + RoomOnlineHidden string // 房间在线列表隐身 + MaxMemberCount string // 房间最大人数 + BackgroundImg string // 背景图 + SeatFrameUrl string // 座位框 + IsRoomTopUser string // 是否榜一 + RoomTag string // 标签 + RobotCount string // 机器人数 + TabId string // 分类id + GuardSeatValue string `json:"GuardSeatValue,omitempty"` // 守护位的值,电台模板的用户进入 + GuardSeatType string `json:"GuardSeatType,omitempty"` // 守护位的值,电台模板的用户进入 + GuardIcon string `json:"GuardIcon,omitempty"` // 守护位的值,电台模板的用户进入 + ToPrevRoomWeeklyRevenue string // 距离周房间榜前一名的收入差异 + GuestCanUseEmoji string // 不在麦上是否可以发表情,1=能 0=不能 + SendMessageTimeGap string // 发消息时间间隔 -1 不允许发言 0=不受限制 10=10s发一次言 + UpSeatType string // 上麦方式1=排麦 2=自由上麦 + //1.游戏场景; 普通音质 + audioshowroom + //2. 娱乐场景; 高音质 + audioshowroom + //3.K歌场景; 高音质 + gamestreamging + AudioQualityLevel string // 音质等级 + SkewerBtnIcon string + HiteggBtnIcon string + IsRecordCharm string // 是否记录魅力 + AudioChannelType string // 音频服务商 + RoomAvatar string // 房间头像 + WellNoIcon string `json:"WellNoIcon,omitempty"` // 房间靓号ICON + Hot string + + Announcement string + WelcomeMessage string + + DispatchOrder ChatroomDispatchOrderDTO `json:"DispatchOrder,omitempty"` // 派单对象 + UserVipConfig UserVipConfigDTO `json:"UserVipConfig,omitempty"` // 用户VIP配置对象 + RoomConsumeRankBackImg string `json:"RoomConsumeRankBackImg,omitempty"` // 贡献榜背景图 + RoomRevenueRankBackImg string `json:"RoomRevenueRankBackImg,omitempty"` // 收益榜背景图 + + // 交友厅中心背景图 + FriendShipRoomCenterImg string `json:"FriendShipRoomCenterImg,omitempty"` + + // 声网加入token + RtnToken string `json:"RtnToken,omitempty"` + // 频道麦序倒计时 + SeatCountDown string + // 父频道ID + ParentId string + RootId string + AllowQueue string + TalkRoomList []ListChatroomDTO + SelfOperated string // 是否自营 1=是 0=否 + + GuildBase +} diff --git a/pkg/dto/ChatroomDispatchOrderDTO.go b/pkg/dto/ChatroomDispatchOrderDTO.go new file mode 100644 index 0000000..36bff09 --- /dev/null +++ b/pkg/dto/ChatroomDispatchOrderDTO.go @@ -0,0 +1,12 @@ +package dto + +// 聊天室派单订单对象 +type ChatroomDispatchOrderDTO struct { + OrderCount string // 订单数 + SuccessRate string // 接单成功率 + AvgRateScore string // 评分 + FailRate string // 接单失败率 + DispatchOrderDuration string // 派单时长 + CurrentOrderId string // 当前派单中的订单ID 没有派单中的为空 + PassedSeconds string // 已派单的秒数 +} diff --git a/pkg/dto/ChatroomEmojiDTO.go b/pkg/dto/ChatroomEmojiDTO.go new file mode 100644 index 0000000..c1027d7 --- /dev/null +++ b/pkg/dto/ChatroomEmojiDTO.go @@ -0,0 +1,14 @@ +package dto + +type ChatroomEmojiDTO struct { + EmojiId string + EmojiName string + DynimacImgUrl string + StaticImgUrl string + EmojiType string + NeedPaid string + EmojiPrice string + TimeSpan string + SortNo string + LimitChatroomIds string +} diff --git a/pkg/dto/ChatroomListUserDTO.go b/pkg/dto/ChatroomListUserDTO.go new file mode 100644 index 0000000..b55f756 --- /dev/null +++ b/pkg/dto/ChatroomListUserDTO.go @@ -0,0 +1,27 @@ +package dto + +// 聊天室榜单用户对象 +type ChatroomListUserDTO struct { + ListUserDTO + Consume string + Charm string +} + +// 榜单用户信息 +type RankUserInfoDTO struct { + RankNo string + UserId string + NickName string + Avatar string + Gender string + Birthday string + Sign string + ViewFlag string + UserNo string + WellNoIcon string `json:"WellNoIcon,omitempty"` // 靓号ICON + VipConfig UserVipConfigDTO `json:"VipConfig,omitempty"` //vip配置 + Consume string // 贡献值 + Charm string // 魅力值 + IsHidden string // 隐身 + +} diff --git a/pkg/dto/ChatroomTemplateDTO.go b/pkg/dto/ChatroomTemplateDTO.go new file mode 100644 index 0000000..afcc726 --- /dev/null +++ b/pkg/dto/ChatroomTemplateDTO.go @@ -0,0 +1,7 @@ +package dto + +type ChatroomTemplateDTO struct { + TemplateId string + TemplateName string + BackgroundImg string +} diff --git a/pkg/dto/DiamindJournalDTO.go b/pkg/dto/DiamindJournalDTO.go new file mode 100644 index 0000000..5072345 --- /dev/null +++ b/pkg/dto/DiamindJournalDTO.go @@ -0,0 +1,22 @@ +package dto + +// DiamondJournalDTO 钻石流水明细 +type DiamondJournalDTO struct { + JournalId string + DiamondNum string // 钻石数量 + CreateTime string // 交易时间 + InOrOut string // 进出 + SectionTitle string // 时间年月 + Description string // 交易说明 + Balance string +} + +// NCoinJournalDTO N币流水明细 +type NCoinJournalDTO struct { + JournalId string + NCoinNum string // 钻石数量 + CreateTime string // 交易时间 + InOrOut string // 进出 + SectionTitle string // 时间年月 + Description string // 交易说明 +} diff --git a/pkg/dto/DispatchOrderCenterDataDTO.go b/pkg/dto/DispatchOrderCenterDataDTO.go new file mode 100644 index 0000000..879d1a0 --- /dev/null +++ b/pkg/dto/DispatchOrderCenterDataDTO.go @@ -0,0 +1,56 @@ +package dto + +// 派单中心数据对象 +type DispatchOrderCenterDataDTO struct { + DispatchOrderId string + HostUserId string + HostUserAvatar string + HostUserNickname string + HostUserNo string + BuyerId string + BuyerUserAvatar string + BuyerUserNickname string + BuyerUserNo string + SkillIcon string + SkillName string + CustomerRequirement string + Scheme string + CreateTime string + Status string //1派单中 2=完成 3=弃单 + Title string // 消息中心使用 + SkillMode string + SkillLevel string + SkillService string + Gender string + OrderCnt int32 + OrderPrice int32 + OrderAmount int32 + ChatroomId string + UnitName string + TakeStatus string // 接单状态 + TakeStatusDesc string // 接单状态文案描述 + StatusDesc string // 派单状态文案描述 + Lock string + + GuildBase +} + +type DispatchOrderCombineDTO struct { + // model_master.TDispatchOrder + TakeStatus string `gorm:"column:take_status;" json:"take_status"` // 接单状态 +} + +var TakeStatusDesc = map[string]string{ + "success": "抢单成功", + "failed": "抢单失败", + "notTake": "未抢单", + "init": "抢单中", + "cancel": "取消抢单", + "dispatch_cancel": "取消派单", +} + +var StatusDesc = map[string]string{ + "1": "派单中", + "2": "派单成功", + "3": "派单结束", +} diff --git a/pkg/dto/DispatchOrderDetailDTO.go b/pkg/dto/DispatchOrderDetailDTO.go new file mode 100644 index 0000000..b0730ac --- /dev/null +++ b/pkg/dto/DispatchOrderDetailDTO.go @@ -0,0 +1,39 @@ +package dto + +// 派单订单详情对象 +type DispatchOrderDetailDTO struct { + DispatchOrderId string + ChatroomId string + BuyerId string + BuyerAvatar string + BuyerNickname string + BuyerUserNo string + HostUserId string + HostUserAvatar string + HostUserNickname string + HostUserNo string + SkillId string + SkillIcon string + SkillName string + SkillMode string + SkillLevel string + SkillService string + PriceRange string // 0-10,0-20,0-30,0-40 + PassedSeconds string // 过去的秒数 + DispatchUserCount string // 已推送人数 + OrderUnitName string // 计价单位 + OrderUnitValue string // 计价值 + NeedsAudition string // 是否试音 T=是 F=否 + Gender string + CustomerRequirement string + OrderCnt int32 + OrderPrice int32 + OrderAmount int32 + CreateTime string + Status string //1派单中 2=完成 3=弃单 + Locked string // T F + TakedUserIds []string // 已接单用户列表 + TakedUserList []SellerSimpleDTO // 已接单用户列表 + + GuildBase +} diff --git a/pkg/dto/DispatchOrderSkillDTO.go b/pkg/dto/DispatchOrderSkillDTO.go new file mode 100644 index 0000000..f0b0efb --- /dev/null +++ b/pkg/dto/DispatchOrderSkillDTO.go @@ -0,0 +1,9 @@ +package dto + +// 派单技能对象 +type DispatchOrderSkillDTO struct { + SkillId string + SkillName string + PriceRange string // 0-10,0-20,0-30,0-40 + UnitName string +} diff --git a/pkg/dto/EnterChatroomDTO.go b/pkg/dto/EnterChatroomDTO.go new file mode 100644 index 0000000..5138f6c --- /dev/null +++ b/pkg/dto/EnterChatroomDTO.go @@ -0,0 +1,8 @@ +package dto + +type EnterChatroomDTO struct { + RoomId string + EnterRoomSchema string + Avatar string + NickName string +} diff --git a/pkg/dto/EnterRoomSceneDTO.go b/pkg/dto/EnterRoomSceneDTO.go new file mode 100644 index 0000000..9b64358 --- /dev/null +++ b/pkg/dto/EnterRoomSceneDTO.go @@ -0,0 +1,25 @@ +package dto + +// 进入房间特效 +type EnterRoomSceneDTO struct { + SceneId string + BgImgUrl string // 背景图地址 + EnterText string // 进入文字 第一行跟在用户昵称后面 + EnterTextColor string + BriefText string // 场景主题描述 第二行 + BriefTextColor string + SceneNameColor string // 入场场景上的名字颜色 + AnimationFormat string +} + +// 房间背景 +type RoomBackgroundImgDTO struct { + BackgroundId string + BackgroundName string // 背景名称 + BackgroundThumb string // 背景缩略图 + BackgroundImgUrl string // 背景URL + GetTypeName string // 获取方式 DEFAULT=默认 ACTIVITY=活动获得 MALL=商城获得 + IsGot string // 是否拥有 + TagIcon string // 标签 + IsUsing string // 是否使用中 +} diff --git a/pkg/dto/ExamDTO.go b/pkg/dto/ExamDTO.go new file mode 100644 index 0000000..a7d11db --- /dev/null +++ b/pkg/dto/ExamDTO.go @@ -0,0 +1,53 @@ +package dto + +type GetExaminerDTO struct { + NickName string + UserNo string + UserId string + Avatar string +} + +type GetExamDTO struct { + Price string // 砖石价格 + ExamID string // 考试ID + Gender string // 参加考试的人的性别 男生-G 女生-M 不限-N + FirstFree string // y n +} + +type RateDTO struct { + Content string +} + +type ExamNoticeDTO struct { + Content string + CreateAt string + ImgUrl string +} + +type ExamOrderLstDTO struct { + OrderLst []*ExamOrderDTO + HasMore bool +} + +type ExamOrderDTO struct { + OrderNo string + NickName string + UserNo string + Avatar string + CreatTime string + SkillName string + MapName string + Level string + Requirement string + Price string + OrderStatus string + OrderActionLst []string + Remark string + UserId string + FirstFree string + ReviewStatus int // 2-通过 1-未通过 0-未审核 + ReviewReason string + RateContent string + SupportReply string + SupportReason string +} diff --git a/pkg/dto/FriendShipRoomRuleDTO.go b/pkg/dto/FriendShipRoomRuleDTO.go new file mode 100644 index 0000000..de98b61 --- /dev/null +++ b/pkg/dto/FriendShipRoomRuleDTO.go @@ -0,0 +1,43 @@ +package dto + +// 规则对象 +type FriendShipRoomRuleDTO struct { + MaleHatList []FriendShipRoomHatDTO // 男生帽子 + FemaleHatList []FriendShipRoomHatDTO // 女生帽子 + SceneList []FriendShipRoomSceneDTO // 场景列表 +} + +// 帽子对象 +type FriendShipRoomHatDTO struct { + LevelName string // 等级 Lv1 + Charm string // 魅力值 + HatSample string // 帽子示例 +} + +// 场景对象 +type FriendShipRoomSceneDTO struct { + // 场景参数 + SceneName string `json:"SceneName,omitempty"` // 场景名称 + Charm string `json:"Charm,omitempty"` // 需要魅力值 + SceneIcon string `json:"SceneIcon,omitempty"` //Icon + SceneThumb string `json:"SceneThumb,omitempty"` // 缩略图 + SceneAnimationFormat string `json:"SceneAnimationFormat,omitempty"` // 场景动效格式 SVGA/APNG + SceneAnimationUrl string `json:"SceneAnimationUrl,omitempty"` // 场景地址 + SceneFillMode string `json:"SceneFillMode,omitempty"` // 填充模式 1=左右 2=上下 + + // 牵手动画参数 + InLoveBackground string `json:"InLoveBackground,omitempty"` // 牵手背景 APNG动画 + InLoveAnimationFormat string `json:"InLoveAnimationFormat,omitempty"` // 牵手背景格式 SVGA/APNG + InLoveAnimationFillMode string `json:"InLoveAnimationFillMode,omitempty"` // 填充模式 1=左右 2=上下 + InLoveBackgroundWidth string `json:"InLoveBackgroundWidth,omitempty"` // 牵手背景 宽度 + InLoveBackgroundHeight string `json:"InLoveBackgroundHeight,omitempty"` // 牵手背景 高度 + AvatarSize string `json:"AvatarSize,omitempty"` // 头像大小 + NameColor string `json:"NameColor,omitempty"` // 名字颜色 + LeftAvatarMarginLeft string `json:"LeftAvatarMarginLeft,omitempty"` // 左侧头像距离左侧 + LeftAvatarMarginTop string `json:"LeftAvatarMarginTop,omitempty"` // 左侧头像距离顶部 + RightAvatarMarginRight string `json:"RightAvatarMarginRight,omitempty"` // 右侧头像距离右侧 + RightAvatarMarginTop string `json:"RightAvatarMarginTop,omitempty"` // 右侧头像距离顶部 + ViewBgAfterSceneBegin string `json:"ViewBgAfterSceneBegin,omitempty"` // 场景开始后几秒开始出现牵手动画 + ViewAvatarAfterBackground string `json:"ViewAvatarAfterBackground,omitempty"` // 背景开始后几秒开始出现用户头像昵称 + +} diff --git a/pkg/dto/GiftTagDTO.go b/pkg/dto/GiftTagDTO.go new file mode 100644 index 0000000..35a9e4b --- /dev/null +++ b/pkg/dto/GiftTagDTO.go @@ -0,0 +1,13 @@ +package dto + +import "time" + +type GiftTagDTO struct { + GiftId string + GiftTagId string + GiftTagName string + GiftTagIcon string + Priority int32 + StartTime time.Time + EndTime time.Time +} diff --git a/pkg/dto/GiftWallDTO.go b/pkg/dto/GiftWallDTO.go new file mode 100644 index 0000000..765f985 --- /dev/null +++ b/pkg/dto/GiftWallDTO.go @@ -0,0 +1,10 @@ +package dto + +type GiftWallDTO struct { + GiftId string + GiftName string + GiftImgUrl string + ReceivedCount string + GiftPrice string + IsExpire string // 礼物是否过期 1=过期 +} diff --git a/pkg/dto/GoodsExchangeConfigDTO.go b/pkg/dto/GoodsExchangeConfigDTO.go new file mode 100644 index 0000000..eb41a57 --- /dev/null +++ b/pkg/dto/GoodsExchangeConfigDTO.go @@ -0,0 +1,14 @@ +package dto + +// 兑换配置 +type GoodsExchangeConfigDTO struct { + ConfigId string + GoodsId string + GoodsName string + GoodsIcon string + TargetType string + TargetId string + TargetName string + TargetIcon string + NeedCount string +} diff --git a/pkg/dto/GoodsTagDTO.go b/pkg/dto/GoodsTagDTO.go new file mode 100644 index 0000000..f1b9d5e --- /dev/null +++ b/pkg/dto/GoodsTagDTO.go @@ -0,0 +1,13 @@ +package dto + +import "time" + +type GoodsTagDTO struct { + GoodsId string + GoodsTagId string + GoodsTagName string + GoodsTagIcon string + Priority int32 + StartTime time.Time + EndTime time.Time +} diff --git a/pkg/dto/GuildDTO.go b/pkg/dto/GuildDTO.go new file mode 100644 index 0000000..d01b84b --- /dev/null +++ b/pkg/dto/GuildDTO.go @@ -0,0 +1,25 @@ +package dto + +type GuildBase struct { + GuildId string + GuildInfo GuildInfo +} + +type GuildInfo struct { + No string + Name string + Logo string + BriefDesc string + ChairmanUserID string + MemberCnt int32 + OrderInstrScheme string // 点单须知地址 + ChatGroupId string + ChatGroupName string +} + +type GuildDTO struct { + GuildBase + GuildName string + GuildScheme string + GuildLogo string +} diff --git a/pkg/dto/HitEggResult.go b/pkg/dto/HitEggResult.go new file mode 100644 index 0000000..06c00c4 --- /dev/null +++ b/pkg/dto/HitEggResult.go @@ -0,0 +1,79 @@ +package dto + +type HitEggResultItem struct { + GiftId string + GiftName string + GiftImage string + GiftCount string + GiftPrice string + TotalDiamond string +} + +// 砸蛋结果 +type HitEggResult struct { + WinLevel string + RandNum string + SolutionId string + WinDiamond string + DiamondBalance string + GiftItemList []HitEggResultItem +} + +// 开箱结果对象 +type OpenBoxResult struct { + WinLevel string + RandNum string + WinDiamond string + DiamondBalance string + ItemList []OpenBoxResultItem +} + +// 开箱结果明细对象 +type OpenBoxResultItem struct { + PrizeType string // 奖品类型 1=礼物 2=道具 + PrizeId string // 类型=1时是礼物ID 类型=2时是道具ID + PrizeName string // 奖品类型 + PrizeImage string + PrizeCount string + PrizePrice int + TotalDiamond string +} + +// 盲盒类活动奖品结果 +type ActivityPrizeResult struct { + UserId string + Item ActivityPrizeResultItem +} + +// 盲盒类活动奖品结果明细对象 +type ActivityPrizeResultItem struct { + ActivityPrizeSequenceId string // 抽中的序列ID + PrizeType string // 奖品类型 GIFT=礼物 PROP=道具 + PrizeId string // 类型=1时是礼物ID 类型=2时是道具ID + PrizeName string // 奖品类型 + PrizeImage string + PrizeReSourceUrl string // 如果是道具返回道具的Resource字段 + PrizeCount string + PrizePrice int + TotalDiamond string +} + +// 打怪类结果 +type AttackBossResult struct { + HitCount string + WinTotalDiamond string + DiamondBalance string + ItemList []AttackBossResultItem +} + +// 打怪结果明细对象 +type AttackBossResultItem struct { + PrizeType string // 奖品类型 GIFT=礼物 PROP=道具 + PrizeId string // 类型=GIFT时是礼物ID 类型=PROP时是道具ID + PrizeName string // 奖品名称 + PrizeImage string + PrizeReSourceUrl string // 如果是道具返回道具的Resource字段 + PrizeCount int + PrizePrice int + TotalDiamond int64 +} diff --git a/pkg/dto/HobbiesDTO.go b/pkg/dto/HobbiesDTO.go new file mode 100644 index 0000000..6c5d209 --- /dev/null +++ b/pkg/dto/HobbiesDTO.go @@ -0,0 +1,32 @@ +package dto + +type HobbiesDTO struct { + Type string // hobby=兴趣爱好 tag=用户标签 + HobbyId string + HobbyName string +} + +type PropDTO struct { + Key string // timbre=音色 auth_identity=平台认证 + Value string + ValueExt string // 比如音色会带音频链接 + Duration string // 时长 +} + +type SkuPrice struct { + ID string `gorm:"column:id;type:char(32);primaryKey;comment:主键 卖家技能列表" json:"PriceId"` // 主键 卖家技能列表 + SellerID string `gorm:"column:seller_id;type:char(32);not null;comment:卖家ID" json:"SellerId"` // 卖家ID + UserID string `gorm:"column:user_id;type:char(32);not null;uniqueIndex:uk_user_skill,priority:1;comment:用户ID" json:"UserId"` // 用户ID + SkillID string `gorm:"column:skill_id;type:char(32);not null;uniqueIndex:uk_user_skill,priority:2;index:skill_id_index,priority:1;comment:技能ID" json:"SkillId"` // 技能ID + SkillCertImg string `gorm:"column:skill_cert_img;type:varchar(100);not null;comment:技能资质图" json:"SkillCertImg"` // 技能资质图 + SkillAudioURL string `gorm:"column:skill_audio_url;type:varchar(100);not null;comment:技能语音" json:"SkillAudioUrl"` // 技能语音 + AudioTime int32 `gorm:"column:audio_time;type:int;not null;comment:语音长度 单位秒" json:"AudioTime"` // 语音长度 单位秒 + SkillVideoURL string `gorm:"column:skill_video_url;type:varchar(100);not null;comment:技能视频" json:"SkillVideoUrl"` // 技能视频 + SkillMode string `gorm:"column:skill_mode;type:varchar(64);not null;uniqueIndex:uk_user_skill,priority:3;comment:技能模式(如三角洲的不同地图)" json:"SkillMode"` // 技能模式(如三角洲的不同地图) + SkillLevel string `gorm:"column:skill_level;type:varchar(30);not null;comment:技能等级" json:"SkillLevel"` // 技能等级 + SkillService string `gorm:"column:skill_service;type:varchar(30);not null;uniqueIndex:uk_user_skill,priority:4;comment:不同服务类型价格不同(如物资单、体验单)" json:"SkillService"` // 不同服务类型价格不同(如物资单、体验单) + SkillConfigID string `gorm:"column:skill_config_id;type:char(32);not null;comment:技能配置ID" json:"SkillConfigId"` // 技能配置ID + GameRole string `gorm:"column:game_role;type:varchar(30);not null;comment:游戏位置" json:"GameRole"` // 游戏位置 + Price int32 `gorm:"column:price;type:int;not null;comment:价格 单位钻" json:"Price"` // 价格 单位钻 + BriefDesc *string `gorm:"column:brief_desc;type:varchar(150);comment:技能简要介绍" json:"BriefDesc"` // 技能简要介绍 +} diff --git a/pkg/dto/HomeTabDTO.go b/pkg/dto/HomeTabDTO.go new file mode 100644 index 0000000..d0d4fc3 --- /dev/null +++ b/pkg/dto/HomeTabDTO.go @@ -0,0 +1,12 @@ +package dto + +type HomeTabDTO struct { + TabId string + TabName string + Schema string + ChatRoomTemplateId string + ViewInHome string + TabType string // 房间类型 1=运营厅 2=个人厅 + TabIcon string // 图标 + TabIconUnselect string // 图标-未选中 +} diff --git a/pkg/dto/ListChatroomDTO.go b/pkg/dto/ListChatroomDTO.go new file mode 100644 index 0000000..aca1ae1 --- /dev/null +++ b/pkg/dto/ListChatroomDTO.go @@ -0,0 +1,118 @@ +package dto + +type PinDaoChatroomGroupDTO struct { + GroupId string + GroupName string + ParentRoomID string + Comment string + SortNo int32 + CntChild int32 + RoomList []*ListChatroomSimpleDTO `json:"RoomList,omitempty"` +} + +// func (d *PinDaoChatroomGroupDTO) FromModel(m *model_master.TChatroomGroup) { +// if m == nil { +// return +// } +// d.GroupId = m.ID +// d.GroupName = m.Name +// d.ParentRoomID = m.RoomID +// d.Comment = m.Comment +// d.SortNo = m.SortNo +// d.CntChild = m.CntChild +// } + +type ListChatroomDTO struct { + ChatroomId string `json:"ChatroomId,omitempty"` // 房间ID + MessageRoomId string `json:"MessageRoomId,omitempty"` // 消息房间ID + RoomNo string `json:"RoomNo,omitempty"` // 房间NO + RoomName string `json:"RoomName,omitempty"` + OnlineUserCount string `json:"OnlineUserCount,omitempty"` // 在线人数 + TemplateId string `json:"TemplateId,omitempty"` // 模板ID + RoomPwd string `json:"RoomPwd,omitempty"` // 房间密码 + IsLocked string `json:"IsLocked,omitempty"` // 是否有锁 + OwnerUserId string `json:"OwnerUserId,omitempty"` // 房主用户ID + OwnerAvatar string `json:"OwnerAvatar,omitempty"` // 房主头像 + HostNickName string `json:"HostNickName,omitempty"` // 主持人昵称 + HostUserId string `json:"HostUserId,omitempty"` // 主持人用户Id + HostAvatar string `json:"HostAvatar,omitempty"` // 主持人用户Id + HostIsAdmin string `json:"HostIsAdmin,omitempty"` // 主持是否是管理员 + MaxMemberCount string `json:"MaxMemberCount,omitempty"` // 房间最大人数 + Status string `json:"Status,omitempty"` // 房间状态 0=冻结 1=开启 2=关闭 + RobotCount string // 机器人数 + OwnerNickName string `json:"OwnerNickName,omitempty"` // 房主昵称 + TabId string // 分类ID + AudioChannelType string // 音频服务商类型 + ViewSkewer string + Hot string + CurrentRevenue int64 `json:"CurrentRevenue"` // 实时分钟流水 + RoomTagIcon string `json:"RoomTagIcon"` // 房间的运营标签(金牌 推荐 火热)热门首页展示 + TabTagName string `json:"TabTagName"` // 分类的标签名称 (情感 电台 音乐) 热门首页展示 + TabTagIcon string `json:"TabTagIcon"` // 分类的标签icon (情感 电台 音乐) 热门首页展示 + HomeTabTagIcon string `json:"HomeTabTagIcon"` // 首页分类的标签icon (情感 电台 音乐) 热门首页展示 + SchemeLink string `json:"SchemeLink,omitempty"` // 房间的Scheme + RoomAvatar string `json:"RoomAvatar,omitempty"` + WellNoIcon string `json:"WellNoIcon,omitempty"` + ParentId string `json:"ParentId"` + RootId string `json:"RootId"` + AllowQueue string `json:"AllowQueue"` + Announcement string `json:"Announcement"` + GroupId string + IsCollected string + GroupList []*PinDaoChatroomGroupDTO `json:"GroupList,omitempty"` // 房间下的分组列表 + SelfOperated string // 是否自营 1=是 0=否 + + GuildBase +} + +type ListChatroomDTOS []ListChatroomDTO + +// 获取此 slice 的长度 +func (p ListChatroomDTOS) Len() int { + return len(p) +} + +// 根据实时分钟流水降序排序 (此处按照自己的业务逻辑写) +func (p ListChatroomDTOS) Less(i, j int) bool { + return p[i].CurrentRevenue > p[j].CurrentRevenue +} + +// 交换数据 +func (p ListChatroomDTOS) Swap(i, j int) { + p[i], p[j] = p[j], p[i] +} + +// 按人数排序的数组 +type ChatroomDTOListSortByOnlineNum []ListChatroomDTO + +// 获取此 slice 的长度 +func (p ChatroomDTOListSortByOnlineNum) Len() int { + return len(p) +} + +// 根据实时分钟流水降序排序 (此处按照自己的业务逻辑写) +func (p ChatroomDTOListSortByOnlineNum) Less(i, j int) bool { + return p[i].OnlineUserCount > p[j].OnlineUserCount +} + +// 交换数据 +func (p ChatroomDTOListSortByOnlineNum) Swap(i, j int) { + p[i], p[j] = p[j], p[i] +} + +type ListChatroomSimpleDTO struct { + ChatroomId string `json:"ChatroomId,omitempty"` // 房间ID + MessageRoomId string `json:"MessageRoomId,omitempty"` // 消息房间ID + RoomNo string `json:"RoomNo,omitempty"` // 房间NO + RoomName string `json:"RoomName,omitempty"` + OnlineUserCount string `json:"OnlineUserCount,omitempty"` // 在线人数 + TemplateId string `json:"TemplateId,omitempty"` // 模板ID + IsLocked string `json:"IsLocked,omitempty"` // 是否有锁 + OwnerUserId string `json:"OwnerUserId,omitempty"` // 房主用户ID + TabId string // 分类ID + SchemeLink string `json:"SchemeLink,omitempty"` // 房间的Scheme + ParentId string `json:"ParentId"` + RootId string `json:"RootId"` + GroupId string + GroupList []*PinDaoChatroomGroupDTO `json:"GroupList,omitempty"` // 房间下的分组列表 +} diff --git a/pkg/dto/ListOrderDTO.go b/pkg/dto/ListOrderDTO.go new file mode 100644 index 0000000..36d57e2 --- /dev/null +++ b/pkg/dto/ListOrderDTO.go @@ -0,0 +1,47 @@ +package dto + +// 列表订单对象 +type ListOrderDTO struct { + OrderId string + OrderNo string + ChatroomId string + ChatroomScheme string + HostUserId string + HostUserAvatar string + HostUserNickname string + HostUserNo string + SellerUserId string + SellerNickName string + SellerAvatar string + BuyerUserId string + BuyerAvatar string + BuyerNickName string + UserSkillId string + SkillId string + SkillName string + PriceId string + OrderPrice string + OrderCount string + OrderCountComplete string + OrderAmount string + OrderAmountPaid string + OrderAmountType string + BuyerMemo string + BeginTime string + EndTime string + PayStatus string + OrderClientStatus string + IsRate string + UnitName string + RateScore string + SkillIcon string + SkillMode string + SkillLevel string + SkillService string + SysMemo string + + BuyerActionList []string + SellerActionList []string + + GuildBase +} diff --git a/pkg/dto/ListUserDTO.go b/pkg/dto/ListUserDTO.go new file mode 100644 index 0000000..5550bf6 --- /dev/null +++ b/pkg/dto/ListUserDTO.go @@ -0,0 +1,49 @@ +package dto + +// 列表用户对象 +type ListUserDTO struct { + UserId string + NickName string + Avatar string + Gender string + Birthday string + Sign string + ViewFlag string + UserNo string + VipLevel string + IsFollowTa string `json:"IsFollowTa,omitempty"` // 是否关注他 + ActiveTimeHint string `json:"ActiveTimeHint,omitempty"` // 活跃时间 + TaFollowMe string `json:"TaFollowMe,omitempty"` + WellNoIcon string `json:"WellNoIcon,omitempty"` // 靓号ICON + VipConfig UserVipConfigDTO `json:"VipConfig,omitempty"` //vip配置 + IsHidden string `json:"IsHidden,omitempty"` // 隐身 + InRoomSchema string `json:"InRoomSchema,omitempty"` // 在房间的schema + +} + +// 列表主播对象 +type ListAnchorDTO struct { + UserId string + NickName string + Avatar string + Birthday string + Gender string + ChatroomId string + ChatroomName string + RoomNo string + RoomHot string + IconList []VipIconDTO + SchemaUrl string + RoomStatus string +} + +func (userDTo ListUserDTO) ToListAnchorDTO() (result ListAnchorDTO) { + + result.UserId = userDTo.UserId + result.NickName = userDTo.NickName + result.Avatar = userDTo.Avatar + result.Birthday = userDTo.Birthday + result.Gender = userDTo.Gender + + return +} diff --git a/pkg/dto/MainTabBarDTO.go b/pkg/dto/MainTabBarDTO.go new file mode 100644 index 0000000..fb16c49 --- /dev/null +++ b/pkg/dto/MainTabBarDTO.go @@ -0,0 +1,11 @@ +package dto + +type MainTabBarDTO struct { + TabBarName string + IconAnimationUrl string + PlayCount string // 播放次数 0=无限播放 + SelectedTextColor string // 选中状态文字颜色 + NormalTextColor string + MinApiNum string // 最小版本号 + MaxApiNum string // 最大的版本 +} diff --git a/pkg/dto/MessageOrderDTO.go b/pkg/dto/MessageOrderDTO.go new file mode 100644 index 0000000..9432a40 --- /dev/null +++ b/pkg/dto/MessageOrderDTO.go @@ -0,0 +1,34 @@ +package dto + +// 消息订单对象 +type MessageOrderDTO struct { + OrderId string + OrderNo string + UserAvatar string + UserType string // 1=买家 2=卖家 + SkillName string + OrderCount string + UnitName string + BeginTime string + OrderClientStatus string + Title string + MsgCreateTime string + + SkillMode string + SkillLevel string + SkillService string +} + +// 互动消息对象 +type MessageTimelineHuDongDTO struct { + TimelineId string + UserId string + UserAvatar string + UserNickName string + NameColor string + ContentText string + CreateTimeStr string + TimelineCoverImg string + TimelineType string // 1=图片 2=视频 + Title string +} diff --git a/pkg/dto/MinePageMenuDTO.go b/pkg/dto/MinePageMenuDTO.go new file mode 100644 index 0000000..ea5fb21 --- /dev/null +++ b/pkg/dto/MinePageMenuDTO.go @@ -0,0 +1,8 @@ +package dto + +type MinePageMenuDTO struct { + MenuIcon string + MenuName string + MenuScheme string + Notification int +} diff --git a/pkg/dto/MusicDTO.go b/pkg/dto/MusicDTO.go new file mode 100644 index 0000000..eade4ae --- /dev/null +++ b/pkg/dto/MusicDTO.go @@ -0,0 +1,15 @@ +package dto + +type MusicDTO struct { + MusicId string + MusicName string + MusicUrl string + TypeName string + Singer string + UploadUserId string + UploadUserName string + CreateTime string + Size string + Long string + Status string `json:"Status,omitempty"` +} diff --git a/pkg/dto/OrderRateDTO.go b/pkg/dto/OrderRateDTO.go new file mode 100644 index 0000000..18db677 --- /dev/null +++ b/pkg/dto/OrderRateDTO.go @@ -0,0 +1,32 @@ +package dto + +// 订单评论对象 +type OrderRateDTO struct { + RateId string + OrderId string + UserSkillId string + BuyerUserId string + BuyerAvatarDecoration string // 用户头像框 + BuyerDecorationFormat string + BuyerNickName string + BuyerAvatar string + RateScore string + CreateTime string + ImageUrl []string + RateContent string + IsHidden string + ReplyLst []*RateReply +} + +type RateReply struct { + ReplyId string + ReplyRole string + Content string + CreateTime string + ImageUrl []string + NickName string + Avatar string + AvatarDecoration string // 用户头像框 + DecorationFormat string + UserId string +} diff --git a/pkg/dto/PresentIdAndUserId.go b/pkg/dto/PresentIdAndUserId.go new file mode 100644 index 0000000..281d602 --- /dev/null +++ b/pkg/dto/PresentIdAndUserId.go @@ -0,0 +1,7 @@ +package dto + +// 打赏事务返回打赏ID和用户Id +type PresentIdAndUserId struct { + PresentId string + UserId string +} diff --git a/pkg/dto/QeekStarDto.go b/pkg/dto/QeekStarDto.go new file mode 100644 index 0000000..f1fb50c --- /dev/null +++ b/pkg/dto/QeekStarDto.go @@ -0,0 +1,7 @@ +package dto + +type GiftPrizeImage struct { + Rank int `json:"rank"` + ImageUrl string `json:"imageUrl"` + ImagePcUrl string `json:"imagePcUrl"` +} diff --git a/pkg/dto/RankDTO.go b/pkg/dto/RankDTO.go new file mode 100644 index 0000000..d4d6b32 --- /dev/null +++ b/pkg/dto/RankDTO.go @@ -0,0 +1,49 @@ +package dto + +import "github.com/shopspring/decimal" + +type RichStatDTO struct { + UserNo string `json:"UserNo"` + NickName string `json:"NickName"` + Avatar string `json:"Avatar"` + UserID string `json:"-"` + HomeSchema string `json:"HomeSchema"` + Cnt decimal.Decimal `json:"Cnt"` + Amount decimal.Decimal `json:"Amount"` +} + +type PopularityStatDTO struct { + UserNo string `json:"UserNo"` + NickName string `json:"NickName"` + Avatar string `json:"Avatar"` + UserID string `json:"-"` + HomeSchema string `json:"HomeSchema"` + Cnt decimal.Decimal `json:"Cnt"` + Amount decimal.Decimal `json:"Amount"` +} + +type GeneralStatDTO struct { + UserNo string `json:"UserNo"` + NickName string `json:"NickName"` + Avatar string `json:"Avatar"` + UserID string `json:"-"` + HomeSchema string `json:"HomeSchema"` + Amount decimal.Decimal `json:"Amount"` + RankNo int64 `json:"RankNo"` +} + +type MySelfRank struct { + Day *GeneralStatDTO + Week *GeneralStatDTO + Month *GeneralStatDTO + Year *GeneralStatDTO +} + +type CombineStatDTO struct { + Day []*GeneralStatDTO + Week []*GeneralStatDTO + Month []*GeneralStatDTO + Year []*GeneralStatDTO + MySelfRank *MySelfRank + RankCode string +} diff --git a/pkg/dto/RegionCodeDTO.go b/pkg/dto/RegionCodeDTO.go new file mode 100644 index 0000000..7b47864 --- /dev/null +++ b/pkg/dto/RegionCodeDTO.go @@ -0,0 +1,6 @@ +package dto + +type RegionCodeDTO struct { + RegionCode string + RegionName string +} diff --git a/pkg/dto/RevenueExchangeConfigDTO.go b/pkg/dto/RevenueExchangeConfigDTO.go new file mode 100644 index 0000000..3bfdd9a --- /dev/null +++ b/pkg/dto/RevenueExchangeConfigDTO.go @@ -0,0 +1,6 @@ +package dto + +type RevenueExchangeConfigDTO struct { + FromAmount string + ToAmount string +} diff --git a/pkg/dto/RockSkewerResultDTO.go b/pkg/dto/RockSkewerResultDTO.go new file mode 100644 index 0000000..35b3882 --- /dev/null +++ b/pkg/dto/RockSkewerResultDTO.go @@ -0,0 +1,8 @@ +package dto + +// 摇签结果对象 检查状态和摇签返回 +type RockSkewerResultDTO struct { + IsRocked string + DefaultSkewerIcon string + SkewerResult []string +} diff --git a/pkg/dto/ShareDTO.go b/pkg/dto/ShareDTO.go new file mode 100644 index 0000000..c967e1c --- /dev/null +++ b/pkg/dto/ShareDTO.go @@ -0,0 +1,16 @@ +package dto + +// 分享对象 +type ShareDTO struct { + ShareLink string + ShareTitle string // + ShareDescription string + ShareIconUrl string // 分享的icon + LinkUrl string // 打开的链接 +} + +type VisitCountDTO struct { + VisitCount string // 访问数 + VisitedCount string // 被访问数 + NewVisitedCount string // 新被访问数 +} diff --git a/pkg/dto/SkillLevelPriceDTO.go b/pkg/dto/SkillLevelPriceDTO.go new file mode 100644 index 0000000..3ce1818 --- /dev/null +++ b/pkg/dto/SkillLevelPriceDTO.go @@ -0,0 +1,51 @@ +package dto + +import "github.com/shopspring/decimal" + +// 技能等级价格列表对象 +type SkillLevelPriceDTO struct { + LevelName string + PriceList []PriceDTO +} + +// 价格DTO +type PriceDTO struct { + Price string + LimitOrderCount string +} + +// 用户技能价格对象 +type UserSkillPriceDTO struct { + Price string + CanSet string // 是否可设置改价格 +} + +type SkillConfigDTO struct { + ID string `gorm:"column:id;type:char(32);primaryKey;comment:主键" json:"ConfigId"` // 主键 + SkillID string `gorm:"column:skill_id;type:char(32);not null;comment:技能ID" json:"SkillId"` // 技能ID + DataType string `gorm:"column:data_type;type:varchar(64);not null;comment:类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格" json:"DataType"` // 类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 + ChildType string `gorm:"column:child_type;type:varchar(64);not null;comment:子分类:类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 为空时表示为叶子节点" json:"ChildType"` // 子分类:类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 为空时表示为叶子节点 + ParentID string `gorm:"column:parent_id;type:char(32);not null;comment:父节点 mode:skillId level:modeId gender:levelId price:genderId" json:"ParentID"` // 父节点 mode:skillId level:modeId gender:levelId price:genderId + Value string `gorm:"column:value;type:varchar(64);not null;comment:名称 mode:玩法名称 level:等级名称 gender:性别名称 price:价格内容" json:"Value"` // 名称 mode:玩法名称 level:等级名称 gender:性别名称 price:价格内容 + Comment string `gorm:"column:comment;type:varchar(255);not null;comment:描述" json:"Comment"` // 描述 + RankPriority int32 `gorm:"column:rank_priority;type:int;not null;comment:节点排名权重,高权重可以兼容低权重" json:"RankPriority"` // 节点排名权重,高权重可以兼容低权重 + SortNo int32 `gorm:"column:sort_no;type:int;not null;default:1000;comment:排序从小到大" json:"SortNo"` // 排序从小到大 + PriceMale int32 `gorm:"column:price_male;type:int;not null;comment:男陪价格" json:"PriceMale"` // 男陪价格 + PriceFemale int32 `gorm:"column:price_female;type:int;not null;comment:女陪价格" json:"PriceFemale"` + UnitName string + UnitValue string + DifficultyValues string // mode的难度选项 机密,绝密 + DifficultyDefaultValue string // mode的难度默认值 机密 + LevelRemark string // 等级的备注,下单时选了等级,有备注显示下备注 + Children []*SkillConfigDTO `json:"Children" gorm:"-"` +} + +type OrderStatisticDTO struct { + UserNo string `json:"UserNo"` + NickName string `json:"NickName"` + Avatar string `json:"Avatar"` + UserID string `json:"-"` + HomeSchema string `json:"HomeSchema"` + Cnt decimal.Decimal `json:"Cnt"` + Amount decimal.Decimal `json:"Amount"` +} diff --git a/pkg/dto/SkillListDTO.go b/pkg/dto/SkillListDTO.go new file mode 100644 index 0000000..eb42d80 --- /dev/null +++ b/pkg/dto/SkillListDTO.go @@ -0,0 +1,109 @@ +package dto + +// 技能列表对象 +type SkillListDTO struct { + CategoryId string + CategoryName string + SkillList []SkillDTO +} + +// 技能DTO +type SkillDTO struct { + SkillId string + SkillName string + SkillIcon string + UnitName string + SkillBriefDesc string `json:"SkillBriefDesc,omitempty"` + LevelList []string `json:"LevelList,omitempty"` + IsNeedAudio string `json:"IsNeedAudio,omitempty"` + GameRoleList []string `json:"GameRoleList,omitempty"` + IsNeedGameRole string `json:"IsNeedGameRole,omitempty"` + CertSampleImg string `json:"CertSampleImg,omitempty"` + UserSampleAvatar string `json:"UserSampleAvatar,omitempty"` + SchemeLink string `json:"SchemeLink,omitempty"` + IsNeedCertImg string `json:"IsNeedCertImg,omitempty"` + ViewForAa string `json:"ViewForAa,omitempty"` + SpecialRequirements string `json:"SpecialRequirements,omitempty"` +} + +// 用户可申请技能对象 +type UserApplySkillDTO struct { + SkillDTO + UserSkillStatus string `json:"UserSkillStatus,omitempty"` // 用户技能状态 1=正常 2=待审核 3=冻结 4=拒绝 0=未申请过 + OfficialBriefDesc string `json:"OfficialBriefDesc,omitempty"` // 冻结 拒绝原因等 + +} + +// 按分类返回可申请的技能 +type CategoryApplySkillDTO struct { + CategoryId string + CategoryName string + ApplySkillDTOList []UserApplySkillDTO +} + +type SKU interface { + SetLocationDesc() + SetOrderRank() +} + +// 用户技能DTO +type UserSkillDTO struct { + UserSkillId string + UserId string `json:"UserId,omitempty"` + SkillId string `json:"SkillId,omitempty"` + SkillName string + SkillIcon string + SmallIcon string + SkillBriefDesc string `json:"SkillBriefDesc,omitempty"` // 技能说明 + SkillCertImg string `json:"SkillCertImg,omitempty"` + IsNeedAudio string `json:"IsNeedAudio,omitempty"` + SkillAudioUrl string `json:"SkillAudioUrl,omitempty"` + AudioTime string `json:"AudioTime,omitempty"` + Price string `json:"Price,omitempty"` + PriceMin string `json:"PriceMin,omitempty"` + PriceMax string `json:"PriceMax,omitempty"` + SkillVideoUrl string `json:"SkillVideoUrl,omitempty"` + SkillLevel string `json:"SkillLevel,omitempty"` + SkillMode string `json:"SkillMode,omitempty"` + SkillAuth string // 技术认证信息 + SkillCompanionType string + LocationDesc string // 位置描述 + GameRole string `json:"GameRole,omitempty"` + TotalOrderCount string `json:"TotalOrderCount,omitempty"` + RateCount string `json:"RateCount,omitempty"` + RateScore string `json:"RateScore,omitempty"` + AvgRateScore string `json:"AvgRateScore,omitempty"` // 平均分 + BriefDesc string `json:"BriefDesc,omitempty"` // 个人说明 + SkillStatus string `json:"SkillStatus,omitempty"` // 状态 1=正常 2=待审核 3=冻结 4=拒绝 + ServiceStatus string `json:"ServiceStatus,omitempty"` // 服务状态 + OfficialBriefDesc string `json:"OfficialBriefDesc,omitempty"` // 官方说明 拒绝原因 冻结原因 通过介绍 + UnitName string `json:"UnitName,omitempty"` // 单位名称 + LevelBgColor string `json:"LevelBgColor,omitempty"` // 等级的背景颜色 + SkillLevelIcon string `json:"SkillLevelIcon,omitempty"` // 等级的icon + OrderRank SkillSkuOrderRank // 订单排行 城市排行 + // 样例图 + CertSampleImg string `json:"CertSampleImg,omitempty"` + UserSampleAvatar string `json:"UserSampleAvatar,omitempty"` + // 对应的价格列表 我的技能列表返回 + LevelPriceList []UserSkillPriceDTO `json:"PriceList,omitempty"` + // 技能列表 + LevelList []string `json:"LevelList,omitempty"` // 擅长位置列表 + IsNeedGameRole string `json:"IsNeedGameRole,omitempty"` + GameRoleList []string `json:"GameRoleList,omitempty"` + // 是否需要技能认证图 + IsNeedCertImg string `json:"IsNeedCertImg,omitempty"` + GoodRate string `json:"GoodRate,omitempty"` + // 苹果审核可见 + ViewForAa string `json:"ViewForAa,omitempty"` + + // 获取创建订单页面返回 + SkuPriceList []SkuPrice `json:"SkuPriceList,omitempty"` // 单子类型价格列表 + + ColorFrom string + ColorTo string + NameTextColor string + LevelTextColor string + AllowEditPrice string //0=不允许 1=允许 + SellerStar string //0=不允许 1=允许 + GuildBase +} diff --git a/pkg/dto/SkillOrderDetailDTO.go b/pkg/dto/SkillOrderDetailDTO.go new file mode 100644 index 0000000..197c7b5 --- /dev/null +++ b/pkg/dto/SkillOrderDetailDTO.go @@ -0,0 +1,36 @@ +package dto + +// 订单详情对象 +type SkillOrderDetailDTO struct { + GuildBase + OrderId string + OrderNo string + UserSkillId string + SkillId string + SkillName string + SkillMode string + SkillLevel string + SkillService string + OrderPrice string + OrderCount string + OrderCountComplete string + OrderAmount string + OrderAmountPaid string + OrderExt string + BuyerMemo string + BeginTime string + PayStatus string + OrderClientStatus string //1=已下单待支付 2=已支付待接单 3=已接单 4=已完成 5=已取消 6=申诉中 7=申诉完成 8=待服务 9=进行中 + IsRate string + UnitName string + BuyerUserDTO ListUserDTO // 买家用户信息 + SellerUserDTO ListUserDTO // 卖家用户信息 + SysMemo string // 系统备注 + // PayOrder = 支付订单 CancelOrder = 取消订单 AgreeOrder= 同意接单 RefuseOrder=拒绝接单 FinishOrder = 确认完成 RequestRefund=请求退款 AgreeRefund=同意退款 RefuseRefund=拒绝退款 + // 买家操作列表 + BuyerActionList []string + SellerActionList []string + + // 评论对象 + OrderRate OrderRateDTO +} diff --git a/pkg/dto/TaxDTO.go b/pkg/dto/TaxDTO.go new file mode 100644 index 0000000..0bcabae --- /dev/null +++ b/pkg/dto/TaxDTO.go @@ -0,0 +1,7 @@ +package dto + +type TaxDTO struct { + WithdrawCash string // 提现金额 + Tax string // 扣除手续费之后的个税 + HandleFee string // 手续费费 +} diff --git a/pkg/dto/TimelineCategoryDTO.go b/pkg/dto/TimelineCategoryDTO.go new file mode 100644 index 0000000..7a01afd --- /dev/null +++ b/pkg/dto/TimelineCategoryDTO.go @@ -0,0 +1,7 @@ +package dto + +// 动态分类的DTO +type TimelineCategoryDTO struct { + CategoryId string + CategoryName string +} diff --git a/pkg/dto/TimelineDTO.go b/pkg/dto/TimelineDTO.go new file mode 100644 index 0000000..d4b8502 --- /dev/null +++ b/pkg/dto/TimelineDTO.go @@ -0,0 +1,63 @@ +package dto + +type TimelineDTO struct { + TimelineId string + ContentType string //1=动态 2=视频 + UserId string + AvatarDecoration string // 用户头像框 + DecorationFormat string + TextContent string + ImgUrls string + ImgSizes string + Status string + CreateTime string + ViewCount string + LoveCount string + ReplyCount string + ImgDTOList []TimelineImgDTO `json:"ImgDTOList,omitempty"` + VideoDTO TimelineVideoDTO `json:"VideoDTO,omitempty"` + CityName string + AddressName string + BriefDesc string // 简要说明 + DashangCount string + DashangDiamond string + + //User信息 + NickName string + Avatar string + Gender string + Birthday string + VipConfig UserVipConfigDTO + UserLastActiveTime string // 用户在线时间 + IsRecommend string + IsPraised string // 是否点赞过 1=是 2=否 + Dist string // 距离 + IsSeller string + OrderStatus string `json:"OrderStatus,omitempty"` // 订单状态 idle=空闲 accepting=接单中 + CreateTimeStr string + ShareData ShareDTO + IsFollowed string // 是否关注过 + UserSkillId string `json:"UserSkillId,omitempty"` + SkillName string `json:"SkillName,omitempty"` + PriceStr string `json:"PriceStr,omitempty"` +} + +// 动态的图片对象 +type TimelineImgDTO struct { + ImgPhotoKey string `json:"ImgPhotoKey,omitempty"` + ImgUrl string + Width string + Height string +} + +// 动态的视频对象 +type TimelineVideoDTO struct { + VideoKey string `json:"VideoKey,omitempty"` + Width string + Height string + Duration string + VideoUrl string + VideoGifUrl string + VideoWaterUrl string + VideoCoverImgUrl string +} diff --git a/pkg/dto/TimelineReplyDTO.go b/pkg/dto/TimelineReplyDTO.go new file mode 100644 index 0000000..4bb1fbc --- /dev/null +++ b/pkg/dto/TimelineReplyDTO.go @@ -0,0 +1,46 @@ +package dto + +// 评论对象 +type TimelineReplyDTO struct { + ReplyId string // 评论ID + TimelineId string // 动态ID + ReplierId string // 评论人ID + ReplierName string // 评论人昵称 + ReplierAvatar string // 评论人头像 + ReplierAvatarDecoration string // 用户头像框 + ReplierDecorationFormat string + ReplyContent string // 评论内容 + ToReplyId string // 被评论的帖子ID + ToReplierId string // 被评论的用户Id + ToReplierName string // 被评论的用户昵称 + SubReplyCount string // 子评论数 + ToSubReplyId string // 实际评论得子评论ID + IsPraised string // 是否赞过 + PraisedCount string // 赞的次数 + CreateTime string + SubReplyList []TimelineReplyDTO `json:"SubReplyList,omitempty"` // 子评论列表 + + CreateTimeStr string +} + +// 动态打赏对象 +type TimelinePresentDTO struct { + Id string // 打赏ID + TimelineId string // 动态ID + FromUserId string // 打赏人ID + FromUserName string // 打赏人姓名 + FromUserAvatar string // 打赏人头像 + FromUserAvatarDecoration string // 用户头像框 + FromUserDecorationFormat string + GiftId string // 礼物ID + GiftCount string + GiftName string // 礼物名称 + GiftImage string // 礼物图标 + AnimationFormat string // 动效格式 + AnimationApngUrl string // 礼物动效地址 + FillMode string // 填充格式 + AnimationGifUrl string // gif + Diamond string // 钻石数 + CreateTime string + CreateTimeStr string +} diff --git a/pkg/dto/TopUsersDTO.go b/pkg/dto/TopUsersDTO.go new file mode 100644 index 0000000..bb4bf62 --- /dev/null +++ b/pkg/dto/TopUsersDTO.go @@ -0,0 +1,9 @@ +package dto + +// 首页榜单对象 +// TopType consume=贡献榜 charm=魅力榜 +type TopUsersDTO struct { + TopType string + TopUserList []ChatroomListUserDTO + IconUrl string +} diff --git a/pkg/dto/UserAliasNameDTO.go b/pkg/dto/UserAliasNameDTO.go new file mode 100644 index 0000000..8eb1003 --- /dev/null +++ b/pkg/dto/UserAliasNameDTO.go @@ -0,0 +1,6 @@ +package dto + +type UserAliasNameDTO struct { + UserId string + AliasName string +} diff --git a/pkg/dto/UserGiftBoxDTO.go b/pkg/dto/UserGiftBoxDTO.go new file mode 100644 index 0000000..039d687 --- /dev/null +++ b/pkg/dto/UserGiftBoxDTO.go @@ -0,0 +1,30 @@ +package dto + +// 礼物盒 +type UserGiftBoxDTO struct { + BoxId string + GiftId string + GiftName string + GiftImage string + GiftDiamond string + GiftAmountType string // 价格类型:DIAMOND=钻石 GOLD=N币 + AnimationGifUrl string + AnimationApngUrl string + LimitTabId string + IsOrderGift string + StockQty string + TagIconExp string + TagIconFullServer string + ClickInterval int32 // 连击间隔的描述,0为不限制 +} + +type GiftSimpleDTO struct { + GiftId string `json:"GiftId,omitempty"` // 好评率 + GiftName string `json:"GiftName,omitempty"` // + GiftCount string `json:"GiftCount,omitempty"` // + GiftStaticUrl string `json:"GiftStaticUrl,omitempty"` // + AnimationApngUrl string `json:"AnimationApngUrl,omitempty"` // + AnimationPcUrl string `json:"AnimationPcUrl,omitempty"` // + AnimationFormat string `json:"AnimationFormat,omitempty"` // + FillMode string `json:"FillMode,omitempty"` // +} diff --git a/pkg/dto/UserInfoDTO.go b/pkg/dto/UserInfoDTO.go new file mode 100644 index 0000000..3f67997 --- /dev/null +++ b/pkg/dto/UserInfoDTO.go @@ -0,0 +1,145 @@ +package dto + +import ( + "gitea.ddegame.cn/open/servicebase/pkg/datasource/fields" + + "github.com/shopspring/decimal" +) + +type UserInfoDTO struct { + UserId string + RegionCode string + Mobile string `json:"Mobile"` + NickName string + Status string + Avatar string + Gender string + Birthday string + IdNo string `json:"IdNo,omitempty"` + IsAuth string + TrueName string `json:"TrueName,omitempty"` + Sign string `json:"Sign,omitempty"` + ViewFlag string + VideoUrl string `json:"VideoUrl,omitempty"` + IsSetPassword string `json:"IsSetPassword,omitempty"` // 是否设置了密码 + School string `json:"School,omitempty"` + UserNo string + VipLevel string //vip等级 + VipExp string `json:"VipExp,omitempty"` //vip经验 + CanCreateChatroom string `json:"CanCreateChatroom,omitempty"` // 能否创建聊天室 + Hobbies []HobbiesDTO `json:"Hobbies,omitempty"` // 兴趣爱好 + TagsDTO []HobbiesDTO `json:"Tags,omitempty"` // 个人标签 + PropDTO []PropDTO `json:"Props,omitempty"` // 个人属性 + ActiveTimeHint string `json:"ActiveTimeHint,omitempty"` // 活跃时间 + FansCount string // 粉丝数 + FollowCount string // 关注数 + FriendCount string // 朋友数(相互关注) + ShareData ShareDTO `json:"ShareData,omitempty"` // 分享对象 + WxUnionId string `json:"WxUnionId,omitempty"` + QqOpenId string `json:"QqOpenId,omitempty"` + AuthFailReason string `json:"AuthFailReason,omitempty"` + AvatarDecoration string `json:"AvatarDecoration,omitempty"` // 用户头像框 + DecorationFormat string `json:"DecorationFormat,omitempty"` + AlipayAccount string `json:"AlipayAccount,omitempty"` // 支付宝帐号 + IsSeller string //0=未申请过技能 1=是大神 2=已申请待审核 3=已冻结大神资格 + OrderStatus string `json:"OrderStatus,omitempty"` // 订单状态 idle=空闲 accepting=接单中 + VipIcon string //VIP等级ICON + TimeLineCount string // 动态数 + WellNoIcon string `json:"WellNoIcon,omitempty"` // 靓号icon + VipConfig UserVipConfigDTO `json:"VipConfig,omitempty"` //VipConfig + IsOpenedChildMode string // 是否开启了青少年模式 1=开启 0=未开启 + Diamond int64 // 钻石余额 + LocationCity string `json:"LocationCity"` // 用户所在的城市(市) + VisitCountModel *VisitCountDTO `json:"VisitCountDTO,omitempty"` // 访问人数对象 + UserRankInfoList []UserRankItem `json:"UserRankInfoList",omitempty` + // 用户的技能列表 + UserSkillList []UserSkillDTO `json:"UserSkillList,omitempty"` // 用户的技能列表 + PhotoList []UserPhoto `json:"PhotoList,omitempty"` // 照片墙 + CommonHobbies []CommonHobby + UserRoles []string `json:"UserRoles,omitempty"` // 用户角色 + IsSuperAdmin string `json:"IsSuperAdmin,omitempty"` // 是否超管 + DiancangCard string `json:"DiancangCard,omitempty"` //典藏卡 + SellerAuth string `json:"SellerAuth,omitempty"` //陪玩身份认证 + SellerAuthStatus string `json:"SellerAuthStatus,omitempty"` //陪玩身份认证状态 + SellerFaceAuth string `json:"SellerFaceAuth,omitempty"` //陪玩人脸认证 + SellerVedioAuth string `json:"SellerVedioAuth,omitempty"` //陪玩视频认证 + SellerAuthFailedReason string `json:"SellerAuthFailedReason,omitempty"` //陪玩认证失败原因 + + IsChairman string `json:"IsChairman,omitempty"` //陪玩认证失败原因 +} + +type UserPhoto struct { + Id string + UserId string + PhotoKey string + PhotoIndex string +} + +type UserSimpleDTO struct { + UserId string `json:"UserId,omitempty"` + UserNo string `json:"UserNo,omitempty"` + Gender string `json:"Gender,omitempty"` + NickName string `json:"NickName,omitempty"` + Avatar string `json:"Avatar,omitempty"` + Birthday string `json:"Birthday,omitempty"` +} + +type SellerSimpleDTO struct { + UserSimpleDTO + GoodRate string `json:"GoodRate,omitempty"` // 好评率 + TotalOrderCount string `json:"TotalOrderCount,omitempty"` // 接单次数 + OrderUnitName string `json:"UnitName,omitempty"` // 单位 + BriefDesc string `json:"BriefDesc,omitempty"` // 备注 +} + +type CommonHobby struct { + Name string +} + +type UserRankItem struct { + Icon string // + RankText string // 排名 + RankDesc string // 描述 + BackgroundImage string // 背景图 + BackgroundColor string +} + +// 典藏卡 +type DiancangCardDTO struct { + CardCode string + CardName string + MinRechargeDiamond int + MoreRate float64 + CardIcon string +} + +type UserTicketDTO struct { + ID string `gorm:"column:id;type:char(32);not null;uniqueIndex:id,priority:1;comment:业务ID" json:"id"` // 业务ID + No string `gorm:"column:no;type:varchar(64);not null;uniqueIndex:no,priority:1;comment:业务编号" json:"no"` // 业务编号 + UserID string `gorm:"column:user_id;type:char(32);not null;comment:用户ID" json:"user_id"` // 用户ID + TicketType string `gorm:"column:ticket_type;type:varchar(64);not null;comment:工单类型" json:"ticket_type"` // 工单类型 + ComplaintType string `gorm:"column:complaint_type;type:varchar(64);not null;comment:投诉类型" json:"complaint_type"` // 投诉类型 + Title string `gorm:"column:title;type:varchar(64);not null;comment:工单标题" json:"title"` // 工单标题 + Reason string `gorm:"column:reason;type:varchar(255);not null;comment:售后原因" json:"reason"` // 售后原因 + Content string `gorm:"column:content;type:varchar(2048);not null;comment:工单内容" json:"content"` // 工单内容 + InvolvedUserIds string `gorm:"column:involved_user_ids;type:varchar(255);not null;comment:相关涉事人" json:"involved_user_ids"` // 相关涉事人 + TicketImages string `gorm:"column:ticket_images;type:varchar(255);not null;comment:相关图片" json:"ticket_images"` // 相关图片 + Status string `gorm:"column:status;type:varchar(32);not null;comment:状态 processing=进行中 complete=完成" json:"status"` // 状态 processing=进行中 complete=完成 + ResultContent string `gorm:"column:result_content;type:varchar(255);not null;comment:处理结果" json:"result_content"` // 处理结果 + ReturnAmount decimal.Decimal `gorm:"column:return_amount;type:decimal(10,2);not null;default:0.00;comment:退回金额" json:"return_amount"` // 退回金额 + ReturnType string `gorm:"column:return_type;type:varchar(64);not null;comment:退回方式" json:"return_type"` // 退回方式 + DealEndAt fields.Time `gorm:"column:deal_end_at;type:datetime;not null;comment:初始完成时间" json:"deal_end_at"` // 初始完成时间 + CreateAt fields.Time `gorm:"column:create_at;type:datetime;not null;comment:创建时间" json:"create_at"` // 创建时间 + UpdateAt fields.Time `gorm:"column:update_at;type:datetime;not null;comment:更新时间" json:"update_at"` // 更新时间 +} + +type UserTicketFlowDTO struct { + ID string `gorm:"column:id;type:char(32);not null;uniqueIndex:id,priority:1;comment:业务ID" json:"id"` // 业务ID + TicketID string `gorm:"column:ticket_id;type:char(32);not null;index:tid,priority:1;comment:业务ID" json:"ticket_id"` // 业务ID + UserID string `gorm:"column:user_id;type:char(32);not null;comment:用户ID" json:"user_id"` // 用户ID + FlowType string `gorm:"column:flow_type;type:varchar(64);not null;comment:commit=用户提交 reply=回复" json:"flow_type"` // commit=用户提交 reply=回复 + Content string `gorm:"column:content;type:varchar(2048);not null;comment:工单内容" json:"content"` // 工单内容 + TicketImages string `gorm:"column:ticket_images;type:varchar(255);not null;comment:相关图片" json:"ticket_images"` // 相关图片 + CreateAt fields.Time `gorm:"column:create_at;type:datetime;not null;comment:创建时间" json:"create_at"` // 创建时间 + UpdateAt fields.Time `gorm:"column:update_at;type:datetime;not null;comment:更新时间" json:"update_at"` // 更新时间 +} diff --git a/pkg/dto/UserStoreGoodsDTO.go b/pkg/dto/UserStoreGoodsDTO.go new file mode 100644 index 0000000..41e4641 --- /dev/null +++ b/pkg/dto/UserStoreGoodsDTO.go @@ -0,0 +1,33 @@ +package dto + +// 用户的物品 +type UserStoreGoodsDTO struct { + StoreId int + GoodsId string + GoodsName string + GoodsType string + GoodsGroup string + GoodsCount string + GoodsIconUrl string + GoodsResourceUrl string + ExpireTime string + StockQty string + HourBalance string + Measurement string + CanSend bool + CanUse bool + Memo string +} + +// 商品对象 +type GoodsDTO struct { + Id string + GoodsName string + GoodsType string + GoodsIconUrl string + GoodsResourceUrl string + MinUseLevel string + SalePrice string + Memo string + TimeSpan string +} diff --git a/pkg/dto/UserTakedDispathOrderDTO.go b/pkg/dto/UserTakedDispathOrderDTO.go new file mode 100644 index 0000000..7d4b12c --- /dev/null +++ b/pkg/dto/UserTakedDispathOrderDTO.go @@ -0,0 +1,28 @@ +package dto + +// 用户抢到的单 +type UserTakedDispathOrderDTO struct { + ID string + OrderID string + ChatroomID string + BuyerID string + HostUserID string + Status string + CreateAt string + SkillId string + SkillIcon string + SkillName string + SkillMode string + SkillLevel string + SkillService string + OrderPrice string + OrderCount string + OrderAmount string + Gender string + BuyerMemo string + UnitName string + StatusName string + CustomerRequirement string + + GuildBase +} diff --git a/pkg/dto/UserVipIconDTO.go b/pkg/dto/UserVipIconDTO.go new file mode 100644 index 0000000..589d6c1 --- /dev/null +++ b/pkg/dto/UserVipIconDTO.go @@ -0,0 +1,26 @@ +package dto + +// 用户Vip配置 +type UserVipConfigDTO struct { + UserId string + NameColor string `json:"NameColor,omitempty"` // 昵称颜色 + NoColor string `json:"NoColor,omitempty"` //ID颜色 + TextColor string `json:"TextColor,omitempty"` // 聊天文本颜色 + VipIconList []VipIconDTO `json:"VipIconList,omitempty"` //Vip IconList + VipLevel string `json:"VipLevel,omitempty"` //VIP等级 + VipExp string `json:"VipExp,omitempty"` //Vip经验值 + RoomMsgBgForIOS string `json:"RoomMsgBgForIOS,omitempty"` // 房间里的消息背景 + RoomMsgBgForAndroid string `json:"RoomMsgBgForAndroid,omitempty"` // 房间里的消息背景 + NobilityLevel string `json:"NobilityLevel,omitempty"` // 贵族等级 + NobilitySeatNameColor []string `json:"NobilitySeatNameColor,omitempty"` // 贵族麦上昵称颜色 + RoomMsgBgForPc string `json:"RoomMsgBgForPc"` // 房间里的消息背景 PC +} + +// VipIcon对象 +type VipIconDTO struct { + IconUrl string + Text string + Width int + Height int + IconType string //vip=vip图标 nobility=爵位 medal=铭牌 +} diff --git a/pkg/dto/VisitUserDTO.go b/pkg/dto/VisitUserDTO.go new file mode 100644 index 0000000..7c8d0c5 --- /dev/null +++ b/pkg/dto/VisitUserDTO.go @@ -0,0 +1,13 @@ +package dto + +type VisitUserDTO struct { + UserId string + NickName string + Avatar string + Gender string + BirthDay string + Brief string + VipConfig UserVipConfigDTO + IsNew string `json:"IsNew,omitempty"` + VisitCount string `json:"VisitCount,omitempty"` +} diff --git a/pkg/dto/activity/BossBasicDTO.go b/pkg/dto/activity/BossBasicDTO.go new file mode 100644 index 0000000..9680719 --- /dev/null +++ b/pkg/dto/activity/BossBasicDTO.go @@ -0,0 +1,16 @@ +package activity_dto + +type BossBasicDTO struct { + Balance int64 + BossId int64 + MonsterId string + MonsterName string + MonsterAvatar string + MonsterNormalApng string + MonsterAttackApng string + BossHp string + BossHpPass string + AppearAt string + DisappearAt string + State string +} diff --git a/pkg/dto/activity/BossHpAndAttackRankDTO.go b/pkg/dto/activity/BossHpAndAttackRankDTO.go new file mode 100644 index 0000000..7a3f1ab --- /dev/null +++ b/pkg/dto/activity/BossHpAndAttackRankDTO.go @@ -0,0 +1,23 @@ +package activity_dto + +type BossHpAndAttackRankDTO struct { + Hp string + HpPass string + State string + AppearAt string + DisappearAt string + Balance int64 + AttackBossRankList []AttackBossRankDTO // 输出排行榜 + NewWinPrizeMsgList []string // 最新中奖信息 + // NewDeathPrize model_activity.ActivityDeathBossPrizeModel +} + +// 用户输出排行榜对象 +type AttackBossRankDTO struct { + Rank string + UserId string + UserNo string + NickName string + Avatar string + AttackScore string +} diff --git a/pkg/dto/activity/ChatRoomLuckPrizeDTO.go b/pkg/dto/activity/ChatRoomLuckPrizeDTO.go new file mode 100644 index 0000000..a8249e0 --- /dev/null +++ b/pkg/dto/activity/ChatRoomLuckPrizeDTO.go @@ -0,0 +1,19 @@ +package activity_dto + +type ChatRoomLuckPrize struct { + Name string + Icon string + Price int64 + PriceType string + MaxValue int64 + PrizeList []ChatRoomLuckPrizeItem +} + +type ChatRoomLuckPrizeItem struct { + Name string + Icon string + Value int64 + PriceType string + Probability string + Type string +} diff --git a/pkg/dto/activity/GeneralRankGiftDTO.go b/pkg/dto/activity/GeneralRankGiftDTO.go new file mode 100644 index 0000000..5774985 --- /dev/null +++ b/pkg/dto/activity/GeneralRankGiftDTO.go @@ -0,0 +1,18 @@ +package activity_dto + +type GeneralRankRewardDTO struct { + Item []*GeneralRankRewardItem // 下对应top-1 + RankCode string // 排行榜code 唯一 +} + +type GeneralRankRewardItem struct { + Top int // rank top 1 2 3 + GiftIdLst []*GiftReward // 礼物 +} + +type GiftReward struct { + GiftId string // 礼物ID + Count int // 数量 + Name string + Img string +} diff --git a/pkg/dto/activity/WeekStarDTO.go b/pkg/dto/activity/WeekStarDTO.go new file mode 100644 index 0000000..d28583f --- /dev/null +++ b/pkg/dto/activity/WeekStarDTO.go @@ -0,0 +1,29 @@ +package activity_dto + +type StarGiftDTO struct { + Name string `json:"name"` + Price string `json:"price"` + Img string `json:"img"` +} +type RankDTO struct { + SortNo int `json:"sortNo"` + YearWeek int `json:"yearWeek"` + WeekStart string `json:"weekStart"` + WeekEnd string `json:"weekEnd"` + UserId string `json:"userId"` + UserNo string `json:"userNo"` + GiftCount int `json:"giftCount"` + GiftAmount int `json:"giftAmount"` + NickName string `json:"nickName"` + Avatar string `json:"avatar"` + NamingGiftId int32 `json:"namingGiftId"` + NamingGiftDescription string `json:"namingGiftDescription"` + JumpUrl string `json:"jumpUrl"` +} + +type RankResponse struct { + YearWeek int `json:"yearWeek"` + WeekStart string `json:"weekStart"` + WeekEnd string `json:"weekEnd"` + RankDTOList []*RankDTO `json:"rankDTOList"` +} diff --git a/pkg/dto/activity/WeekStarGiftGrantDTO.go b/pkg/dto/activity/WeekStarGiftGrantDTO.go new file mode 100644 index 0000000..07006ed --- /dev/null +++ b/pkg/dto/activity/WeekStarGiftGrantDTO.go @@ -0,0 +1,11 @@ +package activity_dto + +type WeekStarGrantGiftDTO struct { + GrantType string + GrantList map[int][]WeekStarGrantGiftRankGiftDto +} + +type WeekStarGrantGiftRankGiftDto struct { + GiftID string + Count int +} diff --git a/pkg/dto/admin/diamond.go b/pkg/dto/admin/diamond.go new file mode 100644 index 0000000..17b30e6 --- /dev/null +++ b/pkg/dto/admin/diamond.go @@ -0,0 +1,8 @@ +package dto_admin + +type OperationReduceDiamondRequest struct { + Diamond string + UserNo string + Memo string + Pwd string +} diff --git a/pkg/dto/admin/skill.go b/pkg/dto/admin/skill.go new file mode 100644 index 0000000..d50d54b --- /dev/null +++ b/pkg/dto/admin/skill.go @@ -0,0 +1,378 @@ +package dto_admin + +import ( + "errors" + + "github.com/shopspring/decimal" +) + +type TSkillConfig struct { + // model_master.TSkillConfig + Children []*TSkillConfig `json:"children" gorm:"-"` +} + +// UpdateOrderRequest 修改订单请求参数 /* +type UpdateOrderRequest struct { + OrderId string `json:"orderId"` + UpdateType string `json:"updateType"` + ChangeOrderCount float32 `json:"changeOrderCount"` + Reason string `json:"reason"` +} + +// ReplenishOrderRequest 补单请求参数 /* +type ReplenishOrderRequest struct { + GuildId string `json:"guildId"` + BuyerUserId string `json:"buyerUserId"` + SellerUserId string `json:"sellerUserId"` + SellerSkillId string `json:"sellerSkillId"` + SkillConfigId string `json:"skillConfigId"` + OrderCount float64 `json:"orderCount"` +} +type FreeOfChargeOrder struct { + OrderId string `json:"orderId"` + Reason string `json:"reason"` + ChangeCount decimal.Decimal `json:"changeCount"` +} + +type OrderRateResponse struct { + // model_master.TSkillOrderRate + OrderNo string `json:"order_no"` + UserNO string `json:"user_no"` + NickName string `json:"nick_name"` + SellerNickName string `json:"seller_nick_name"` + SellerUserNo string `json:"seller_user_no"` +} + +type EarlyFinishOrderRequest struct { + OrderId string `json:"orderId"` + CompleteCount decimal.Decimal `json:"completeCount"` +} + +type FinishOrderRequest struct { + OrderId string `json:"orderId"` +} +type DispatchOrderResponse struct { + // model_master.TDispatchOrder + ChatroomNo string `json:"chatroom_no"` + ChatroomName string `json:"chatroom_name"` + BuyerNo string `json:"buyer_no"` + BuyerNickName string `json:"buyer_nick_name"` + HostUserNo string `json:"host_user_no"` + HostUserNickName string `json:"host_user_nick_name"` + SkillName string `json:"skill_name"` +} +type SellerSkillUpdateResponse struct { + Id string + SkillStatus string + ServiceStatus string + AllowEditPrice string + SellerStar string +} + +func (request *SellerSkillUpdateResponse) Check() (err error) { + + if len(request.Id) == 0 { + err = errors.New("技能ID不能为空") + return + } + + if request.SkillStatus != "1" && request.SkillStatus != "3" { + err = errors.New("技能状态不正确") + return + } + if request.ServiceStatus != "1" && request.ServiceStatus != "0" { + err = errors.New("技能服务状态不正确") + return + } + if len(request.AllowEditPrice) == 0 { + err = errors.New("价格修改状态不能为空") + return + } + if len(request.SellerStar) == 0 { + err = errors.New("明星状态不能为空") + return + } + return +} + +type UpdateSkillLevelResponse struct { + Id string + ConfigId string + UserId string +} + +func (request *UpdateSkillLevelResponse) Check() (err error) { + if len(request.Id) == 0 { + err = errors.New("陪玩技能ID不能为空") + return + } + if len(request.ConfigId) == 0 { + err = errors.New("技能等级不能为空") + return + } + if len(request.UserId) == 0 { + err = errors.New("用户id不能为空") + return + } + return +} + +type UpdateSkillLevelInnerResponse struct { + ID string + ConfigId string + OperatorID string +} + +func (request *UpdateSkillLevelInnerResponse) Check() (err error) { + if len(request.ID) == 0 { + err = errors.New("陪玩技能ID不能为空") + return + } + if len(request.ConfigId) == 0 { + err = errors.New("技能等级不能为空") + return + } + return +} + +type SellerFaceVerifyResponse struct { + // model_master.TSellerFaceVerify + UserNo string `json:"user_no"` + NickName string `json:"nick_name"` + Avatar string `json:"avatar"` + SkillName string `json:"skill_name"` +} +type FreeOfChargeOrderForInner struct { + OrderId string + Reason string + ChangeCount decimal.Decimal + OperatorID string +} +type SellerSkillUpdateInnerResponse struct { + ID string + SkillStatus string + ServiceStatus string + AllowEditPrice string + SellerStar string + OperatorID string +} + +func (request *SellerSkillUpdateInnerResponse) Check() (err error) { + + if len(request.ID) == 0 { + err = errors.New("技能ID不能为空") + return + } + + if request.SkillStatus != "1" && request.SkillStatus != "3" { + err = errors.New("技能状态不正确") + return + } + if request.ServiceStatus != "1" && request.ServiceStatus != "0" { + err = errors.New("技能服务状态不正确") + return + } + if len(request.AllowEditPrice) == 0 { + err = errors.New("价格修改状态不能为空") + return + } + if len(request.SellerStar) == 0 { + err = errors.New("明星状态不能为空") + return + } + if len(request.OperatorID) == 0 { + err = errors.New("操作人不能为空") + return + } + return +} + +type AddSellerSkillInnerResponse struct { + GuildMemberID int32 + SkillConfigID string +} + +func (request *AddSellerSkillInnerResponse) Check() (err error) { + if request.GuildMemberID == 0 { + err = errors.New("用户ID不能为空") + return + } + if len(request.SkillConfigID) == 0 { + err = errors.New("技能配置ID不能为空") + return + } + return +} + +type AddSkillInnerResponse struct { + SkillID string +} + +func (request *AddSkillInnerResponse) Check() (err error) { + if len(request.SkillID) == 0 { + err = errors.New("技能ID不能为空") + return + } + return +} + +type SkillConfigUpdateResponse struct { + ID string // 主键 + SkillID string // 技能ID + DataType string // 类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 + ChildType string // 子分类:类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 为空时表示为叶子节点 + ParentID string // 父节点 mode:skillId level:modeId gender:levelId price:genderId + Value string // 名称 mode:玩法名称 level:等级名称 gender:性别名称 price:价格内容 + Comment string // 描述 + RankPriority int32 // 节点排名权重,高权重可以兼容低权重 + SortNo int32 // 排序从小到大 + PriceMale int32 // 男陪价格 + PriceFemale int32 // 女陪价格 + UnitName string // 指定价格时的结算单位 如:小时、局等 + UnitValue string // 指定价格时的阶段单位对应的值如小时对应60分钟 + LevelRemark string // 等级的备注,下单时选择了等级可以显示备注 + DifficultyValues string // 游戏难度:机密 绝密 长夜等 mode专用 + DifficultyDefaultValue string // 游戏难度默认值 +} + +func (request *SkillConfigUpdateResponse) Check() (err error) { + if len(request.ID) == 0 { + err = errors.New("技能配置ID不能为空") + return + } + if len(request.SkillID) == 0 { + err = errors.New("技能ID不能为空") + return + } + if len(request.DataType) == 0 { + err = errors.New("数据类型不能为空") + return + } + if request.DataType == "mode" { + request.ChildType = "level" + request.RankPriority = 0 + request.PriceMale = 0 + request.PriceFemale = 0 + request.UnitName = "" + request.UnitValue = "" + request.LevelRemark = "" + request.DifficultyDefaultValue = "" + request.DifficultyValues = "" + } else if request.DataType == "level" { + request.ChildType = "service" + request.PriceMale = 0 + request.PriceFemale = 0 + request.UnitName = "" + request.UnitValue = "" + request.LevelRemark = "" + request.DifficultyDefaultValue = "" + request.DifficultyValues = "" + } else if request.DataType == "service" { + request.ChildType = "" + request.RankPriority = 0 + request.LevelRemark = "" + } else { + err = errors.New("数据类型不正确") + return + } + if len(request.ParentID) == 0 { + err = errors.New("父节点id不能为空") + return + } + if len(request.Value) == 0 { + err = errors.New("配置名称不能为空") + return + } + return +} + +type SkillConfigAddRequest struct { + SkillID string // 技能ID + CategoryID int + DataType string // 类型 mode=游戏玩法 level=等级 service=服务类型(如三角洲体验单、物资单等) gender=性别 price=价格 + ChildType string // 子节点类型 + ParentID string // 父节点 mode:skillId level:modeId gender:levelId price:genderId + Value string // 名称 mode:玩法名称 level:等级名称 gender:性别名称 price:价格内容 + Comment string // 描述 + RankPriority int32 // 节点排名权重,高权重可以兼容低权重 + SortNo int32 // 排序从小到大 + PriceMale int32 // 男陪价格 + PriceFemale int32 // 女陪价格 + UnitName string // 指定价格时的结算单位 如:小时、局等 + UnitValue string // 指定价格时的阶段单位对应的值如小时对应60分钟 + LevelRemark string // 等级的备注,下单时选择了等级可以显示备注 + DifficultyValues string // 游戏难度:机密 绝密 长夜等 mode专用 + DifficultyDefaultValue string // 游戏难度默认值 +} + +func (request *SkillConfigAddRequest) Check() (err error) { + if len(request.SkillID) == 0 { + err = errors.New("技能ID不能为空") + return + } + if request.CategoryID == 0 { + err = errors.New("技能类型不能为空") + return + } + if len(request.DataType) == 0 { + err = errors.New("数据类型不能为空") + return + } + if request.DataType == "mode" { + request.ChildType = "level" + request.RankPriority = 0 + request.PriceMale = 0 + request.PriceFemale = 0 + request.UnitName = "" + request.UnitValue = "" + request.LevelRemark = "" + request.DifficultyDefaultValue = "" + request.DifficultyValues = "" + } else if request.DataType == "level" { + request.ChildType = "service" + request.PriceMale = 0 + request.PriceFemale = 0 + request.UnitName = "" + request.UnitValue = "" + request.LevelRemark = "" + request.DifficultyDefaultValue = "" + request.DifficultyValues = "" + } else if request.DataType == "service" { + request.ChildType = "" + request.RankPriority = 0 + request.LevelRemark = "" + } else { + err = errors.New("数据类型不正确") + return + } + if len(request.ParentID) == 0 { + err = errors.New("父节点id不能为空") + return + } + if len(request.Value) == 0 { + err = errors.New("配置名称不能为空") + return + } + return +} + +type TSkillResponse struct { + // model_master.TSkill + CategoryName string +} +type CheckSellerSkillInnerRequest struct { + SkillApplyID string + OperatorID string +} + +func (request *CheckSellerSkillInnerRequest) Check() (err error) { + if len(request.SkillApplyID) == 0 { + err = errors.New("申请id不能为空") + return + } + if len(request.OperatorID) == 0 { + err = errors.New("操作人不能为空") + return + } + return +} diff --git a/pkg/dto/admin/user.go b/pkg/dto/admin/user.go new file mode 100644 index 0000000..991bea9 --- /dev/null +++ b/pkg/dto/admin/user.go @@ -0,0 +1,44 @@ +package dto_admin + +import "errors" + +type AdjustmentNobilityRequest struct { + UserId string + ExpValue int32 + OutId string + BizType string +} + +func (param AdjustmentNobilityRequest) Check() (err error) { + + if len(param.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + if param.ExpValue == 0 { + err = errors.New("ExpValue不能为空") + return + } + if len(param.OutId) == 0 { + err = errors.New("OutId不能为空") + return + } + if len(param.BizType) == 0 { + err = errors.New("BizType不能为空") + return + } + return +} + +type AddInnerUserRequest struct { + UserId string +} + +func (param AddInnerUserRequest) Check() (err error) { + if len(param.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + return err +} diff --git a/pkg/dto/applepay/IapReceiptData.go b/pkg/dto/applepay/IapReceiptData.go new file mode 100644 index 0000000..d4657cf --- /dev/null +++ b/pkg/dto/applepay/IapReceiptData.go @@ -0,0 +1,51 @@ +package applepay + +// IAP 请求 +type IapRequest struct { + ReceiptData string `json:"receipt-data"` //base64票据 + Password string `json:"password,omitempty"` +} + +// iap 支付返回结果 +type IapResponse struct { + Status int `json:"status"` // 支付状态 0=支付成功 + Environment string `json:"environment"` // 环境 + Receipt ReceiptDTO `json:"receipt"` +} + +// 票据 +type ReceiptDTO struct { + ReceiptType string `json:"receipt_type"` + AdamId int `json:"adam_id"` + AppItemId int `json:"app_item_id"` + BundleId string `json:"bundle_id"` + ApplicationVersion string `json:"application_version"` + DownloadId int `json:"download_id"` + VersionExternalIdentifier int `json:"version_external_identifier"` + ReceiptCreationDate string `json:"receipt_creation_date"` + ReceiptCreationDateMs string `json:"receipt_creation_date_ms"` + ReceiptCreationDatePst string `json:"receipt_creation_date_pst"` + RequestDate string `json:"request_date"` + RequestDateMs string `json:"request_date_ms"` + RequestDatePst string `json:"request_date_pst"` + OriginalPurchaseDate string `json:"original_purchase_date"` + OriginalPurchaseDateMs string `json:"original_purchase_date_ms"` + OriginalPurchaseDatePst string `json:"original_purchase_date_pst"` + OriginalApplicationVersion string `json:"original_application_version"` + InApp []IapTransaction `json:"in_app"` +} + +// 苹果的支付交易对象 +type IapTransaction struct { + Quantity string `json:"quantity"` + ProductId string `json:"product_id"` + TransactionId string `json:"transaction_id"` + OriginalTransactionId string `json:"original_transaction_id"` + PurchaseDate string `json:"purchase_date"` + PurchaseDateMs string `json:"purchase_date_ms"` + PurchaseDatePst string `json:"purchase_date_pst"` + OriginalPurchaseDate string `json:"original_purchase_date"` + OriginalPurchaseDateMs string `json:"original_purchase_date_ms"` + OriginalPurchaseDatePst string `json:"original_purchase_date_pst"` + IsTrialPeriod string `json:"is_trial_period"` +} diff --git a/pkg/dto/dataDTO.go b/pkg/dto/dataDTO.go new file mode 100644 index 0000000..f47ea4a --- /dev/null +++ b/pkg/dto/dataDTO.go @@ -0,0 +1,14 @@ +package dto + +type MatchUserDTO struct { + UserId string + NickName string + Avatar string + Gender string + BirthDay string + SkillName string + SkillMode string + SkillLevel string + BriefDesc string + VipConfig UserVipConfigDTO `gorm:"-"` +} diff --git a/pkg/dto/inner/AppealOrderRequest.go b/pkg/dto/inner/AppealOrderRequest.go new file mode 100644 index 0000000..55d3c8e --- /dev/null +++ b/pkg/dto/inner/AppealOrderRequest.go @@ -0,0 +1,17 @@ +package inner + +import "errors" + +type AppealOrderRequest struct { + OrderId string +} + +// 参数合法性检验 +func (request *AppealOrderRequest) CheckParameter() (err error) { + + if len(request.OrderId) == 0 { + err = errors.New("Mobile不能为空") + return + } + return +} diff --git a/pkg/dto/inner/AttackBossRequest.go b/pkg/dto/inner/AttackBossRequest.go new file mode 100644 index 0000000..54f0396 --- /dev/null +++ b/pkg/dto/inner/AttackBossRequest.go @@ -0,0 +1,39 @@ +package inner + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +type AttackBossRequest struct { + AccessToken string + RoomId string + BossId string + AttackCount string +} + +// 参数合法性检验 +func (request *AttackBossRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("UserId不能为空") + return + } + if len(request.BossId) == 0 { + err = errors.New("BossId不能为空") + return + } + + if len(request.AttackCount) == 0 { + err = errors.New("AttackCount不能为空") + return + } + + if HyTools.StringToInt(request.AttackCount) < 1 || HyTools.StringToInt(request.AttackCount) > 100000 { + err = errors.New("AttackCount不合法") + return + } + + return +} diff --git a/pkg/dto/inner/BuyLuckBoxKeysRequest.go b/pkg/dto/inner/BuyLuckBoxKeysRequest.go new file mode 100644 index 0000000..e29f5db --- /dev/null +++ b/pkg/dto/inner/BuyLuckBoxKeysRequest.go @@ -0,0 +1,34 @@ +package inner + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +type BuyLuckBoxKeysRequest struct { + AccessToken string + BuyCount string +} + +// 参数合法性检验 +func (request *BuyLuckBoxKeysRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.BuyCount) == 0 { + err = errors.New("BuyCount不能为空") + return + } + + intCount := HyTools.StringToInt64(request.BuyCount) + + if intCount < 1 || intCount > 10000 { + err = errors.New("购买数量不合法,最大10000个") + return + } + + return +} diff --git a/pkg/dto/inner/GetActivityBossRequest.go b/pkg/dto/inner/GetActivityBossRequest.go new file mode 100644 index 0000000..6fe5d6f --- /dev/null +++ b/pkg/dto/inner/GetActivityBossRequest.go @@ -0,0 +1,26 @@ +package inner + +import ( + "errors" +) + +type GetActivityBossRequest struct { + AccessToken string + ActivityId string + RoomId string +} + +// 参数合法性检验 +func (request *GetActivityBossRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.ActivityId) == 0 { + err = errors.New("ActivityId不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/GetOpenBoxRankRequest.go b/pkg/dto/inner/GetOpenBoxRankRequest.go new file mode 100644 index 0000000..f66687f --- /dev/null +++ b/pkg/dto/inner/GetOpenBoxRankRequest.go @@ -0,0 +1,25 @@ +package inner + +import ( + "errors" +) + +type GetOpenBoxRankRequest struct { + AccessToken string + RankType string //TODAY=今日榜 YESTODAY = 昨天 +} + +// 参数合法性检验 +func (request *GetOpenBoxRankRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.RankType) == 0 { + err = errors.New("RankType不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/GetRoomWeeklyTopListRequest.go b/pkg/dto/inner/GetRoomWeeklyTopListRequest.go new file mode 100644 index 0000000..9e83f8a --- /dev/null +++ b/pkg/dto/inner/GetRoomWeeklyTopListRequest.go @@ -0,0 +1,18 @@ +package inner + +import "errors" + +type GetRoomWeeklyTopListRequest struct { + Week string +} + +// 参数合法性检验 +func (request *GetRoomWeeklyTopListRequest) CheckParameter() (err error) { + + if len(request.Week) == 0 { + err = errors.New("Week不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/GetSkillPrizeRequest.go b/pkg/dto/inner/GetSkillPrizeRequest.go new file mode 100644 index 0000000..a98e1bb --- /dev/null +++ b/pkg/dto/inner/GetSkillPrizeRequest.go @@ -0,0 +1,25 @@ +package inner + +import "errors" + +// 领取击杀奖品 +type GetSkillPrizeRequest struct { + AccessToken string + BossId string +} + +// 参数合法性检验 +func (request *GetSkillPrizeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.BossId) == 0 { + err = errors.New("BossId不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/GetUserActivityAttackRankRequest.go b/pkg/dto/inner/GetUserActivityAttackRankRequest.go new file mode 100644 index 0000000..6f20335 --- /dev/null +++ b/pkg/dto/inner/GetUserActivityAttackRankRequest.go @@ -0,0 +1,81 @@ +package inner + +import "errors" + +// 获取用户的活动打怪排行 +type GetUserActivityAttackRankRequest struct { + AccessToken string + ActivityIdList string +} + +// 参数合法性检验 +func (request *GetUserActivityAttackRankRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + return +} + +// 获取BOSS信息 +type GetBossInfoRequest struct { + AccessToken string + BossId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetBossInfoRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("用户Id不能为空") + return + } + if len(request.BossId) == 0 { + err = errors.New("BossId不能为空") + return + } + return +} + +// 获取领奖中心列表 +type GetDeathPrizeListRequest struct { + AccessToken string + Page int + Size int +} + +// 参数合法性检验 +func (request *GetDeathPrizeListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("用户Id不能为空") + return + } + if request.Page < 0 { + request.Page = 0 + } + if request.Size < 1 { + request.Size = 10 + } + return +} + +// 获取领奖中心列表 +type GetDeathPrizeRequest struct { + AccessToken string + BossId string + RoomId string +} + +// 参数合法性检验 +func (request *GetDeathPrizeRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("用户Id不能为空") + return + } + if len(request.BossId) == 0 { + err = errors.New("BossId不能为空") + return + } + return +} diff --git a/pkg/dto/inner/GetUserInfoRequest.go b/pkg/dto/inner/GetUserInfoRequest.go new file mode 100644 index 0000000..9485537 --- /dev/null +++ b/pkg/dto/inner/GetUserInfoRequest.go @@ -0,0 +1,43 @@ +package inner + +import "errors" + +type GetUserInfoByMobileOrUserNoRequest struct { + Mobile string +} + +// 参数合法性检验 +func (request *GetUserInfoByMobileOrUserNoRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + return +} + +type GetUserInfoRequest struct { + UserId string + IdType string //1=用户ID 2=用户No +} + +// 参数合法性检验 +func (request *GetUserInfoRequest) CheckParameter() (err error) { + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + if len(request.IdType) == 0 { + err = errors.New("IdType不能为空") + return + } + + if request.IdType != "1" && request.IdType != "2" { + err = errors.New("IdType非法") + return + } + + return +} diff --git a/pkg/dto/inner/GetVipConfigRequest.go b/pkg/dto/inner/GetVipConfigRequest.go new file mode 100644 index 0000000..5496c23 --- /dev/null +++ b/pkg/dto/inner/GetVipConfigRequest.go @@ -0,0 +1,18 @@ +package inner + +import "errors" + +type GetVipConfigRequest struct { + VipLevel string +} + +// 参数合法性检验 +func (request *GetVipConfigRequest) CheckParameter() (err error) { + + if len(request.VipLevel) == 0 { + err = errors.New("VipLevel不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/ManualRechargeRequest.go b/pkg/dto/inner/ManualRechargeRequest.go new file mode 100644 index 0000000..67b820b --- /dev/null +++ b/pkg/dto/inner/ManualRechargeRequest.go @@ -0,0 +1,30 @@ +package inner + +import "errors" + +type ManualRechargeRequest struct { + RechargeId string + PayTradeNo string + PayTime string +} + +// 参数合法性检验 +func (request *ManualRechargeRequest) CheckParameter() (err error) { + + if len(request.RechargeId) == 0 { + err = errors.New("RechargeId不能为空") + return + } + + if len(request.PayTradeNo) == 0 { + err = errors.New("PayTradeNo不能为空") + return + } + + if len(request.PayTime) == 0 { + err = errors.New("PayTime不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/MwebRechargeRequest.go b/pkg/dto/inner/MwebRechargeRequest.go new file mode 100644 index 0000000..0872447 --- /dev/null +++ b/pkg/dto/inner/MwebRechargeRequest.go @@ -0,0 +1,68 @@ +package inner + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" + "gitea.ddegame.cn/open/servicebase/pkg/constant" +) + +type MwebRechargeRequest struct { + Mobile string + ProductId string + PayType string // 支付方式 + RechargeChannel string // 充值平台 1 = APP-iOS 2= APP-Android 3= 微信公众号 4= 支付宝服务窗 + ClientRealIp string // 客户端真实IP + OpenId string // 公众号支付时需要 + DeviceOs string // 设备类型 + CashAmount string // 自定义金额 +} + +// 参数合法性检验 +func (request *MwebRechargeRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + + if len(request.ProductId) == 0 { + err = errors.New("ProductId不能为空") + return + } + + if len(request.PayType) == 0 { + err = errors.New("PayType不能为空") + return + } + + if len(request.RechargeChannel) == 0 { + err = errors.New("RechargeChannel不能为空") + return + } + + //if request.RechargeChannel == "3" { + // if len(request.OpenId) == 0{ + // err = errors.New("OpenID不能为空") + // return + // } + //} + + // 自定义充值 + if request.ProductId == constant.CustomerProductId { + + if len(request.CashAmount) == 0 { + err = errors.New("自定义充值金额不能为空") + return + } + + cash := HyTools.StringToInt(request.CashAmount) + + if cash < 1 || cash > 80000 { + err = errors.New("自定义充值金额只能1到80000元") + return + } + } + + return +} diff --git a/pkg/dto/inner/OpenBoxRequest.go b/pkg/dto/inner/OpenBoxRequest.go new file mode 100644 index 0000000..a2936d3 --- /dev/null +++ b/pkg/dto/inner/OpenBoxRequest.go @@ -0,0 +1,29 @@ +package inner + +import "errors" + +type OpenBoxRequest struct { + AccessToken string + OpenCount string +} + +// 参数合法性检验 +func (request *OpenBoxRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.OpenCount) == 0 { + err = errors.New("OpenCount不能为空") + return + } + + if request.OpenCount != "1" && request.OpenCount != "10" && request.OpenCount != "100" { + err = errors.New("OpenCount非法") + return + } + + return +} diff --git a/pkg/dto/inner/OperationAddDiamondRequest.go b/pkg/dto/inner/OperationAddDiamondRequest.go new file mode 100644 index 0000000..445ba38 --- /dev/null +++ b/pkg/dto/inner/OperationAddDiamondRequest.go @@ -0,0 +1,25 @@ +package inner + +import "errors" + +type OperationAddDiamondRequest struct { + UserNo string + DiamondAmount string + StaffId string + StaffName string + UserId string + Memo string + RoomProfitId string + RoomSubsidyDailyId string +} + +// 参数合法性检验 +func (request *OperationAddDiamondRequest) CheckParameter() (err error) { + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/OperationAddRevenueRequest.go b/pkg/dto/inner/OperationAddRevenueRequest.go new file mode 100644 index 0000000..656c3ee --- /dev/null +++ b/pkg/dto/inner/OperationAddRevenueRequest.go @@ -0,0 +1,32 @@ +package inner + +import "errors" + +const ( + OperationAddRevenueTypeDaily = "daily" + OperationAddRevenueTypeWeekly = "weekly" + OperationAddRevenueTypeGuild = "guild" +) + +type OperationAddRevenueRequest struct { + AddType string // daily weekly + RoomProfitId string + GuildProfitId string + UserNo string + RevenueAmount string + StaffId string + StaffName string + UserId string + Memo string +} + +// 参数合法性检验 +func (request *OperationAddRevenueRequest) CheckParameter() (err error) { + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/OrderRechargeRequest.go b/pkg/dto/inner/OrderRechargeRequest.go new file mode 100644 index 0000000..1248ca1 --- /dev/null +++ b/pkg/dto/inner/OrderRechargeRequest.go @@ -0,0 +1,28 @@ +package inner + +import "errors" + +type OrderRechargeRequest struct { + OrderId string + PayType string // 支付方式 + RechargeChannel string // 充值平台 1 = APP-iOS 2= APP-Android 3= 微信公众号 4= 支付宝服务窗 + ClientRealIp string // 客户端真实IP + DeviceOs string // 设备类型 +} + +// 参数合法性检验 +func (request *OrderRechargeRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + if len(request.PayType) == 0 { + err = errors.New("PayType不能为空") + return + } + if len(request.RechargeChannel) == 0 { + err = errors.New("RechargeChannel不能为空") + return + } + return +} diff --git a/pkg/dto/inner/PayToCustomerByAlipayRequest.go b/pkg/dto/inner/PayToCustomerByAlipayRequest.go new file mode 100644 index 0000000..4879027 --- /dev/null +++ b/pkg/dto/inner/PayToCustomerByAlipayRequest.go @@ -0,0 +1,40 @@ +package inner + +import "errors" + +type PayToCustomerByAlipayRequest struct { + OutId string + PayAmount string + TrueName string + AlipayAccount string + Remark string +} + +// 参数合法性检验 +func (request *PayToCustomerByAlipayRequest) CheckParameter() (err error) { + + if len(request.OutId) == 0 { + err = errors.New("OutId不能为空") + return + } + + if len(request.PayAmount) == 0 { + err = errors.New("PayAmount不能为空") + return + } + + if len(request.AlipayAccount) == 0 { + err = errors.New("AlipayAccount不能为空") + return + } + if len(request.TrueName) == 0 { + err = errors.New("TrueName不能为空") + return + } + if len(request.Remark) == 0 { + err = errors.New("Remark不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/ReturnWithdrawRevenueRequest.go b/pkg/dto/inner/ReturnWithdrawRevenueRequest.go new file mode 100644 index 0000000..027ca2f --- /dev/null +++ b/pkg/dto/inner/ReturnWithdrawRevenueRequest.go @@ -0,0 +1,20 @@ +package inner + +import "errors" + +type ReturnWithdrawRevenueRequest struct { + WithdrawId string + StaffUserName string + FailReason string +} + +// 参数合法性检验 +func (request *ReturnWithdrawRevenueRequest) CheckParameter() (err error) { + + if len(request.WithdrawId) == 0 { + err = errors.New("WithdrawId不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/SendOfficalNoticeRequest.go b/pkg/dto/inner/SendOfficalNoticeRequest.go new file mode 100644 index 0000000..75a882d --- /dev/null +++ b/pkg/dto/inner/SendOfficalNoticeRequest.go @@ -0,0 +1,28 @@ +package inner + +import "errors" + +type SendOfficalNoticeRequest struct { + UserId string + NoticeTitle string + NoticeContent string + ImgUrl string + LinkUrl string + Hours string +} + +// 参数合法性检验 +func (request *SendOfficalNoticeRequest) CheckParameter() (err error) { + + if len(request.NoticeTitle) == 0 { + err = errors.New("NoticeTitle不能为空") + return + } + + if len(request.NoticeContent) == 0 { + err = errors.New("NoticeTitle不能为空") + return + } + + return +} diff --git a/pkg/dto/inner/UpdateYunXinUserInfoRequest.go b/pkg/dto/inner/UpdateYunXinUserInfoRequest.go new file mode 100644 index 0000000..c912397 --- /dev/null +++ b/pkg/dto/inner/UpdateYunXinUserInfoRequest.go @@ -0,0 +1,18 @@ +package inner + +import "errors" + +type UpdateYunXinInfoRequest struct { + UserId string +} + +// 参数合法性检验 +func (request *UpdateYunXinInfoRequest) CheckParameter() (err error) { + + if len(request.UserId) == 0 { + err = errors.New("NoticeTitle不能为空") + return + } + + return +} diff --git a/pkg/dto/refund/refund_dto.go b/pkg/dto/refund/refund_dto.go new file mode 100644 index 0000000..01d718c --- /dev/null +++ b/pkg/dto/refund/refund_dto.go @@ -0,0 +1,26 @@ +package refund + +import "time" + +type RefundDTO[T any] struct { + TransactionId string // 支付交易号 + OutTransactionId string // 支付订单号 + RefundId string + OutRefundId string + RefundDetail T + ChannelCode string +} + +type AliRefundDTO struct { + BuyerLogonId string // 用户的登录id + BuyerUserId string // 买家在支付宝的用户id + RefundFee string // 退款总金额 + FundChange string // 接口返回fund_change=Y为退款成功,fund_change=N或无此字段值返回时需通过退款查询接口进一步确认退款状态 + SuccessTime time.Time // 退款支付时间 +} + +type WxRefundDTO struct { + UserReceivedAccount string + SuccessTime time.Time + CreateTime time.Time +} diff --git a/pkg/dto/request/AddToBlackListRequest.go b/pkg/dto/request/AddToBlackListRequest.go new file mode 100644 index 0000000..3507b7b --- /dev/null +++ b/pkg/dto/request/AddToBlackListRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type AddToBlackListRequest struct { + AccessToken string + TargetUserId string +} + +// 参数合法性检验 +func (request *AddToBlackListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/AgentRequest.go b/pkg/dto/request/AgentRequest.go new file mode 100644 index 0000000..481b758 --- /dev/null +++ b/pkg/dto/request/AgentRequest.go @@ -0,0 +1,91 @@ +package request + +import "errors" + +// 代理用户登录 +type AgentUserLoginRequest struct { + AgentId string `json:"agentId"` + Uid string `json:"uid"` + UserName string `json:"userName"` + Gender string `json:"gender"` + Mobile string `json:"mobile"` + Signature string `json:"signature"` +} + +// 参数合法性检验 +func (request *AgentUserLoginRequest) CheckParameter() (err error) { + // 代理用户的ID + if len(request.AgentId) == 0 { + err = errors.New("agentId不能为空") + return + } + + if len(request.Uid) == 0 { + err = errors.New("uid不能为空") + return + } + + if len(request.UserName) == 0 { + err = errors.New("userName不能为空") + return + } + + if len(request.Gender) == 0 { + err = errors.New("gender不能为空") + return + } + if len(request.Signature) == 0 { + err = errors.New("signature不能为空") + return + } + + return +} + +// 内部用户登录 +type InnerUserLoginRequest struct { + Mobile string `json:"mobile"` + Signature string `json:"signature"` +} + +// 参数合法性检验 +func (request *InnerUserLoginRequest) CheckParameter() (err error) { + // 代理用户的ID + if len(request.Mobile) == 0 { + err = errors.New("agentId不能为空") + return + } + if len(request.Signature) == 0 { + err = errors.New("signature不能为空") + return + } + return +} + +// 代理获取推广房间 +type AgentPromoteRoomRequest struct { + AgentId string `json:"agentId"` + AccessToken string `json:"accessToken"` + Signature string `json:"signature"` +} + +// 参数合法性检验 +func (request *AgentPromoteRoomRequest) CheckParameter() (err error) { + // 代理用户的ID + if len(request.AgentId) == 0 { + err = errors.New("未登录不能为空") + return + } + + if len(request.AccessToken) == 0 { + err = errors.New("token不能为空") + return + } + + if len(request.Signature) == 0 { + err = errors.New("signature不能为空") + return + } + + return +} diff --git a/pkg/dto/request/AgentTransferRequest.go b/pkg/dto/request/AgentTransferRequest.go new file mode 100644 index 0000000..be176a8 --- /dev/null +++ b/pkg/dto/request/AgentTransferRequest.go @@ -0,0 +1,51 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +// 代理商上分接口 +type AgentTransferRequest struct { + AgentId string + Uid string + OrderId string + Diamond string + Signature string +} + +// 参数合法性检验 +func (request *AgentTransferRequest) CheckParameter() (err error) { + + if len(request.AgentId) == 0 { + err = errors.New("AgentId不能为空") + return + } + + if len(request.Uid) == 0 { + err = errors.New("Uid不能为空") + return + } + + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + if len(request.Diamond) == 0 { + err = errors.New("Diamond不能为空") + return + } + + if HyTools.StringToInt(request.Diamond) <= 0 { + err = errors.New("Diamond不能为负数") + return + } + + if len(request.Signature) == 0 { + err = errors.New("Signature不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BaseDispatchOrerIdRequest.go b/pkg/dto/request/BaseDispatchOrerIdRequest.go new file mode 100644 index 0000000..40eb8b3 --- /dev/null +++ b/pkg/dto/request/BaseDispatchOrerIdRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type BaseDispatchOrderIdRequest struct { + BaseRequest + DispatchOrderId string +} + +// 参数合法性检验 +func (request *BaseDispatchOrderIdRequest) CheckParameter() (err error) { + + if len(request.DispatchOrderId) == 0 { + err = errors.New("DispatchOrderId不能为空") + return + } + + return +} + +type DispatchOrderCompleteRequest struct { + BaseDispatchOrderIdRequest + SellerUserId string +} diff --git a/pkg/dto/request/BaseOrerIdRequest.go b/pkg/dto/request/BaseOrerIdRequest.go new file mode 100644 index 0000000..c9ccec1 --- /dev/null +++ b/pkg/dto/request/BaseOrerIdRequest.go @@ -0,0 +1,153 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/tools" + + "github.com/shopspring/decimal" +) + +type BaseOrderIdRequest struct { + BaseRequest + OrderId string + OrderCountComplete string // 实际完成的订单量(局) +} + +// 参数合法性检验 +func (request *BaseOrderIdRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + return +} + +type PayOrderIdRequest struct { + BaseRequest + OrderId string + BuyerUserId string +} + +// 参数合法性检验 +func (request *PayOrderIdRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + return +} + +type SellerOrderIdRequest struct { + BaseRequest + OrderId string + SellerUserId string +} + +// 参数合法性检验 +func (request *SellerOrderIdRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + return +} + +// 卖家提前完成订单 +type BuyerEarlyFinishOrderRequest struct { + BaseOrderIdRequest + OrderCountComplete string // 实际完成得订单量 + OrderAmountPaid string // 实际应支付的订单金额 +} + +// 参数合法性检验 +func (request *BuyerEarlyFinishOrderRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + return +} + +type FreeOfChargeOrderRequest struct { + BaseRequest + OrderId string + ChangeCount string // 完成单数 +} + +// 参数合法性检验 +func (request *FreeOfChargeOrderRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + if len(request.ChangeCount) == 0 { + err = errors.New("完成单数不能为空") + return + } + var count decimal.Decimal + if count, err = decimal.NewFromString(request.ChangeCount); err != nil { + err = errors.New("完成单数不能为非数字") + return + } + if !tools.IsHalfMultiple(count) { + err = errors.New("完成单数必须为0.5的倍数") + return + } + if count.LessThanOrEqual(decimal.NewFromInt(0)) { + err = errors.New("完成单数不能小于等于零") + return + } + return +} + +type ReduceOrderRequest struct { + BaseRequest + OrderId string + ChangeCount string // 完成单数 +} + +// 参数合法性检验 +func (request *ReduceOrderRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + if len(request.ChangeCount) == 0 { + err = errors.New("减少单数不能为空") + return + } + var count decimal.Decimal + if count, err = decimal.NewFromString(request.ChangeCount); err != nil { + err = errors.New("减少数不能为非数字") + return + } + if !tools.IsHalfMultiple(count) { + err = errors.New("减少单数必须为0.5的倍数") + return + } + if count.LessThanOrEqual(decimal.NewFromInt(0)) { + err = errors.New("减少单数不能小于等于零") + return + } + return +} + +// 卖家提前完成订单 +type SellerFinishOrderRequest struct { + BaseOrderIdRequest + OrderCountComplete string // 实际完成的订单量(局) +} + +// 参数合法性检验 +func (request *SellerFinishOrderRequest) CheckParameter() (err error) { + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + if len(request.OrderCountComplete) == 0 { + err = errors.New("OrderId不能为空") + return + } + return +} diff --git a/pkg/dto/request/BasePageRequest.go b/pkg/dto/request/BasePageRequest.go new file mode 100644 index 0000000..3400df7 --- /dev/null +++ b/pkg/dto/request/BasePageRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 分页获取个人数据 +type BasePageRequest struct { + AccessToken string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *BasePageRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BasePagingReqest.go b/pkg/dto/request/BasePagingReqest.go new file mode 100644 index 0000000..42e9e0b --- /dev/null +++ b/pkg/dto/request/BasePagingReqest.go @@ -0,0 +1,34 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +// 分页获取基础 +type BasePagingRequest struct { + AccessToken string + AnchorId string // 分页锚点 + PageSize string +} + +// 参数合法性检验 +func (request *BasePagingRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + if HyTools.StringToInt(request.PageSize) < 1 { + err = errors.New("PageSize不合法") + return + } + + return +} diff --git a/pkg/dto/request/BaseRequest.go b/pkg/dto/request/BaseRequest.go new file mode 100644 index 0000000..ce22dec --- /dev/null +++ b/pkg/dto/request/BaseRequest.go @@ -0,0 +1,62 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/tools" +) + +type BaseRequest struct { + AccessToken string +} + +// 参数合法性检验 +func (request *BaseRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + return +} + +type IdReq struct { + BaseRequest + BizId string +} + +func (request *IdReq) CheckParameter() (e error) { + if e = request.BaseRequest.CheckParameter(); e != nil { + return + } + if len(request.BizId) == 0 { + return errors.New("BizId不能为空") + } + return +} + +type BasePageReq struct { + BaseRequest + Page string + Size string +} + +func (d *BasePageReq) Check() (e error) { + if e = d.BaseRequest.CheckParameter(); e != nil { + return + } + if len(d.Page) == 0 { + d.Page = "0" + } + if len(d.Size) == 0 { + d.Size = "10" + } + return +} + +func (d *BasePageReq) Offset() int { + return tools.StrToInt(d.Page) * tools.StrToInt(d.Size) +} + +func (d *BasePageReq) Limit() int { + return tools.StrToInt(d.Size) +} diff --git a/pkg/dto/request/BaseSkillRequest.go b/pkg/dto/request/BaseSkillRequest.go new file mode 100644 index 0000000..2120b12 --- /dev/null +++ b/pkg/dto/request/BaseSkillRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type BaseSkillRequest struct { + AccessToken string + SkillId string +} + +// 参数合法性检验 +func (request *BaseSkillRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BaseTimelineRequest.go b/pkg/dto/request/BaseTimelineRequest.go new file mode 100644 index 0000000..1f80821 --- /dev/null +++ b/pkg/dto/request/BaseTimelineRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type BaseTimelineRequest struct { + AccessToken string + TimelineId string +} + +// 参数合法性检验 +func (request *BaseTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("TimelineId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BaseUserSkillRequest.go b/pkg/dto/request/BaseUserSkillRequest.go new file mode 100644 index 0000000..bd4d84a --- /dev/null +++ b/pkg/dto/request/BaseUserSkillRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type BaseUserSkillRequest struct { + AccessToken string + UserSkillId string +} + +// 参数合法性检验 +func (request *BaseUserSkillRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BuyChatroomEmojiRequest.go b/pkg/dto/request/BuyChatroomEmojiRequest.go new file mode 100644 index 0000000..ea2f0f9 --- /dev/null +++ b/pkg/dto/request/BuyChatroomEmojiRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +// 购买聊天室表情 +type BuyChatroomEmojiRequest struct { + AccessToken string + EmojiId string +} + +// 参数合法性检验 +func (request *BuyChatroomEmojiRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.EmojiId) == 0 { + err = errors.New("PageNo不能为空") + return + } + + return +} diff --git a/pkg/dto/request/BuyerRateSkillOrderRequest.go b/pkg/dto/request/BuyerRateSkillOrderRequest.go new file mode 100644 index 0000000..38b62b3 --- /dev/null +++ b/pkg/dto/request/BuyerRateSkillOrderRequest.go @@ -0,0 +1,120 @@ +package request + +import ( + "errors" + "unicode/utf8" +) + +type BuyerRateSkillOrderRequest struct { + AccessToken string + OrderId string + RateScore string + RateContent string + IsHidden string + ImageUrl string +} + +// 参数合法性检验 +func (request *BuyerRateSkillOrderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.OrderId) == 0 { + err = errors.New("OrderId不能为空") + return + } + + if len(request.RateScore) == 0 { + err = errors.New("RateScore不能为空") + return + } + + return +} + +type BuyerDelRateSkillOrderRequest struct { + AccessToken string + RateID string +} + +// 参数合法性检验 +func (request *BuyerDelRateSkillOrderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.RateID) == 0 { + err = errors.New("RateID不能为空") + return + } + + return +} + +type ReplyRateSkillOrderReq struct { + AccessToken string + RateId string + OrderId string + Content string + ToReplyID string + ReplyRole string // seller、buyer + ImageUrl string +} + +// CheckParameter 参数合法性检验 +func (request *ReplyRateSkillOrderReq) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.RateId) == 0 { + err = errors.New("RateId不能为空") + return + } + if len(request.OrderId) == 0 { + err = errors.New("OrderID不能为空") + return + } + + if len(request.Content) == 0 { + err = errors.New("Content不能为空") + return + } + if utf8.RuneCountInString(request.Content) > 300 { + err = errors.New("Content不能超过300字") + return + } + if request.ReplyRole != "seller" && request.ReplyRole != "buyer" { + err = errors.New("ReplyRole错误") + return + } + + return +} + +type DelReplyRateSkillOrderReq struct { + AccessToken string + ReplyID string +} + +// CheckParameter 参数合法性检验 +func (request *DelReplyRateSkillOrderReq) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.ReplyID) == 0 { + err = errors.New("ReplyID不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ChangePasswordRequest.go b/pkg/dto/request/ChangePasswordRequest.go new file mode 100644 index 0000000..817773f --- /dev/null +++ b/pkg/dto/request/ChangePasswordRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type ChangePasswordRequest struct { + BaseRequest + OldPassword string + NewPassword string +} + +// 签名验证 +func (request *ChangePasswordRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.OldPassword) == 0 { + err = errors.New("OldPassword不能为空") + return + } + + if len(request.NewPassword) == 0 { + err = errors.New("NewPassword不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ChatRoomBaseRequest.go b/pkg/dto/request/ChatRoomBaseRequest.go new file mode 100644 index 0000000..0f2c60b --- /dev/null +++ b/pkg/dto/request/ChatRoomBaseRequest.go @@ -0,0 +1,77 @@ +package request + +import "errors" + +type ChatroomBaseRequest struct { + BaseRequest + ChatroomId string + //ViewPosition string // 房间右侧:ROOM_RIGHT 普通礼物栏:GIFT_NORMAL 礼物背包:GIFT_BAG +} + +// 参数合法性检验 +func (request *ChatroomBaseRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} + +// 获取访问过的 +type GetVisitedChatroomListRequest struct { + BaseRequest + BaseGuildRequest + PageCode string // PD_HOME PD_ALL +} + +// 参数合法性检验 +func (request *GetVisitedChatroomListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageCode) == 0 { + err = errors.New("PageCode不能为空") + return + } + + return +} + +// 送人进房 +type TakeUsersToRoomRequest struct { + BaseRequest + ChatroomNo string + UserIds string + Reason string // 送人进房的理由 order-audition=订单试音 order-confirm=订单确认 +} + +// 参数合法性检验 +func (request *TakeUsersToRoomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomNo) == 0 { + err = errors.New("ChatroomNo不能为空") + return + } + + if len(request.UserIds) == 0 { + err = errors.New("用户不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ChatRoomCmdRequest.go b/pkg/dto/request/ChatRoomCmdRequest.go new file mode 100644 index 0000000..df0e2e8 --- /dev/null +++ b/pkg/dto/request/ChatRoomCmdRequest.go @@ -0,0 +1,52 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// 聊天室命令请求 +type ChatroomCmdRequest struct { + BaseRequest + ChatroomId string // 聊天室ID + CurrentUserId string `json:"-"` // 当前操作用户 + CmdCode string // 命令code + SeatIndex string // 当前操作用户座位编号 新增加boss座位 , seatIndex 为99 + TargetUserId string // 被操作用户ID + TargetSeatIndex string // 被操作用户位置 新增加boss座位 , seatIndex 为99 + SeatType string // 座位类型 黄金=1 白银=2 青铜=3 老板=4 陪陪(大神)=5 + TemplateId string // 模板 + RoomName string // 房间名称 + CountDownSeconds string // 倒计时时长 30 60 120 300秒 + AllowQueue string // 允许还是禁止排队 1=允许 0=禁止 +} + +// 参数合法性检验 +func (request *ChatroomCmdRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.CmdCode) == 0 { + err = errors.New("CmdCode不能为空") + return + } + + if len(request.SeatType) > 0 { + seatTypeList := []string{"1", "2", "3", "4", "5"} + if !htools.CheckStringIsInArray(seatTypeList, request.SeatType) { + err = errors.New("座位类型错误") + return + } + } + + return +} diff --git a/pkg/dto/request/ChatRoomKickOutUserRequest.go b/pkg/dto/request/ChatRoomKickOutUserRequest.go new file mode 100644 index 0000000..6532862 --- /dev/null +++ b/pkg/dto/request/ChatRoomKickOutUserRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 踢人请求 +type ChatroomKickOutUserRequest struct { + BaseRequest + ChatroomId string + TargetUserId string // 被踢出的用户Id +} + +// 参数合法性检验 +func (request *ChatroomKickOutUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ChatRoomRankRequest.go b/pkg/dto/request/ChatRoomRankRequest.go new file mode 100644 index 0000000..aa644de --- /dev/null +++ b/pkg/dto/request/ChatRoomRankRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type ChatroomRankRequest struct { + BaseRequest + ChatroomId string + RankType string // week=周榜 month=月榜 all=总榜 day=日榜 +} + +// 参数合法性检验 +func (request *ChatroomRankRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ChatroomBuyGuardSeat.go b/pkg/dto/request/ChatroomBuyGuardSeat.go new file mode 100644 index 0000000..4d6c816 --- /dev/null +++ b/pkg/dto/request/ChatroomBuyGuardSeat.go @@ -0,0 +1,54 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common" +) + +// 购买聊天室表情 +type ChatroomBuyGuardSeatRequest struct { + AccessToken string + ChatroomId string + ConfigId string // 配置ID + SeatType string + HostUserId string +} + +// 参数合法性检验 +func (request *ChatroomBuyGuardSeatRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.SeatType) == 0 { + err = errors.New("SeatType不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.HostUserId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.ConfigId) == 0 { + err = errors.New("ConfigId不能为空") + return + } + + if request.SeatType != common.CHATROOM_SEAT_TYPE_GOLD_GUARD_SEAT && request.SeatType != common.CHATROOM_SEAT_TYPE_SILVER_GUARD_SEAT && + request.SeatType != common.CHATROOM_SEAT_TYPE_BRONZE_GUARD_SEAT { + err = errors.New("座位类型错误") + return + + } + + return +} diff --git a/pkg/dto/request/ChatroomRockSkewerRequest.go b/pkg/dto/request/ChatroomRockSkewerRequest.go new file mode 100644 index 0000000..0665eb7 --- /dev/null +++ b/pkg/dto/request/ChatroomRockSkewerRequest.go @@ -0,0 +1,27 @@ +package request + +import ( + "errors" +) + +// 购买聊天室表情 +type ChatroomRockSkewerRequest struct { + AccessToken string + ChatroomId string +} + +// 参数合法性检验 +func (request *ChatroomRockSkewerRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ClearChatroomCharmRequest.go b/pkg/dto/request/ClearChatroomCharmRequest.go new file mode 100644 index 0000000..4aee7c5 --- /dev/null +++ b/pkg/dto/request/ClearChatroomCharmRequest.go @@ -0,0 +1,40 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common" +) + +type ClearChatroomCharmRequest struct { + BaseRequest + ChatroomId string + TargetUserId string + ActionType string // 1=清除整个房间的魅力 2=清除个人的魅力 +} + +// 参数合法性检验 +func (request *ClearChatroomCharmRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.ActionType) == 0 { + err = errors.New("ActionType不能为空") + return + } + + if request.ActionType == common.CLEAR_CHATROOM_CHARM_TYPE_ONE_USER && len(request.TargetUserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/CollectRoomRequest.go b/pkg/dto/request/CollectRoomRequest.go new file mode 100644 index 0000000..1b87be7 --- /dev/null +++ b/pkg/dto/request/CollectRoomRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type CollectRoomRequest struct { + BaseRequest + ChatroomId string + ActionType string //1=收藏 0=取消收藏 +} + +// 参数合法性检验 +func (request *CollectRoomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.ActionType) == 0 { + err = errors.New("ActionType不能为空") + return + } + + return +} diff --git a/pkg/dto/request/CommonRequest.go b/pkg/dto/request/CommonRequest.go new file mode 100644 index 0000000..82bba7f --- /dev/null +++ b/pkg/dto/request/CommonRequest.go @@ -0,0 +1,10 @@ +package request + +type CommonRequest struct { +} + +// 参数合法性检验 +func (request *CommonRequest) CheckParameter() (err error) { + + return +} diff --git a/pkg/dto/request/CompleteUserInfoRequest.go b/pkg/dto/request/CompleteUserInfoRequest.go new file mode 100644 index 0000000..c814afc --- /dev/null +++ b/pkg/dto/request/CompleteUserInfoRequest.go @@ -0,0 +1,43 @@ +package request + +import ( + "errors" +) + +type CompleteUserInfoRequest struct { + Mobile string + Birthday string + NickName string + Gender string + Avatar string +} + +// 注册用户信息签名验证 +func (request *CompleteUserInfoRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("手机号不能为空") + return + } + + if len(request.NickName) == 0 { + err = errors.New("昵称不能为空") + return + } + + if len(request.Gender) == 0 { + err = errors.New("性别不能为空") + return + } + + if len(request.Avatar) == 0 { + err = errors.New("头像不能为空") + return + } + + if len(request.NickName) > 30 { + err = errors.New("昵称长度不能超过30") + return + } + return +} diff --git a/pkg/dto/request/CreateMallOrderRequest.go b/pkg/dto/request/CreateMallOrderRequest.go new file mode 100644 index 0000000..7f159eb --- /dev/null +++ b/pkg/dto/request/CreateMallOrderRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +type CreateMallOrderRequest struct { + BaseRequest + BuyAmount string // 下单数量 + GetterId string // 获得者Id + PriceId string // 价格ID + UserDiscountId string // 优惠ID +} + +// 参数合法性检验 +func (request *CreateMallOrderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.BuyAmount) == 0 { + err = errors.New("BuyAmount不能为空") + return + } + + if len(request.PriceId) == 0 { + err = errors.New("PriceId 不能为空") + return + } + + return +} diff --git a/pkg/dto/request/CreatePointOrderRequest.go b/pkg/dto/request/CreatePointOrderRequest.go new file mode 100644 index 0000000..56ba44d --- /dev/null +++ b/pkg/dto/request/CreatePointOrderRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type CreatePointOrderRequest struct { + BaseRequest + BuyAmount string // 下单数量 + PriceId string // 价格ID +} + +// 参数合法性检验 +func (request *CreatePointOrderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.BuyAmount) == 0 { + err = errors.New("BuyAmount不能为空") + return + } + + if len(request.PriceId) == 0 { + err = errors.New("PriceId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/CreateSkillOrderRequest.go b/pkg/dto/request/CreateSkillOrderRequest.go new file mode 100644 index 0000000..c42cb5e --- /dev/null +++ b/pkg/dto/request/CreateSkillOrderRequest.go @@ -0,0 +1,95 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +// 技能下单 +type CreateGuildSkillOrderRequest struct { + AccessToken string + GuildId string + BuyerUserId string + UserSkillId string + BeginTime string + OrderCount string + OrderExt string + BuyerMemo string + PriceId string // 价格ID + ChatroomId string // 从哪个聊天室进来的下单 + DispatchOrderId string // 当前聊天室的派单ID + DispatchHostUserId string // 当前聊天室的派单人 +} + +// 参数合法性检验 +func (request *CreateGuildSkillOrderRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + // if len(request.BeginTime) == 0 { + // err = errors.New("BeginTime不能为空") + // return + // } + if len(request.OrderCount) == 0 { + err = errors.New("OrderCount不能为空") + return + } + if len(request.PriceId) == 0 { + err = errors.New("PriceId不能为空") + return + } + if HyTools.StringToFloat64(request.OrderCount) < 0 || HyTools.StringToFloat64(request.OrderCount) > 999 { + err = errors.New("OrderCount不合法") + return + } + return +} + +// 技能下单-再来一单 +type ReplicateSkillOrderRequest struct { + BaseOrderIdRequest + OrderCount string + BuyerMemo string +} + +// 参数合法性检验 +func (request *ReplicateSkillOrderRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.OrderCount) == 0 { + err = errors.New("OrderCount不能为空") + return + } + if HyTools.StringToFloat64(request.OrderCount) < 0 || HyTools.StringToFloat64(request.OrderCount) > 999 { + err = errors.New("OrderCount不合法") + return + } + return +} + +type CreateSkillOrderDispatchRequest struct { + AccessToken string + DispatchOrderId string // 当前聊天室的派单ID +} + +// 参数合法性检验 +func (request *CreateSkillOrderDispatchRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.DispatchOrderId) == 0 { + err = errors.New("DispatchOrderId不能为空") + return + } + return +} diff --git a/pkg/dto/request/CreateTimelineRequest.go b/pkg/dto/request/CreateTimelineRequest.go new file mode 100644 index 0000000..15ef021 --- /dev/null +++ b/pkg/dto/request/CreateTimelineRequest.go @@ -0,0 +1,69 @@ +package request + +import ( + "errors" +) + +// 动态的图片对象 +type TimelineImgDTO struct { + ImgPhotoKey string + Width string + Height string +} + +// 动态的视频对象 +type TimelineVideoDTO struct { + VideoKey string + Width string + Height string + Duration string +} + +type CreateTimelineRequest struct { + AccessToken string + ContentType string //1=图片 2=视频 + TextContent string + ImgUrls string + ImgSizes string + ImgList string //json字符串 + VideoDTO string //json字符串 + CityName string // 城市名 + AddressName string + Latitude string + Longitude string + UserSkillId string +} + +// 参数合法性检验 +func (request *CreateTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + // if utf8.RuneCountInString(request.TextContent) > 140 { + // err = errors.New("内容最多140个字") + // return + // } + + if len([]rune(request.TextContent)) > 1000 { + return errors.New("不能超过1000字") + } + + // 视频 + if request.ContentType == "2" { + + if len(request.VideoDTO) == 0 { + err = errors.New("VideoDTO不能为空") + return + } + } else { + + if len(request.ImgUrls) == 0 && len(request.ImgList) == 0 { + err = errors.New("ImgUrls不能为空") + return + } + } + return +} diff --git a/pkg/dto/request/DataRequest.go b/pkg/dto/request/DataRequest.go new file mode 100644 index 0000000..12cc91b --- /dev/null +++ b/pkg/dto/request/DataRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type GetMatchUserRequest struct { + BaseRequest + SkillId string // 技能ID + SkillMode string // 航天 大坝等 + SkillLevel string // 211 大专 985 等 + Gender string // 性别 女=0 男=1 +} + +// 参数合法性检验 +func (request *GetMatchUserRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + return +} diff --git a/pkg/dto/request/DeleteReplyRequest.go b/pkg/dto/request/DeleteReplyRequest.go new file mode 100644 index 0000000..a7bf01e --- /dev/null +++ b/pkg/dto/request/DeleteReplyRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type DeleteReplyRequest struct { + BaseRequest + ReplyId string +} + +// 参数合法性检验 +func (request *DeleteReplyRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ReplyId) == 0 { + err = errors.New("ReplyId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/DeleteTimelineRequest.go b/pkg/dto/request/DeleteTimelineRequest.go new file mode 100644 index 0000000..96e3f19 --- /dev/null +++ b/pkg/dto/request/DeleteTimelineRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type DeleteTimelineRequest struct { + AccessToken string + TimelineId string +} + +// 参数合法性检验 +func (request *DeleteTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("TimelineId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/DeleteUserCheckRequest.go b/pkg/dto/request/DeleteUserCheckRequest.go new file mode 100644 index 0000000..78a8bb8 --- /dev/null +++ b/pkg/dto/request/DeleteUserCheckRequest.go @@ -0,0 +1,69 @@ +package request + +import "errors" + +type DeleteUserCheckRequest struct { + AccessToken string + Mobile string + VerificationCode string +} + +// 参数合法性检验 +func (request *DeleteUserCheckRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + + if len(request.VerificationCode) == 0 { + err = errors.New("VerificationCode不能为空") + return + } + + return +} + +type DeleteUserApplyRequest struct { + AccessToken string + VerificationCode string + CertImgFront string + CertImgBacked string + CertImgInHand string +} + +// 参数合法性检验 +func (request *DeleteUserApplyRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.VerificationCode) == 0 { + err = errors.New("VerificationCode不能为空") + return + } + + // if len(request.CertImgFront) == 0 { + // err = errors.New("CertImgFront不能为空") + // return + // } + + // if len(request.CertImgBacked) == 0 { + // err = errors.New("CertImgBack不能为空") + // return + // } + + // if len(request.CertImgInHand) == 0 { + // err = errors.New("CertImgInHand不能为空") + // return + // } + + return +} diff --git a/pkg/dto/request/DeleteUserPhotoRequest.go b/pkg/dto/request/DeleteUserPhotoRequest.go new file mode 100644 index 0000000..ad4a0d5 --- /dev/null +++ b/pkg/dto/request/DeleteUserPhotoRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type DeleteUserPhotoRequest struct { + BaseRequest + UserPhotoModelId string +} + +// 参数合法性检验 +func (request *DeleteUserPhotoRequest) CheckParameter() (err error) { + + if len(request.UserPhotoModelId) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/DispatchOrderRequest.go b/pkg/dto/request/DispatchOrderRequest.go new file mode 100644 index 0000000..9af0be7 --- /dev/null +++ b/pkg/dto/request/DispatchOrderRequest.go @@ -0,0 +1,131 @@ +package request + +import ( + "encoding/json" + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" + + "github.com/shopspring/decimal" +) + +// 派单请求 +type DispatchOrderRequest struct { + BaseRequest + GuildId string // 公会ID + ChatroomId string // 聊天室ID + SkillId string // 技能ID + SkillMode string // 玩法 + SkillLevel string // 等级 + SkillService string // 单子类型 + Gender string // 性别 + Hours string // 时长 + ConfigId string // 配置ID + CustomerRequirement string // 用户需求 +} + +// 判断decimal是否是0.5的倍数 +func isHalfMultiple(d decimal.Decimal) bool { + // 乘以2后检查是否为整数 + multiplied := d.Mul(decimal.NewFromInt(2)) + // 将整数部分转换为decimal类型后再比较 + intPart := decimal.NewFromInt(multiplied.IntPart()) + return multiplied.Equal(intPart) +} + +// 签名验证 +func (request *DispatchOrderRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + if HyTools.StringToInt(request.Hours) <= 0 || HyTools.StringToInt(request.Hours) > 999 { + err = errors.New("时长不合法") + return + } + //var hours decimal.Decimal + //hours, err = decimal.NewFromString(request.Hours) + //if err != nil { + // err = errors.New("时长不正确") + // return + //} + //if !isHalfMultiple(hours) { + // err = errors.New("时长必须为0.5的倍数") + // return + //} + return +} + +// 派单请求 +type DispatchOrderCommonRequest struct { + BaseRequest + GuildId string // 公会ID + ChatroomId string // 房间ID(客服下单) + HostUserId string // 派单用户ID(客服下单) + BuyerId string // 买家ID(用户自己下单) + SkillId string // 技能ID + Hours string // 时长 + Comment string // 备注 + NeedsAudition string // 是否试音 T=是 F=否 + OrderList string + Orders []DispatchOrderCommonItemRequest + CompanionType string // 陪玩类型 single double +} + +type DispatchOrderCommonItemRequest struct { + ConfigId string // 价格配置ID + Mode string // + Level string // + Service string // + Gender string // + Price string // +} + +// 签名验证 +func (request *DispatchOrderCommonRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + if e := json.Unmarshal([]byte(request.OrderList), &request.Orders); e != nil { + err = errors.New("数据格式错误") + return + } + if len(request.Orders) == 0 { + err = errors.New("至少要选择一个陪玩") + return + } + if HyTools.StringToInt(request.Hours) <= 0 || HyTools.StringToInt(request.Hours) > 999 { + err = errors.New("时长不合法") + return + } + //var hours decimal.Decimal + //hours, err = decimal.NewFromString(request.Hours) + //if err != nil { + // err = errors.New("时长不正确") + // return + //} + //if !isHalfMultiple(hours) { + // err = errors.New("时长必须为0.5的倍数") + // return + //} + for _, item := range request.Orders { + if len(item.Gender) > 0 && (HyTools.StringToInt(item.Price) <= 0 || HyTools.StringToInt(item.Price) > 99999) { + err = errors.New("价格不合法") + return + } + } + return +} diff --git a/pkg/dto/request/EnterRoomRequest.go b/pkg/dto/request/EnterRoomRequest.go new file mode 100644 index 0000000..43cd954 --- /dev/null +++ b/pkg/dto/request/EnterRoomRequest.go @@ -0,0 +1,22 @@ +package request + +import "errors" + +type EnterRoomRequest struct { + BaseRequest + ChatroomId string + RoomPwd string +} + +// 参数合法性检验 +func (request *EnterRoomRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + return +} diff --git a/pkg/dto/request/ExamOrderRequest.go b/pkg/dto/request/ExamOrderRequest.go new file mode 100644 index 0000000..8e48dd5 --- /dev/null +++ b/pkg/dto/request/ExamOrderRequest.go @@ -0,0 +1,69 @@ +package request + +import "github.com/shopspring/decimal" + +type CreateExaminerReq struct { + BaseRequest + UserId string + SkillId string +} + +type BindExaminerSkillReq struct { + BaseRequest + UserId string + SkillId string +} + +type DownExaminerReq struct { + BaseRequest + UserId string + Reason string + Status string // down | normal +} + +type CreateExamReq struct { + BaseRequest + SkillId string + MapId string + LevelId string + GenderRequirement string // F | M | N + Requirement string // single | double + CandidateStatus string // employed | unemployed + FirstFree string // y | n + UpStart string + UpEnd string + RightNow bool + EmployedPrice decimal.Decimal + UnEmployedPrice decimal.Decimal +} + +type UpdateExamReq struct { + CreateExamReq + ExamId string + Status string // down +} + +type CreateNoticeReq struct { + BaseRequest + Id string + Content string + ImgUrl string + UpStart string + UpEnd string + RightNow bool +} + +type ReviewExamApprovalReq struct { + BaseRequest + OrderNo string + ReviewId string + Action string // accept deny + Reason string +} + +type SupportOrderReq struct { + BaseRequest + Content string + SupportId string + OrderNo string +} diff --git a/pkg/dto/request/ExamRequest.go b/pkg/dto/request/ExamRequest.go new file mode 100644 index 0000000..6a47a65 --- /dev/null +++ b/pkg/dto/request/ExamRequest.go @@ -0,0 +1,173 @@ +package request + +import ( + "errors" + "unicode/utf8" +) + +type GetExamNoticeReq struct { + BaseRequest +} + +type GetExaminerReq struct { + BasePageRequest + SkillId string + LevelId string + MapId string + Requirement string // single double + SearchKey string +} + +func (r *GetExaminerReq) CheckParameter() error { + err := r.BasePageRequest.CheckParameter() + if err != nil { + return err + } + if r.SkillId == "" { + return errors.New("SkillId不能为空") + } + return nil +} + +type CreateExamOrderReq struct { + BaseRequest + ExaminerId string + ExamId string +} + +func (r *CreateExamOrderReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.ExaminerId == "" { + return errors.New("ExaminerId不能为空") + } + if r.ExamId == "" { + return errors.New("ExamId不能为空") + } + return nil +} + +type GetExamOrderListReq struct { + BasePageRequest +} + +func (r *GetExamOrderListReq) CheckParameter() error { + err := r.BasePageRequest.CheckParameter() + if err != nil { + return err + } + return nil +} + +type SubmitExamOrderReviewReq struct { + BaseRequest + OrderNo string + StartTime string + EndTime string + Remark string + Url string + Desc string + VideoUrl string +} + +func (r *SubmitExamOrderReviewReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.OrderNo == "" { + return errors.New("OrderNo不能为空") + } + if r.StartTime == "" { + return errors.New("StartTime不能为空") + } + if r.EndTime == "" { + return errors.New("EndTime不能为空") + } + if utf8.RuneCountInString(r.Remark) > 300 { + return errors.New("Remark不能超过300字") + } + return nil +} + +type CompleteExamOrderReq struct { + BaseRequest + OrderNo string +} + +func (r *CompleteExamOrderReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.OrderNo == "" { + return errors.New("OrderNo不能为空") + } + return nil +} + +type ExamImg struct { + Url string + Desc string +} + +type GetExamReq struct { + BaseRequest + SkillId string + LevelId string + MapId string + Requirement string // single double +} + +func (r *GetExamReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.SkillId == "" { + return errors.New("SkillId不能为空") + } + return nil +} + +type ApplyExamOrderCustomerServiceReq struct { + BaseRequest + OrderNo string + Reason string +} + +func (r *ApplyExamOrderCustomerServiceReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.OrderNo == "" { + return errors.New("OrderNo不能为空") + } + if utf8.RuneCountInString(r.Reason) > 100 { + return errors.New("Reason不能超过100字") + } + return nil +} + +type RateExamOrderReq struct { + BaseRequest + OrderNo string + Content string +} + +func (r *RateExamOrderReq) CheckParameter() error { + err := r.BaseRequest.CheckParameter() + if err != nil { + return err + } + if r.OrderNo == "" { + return errors.New("OrderNo不能为空") + } + if utf8.RuneCountInString(r.Content) > 100 { + return errors.New("Content不能超过100字") + } + return nil +} diff --git a/pkg/dto/request/FindTreasureRequest.go b/pkg/dto/request/FindTreasureRequest.go new file mode 100644 index 0000000..1aab40f --- /dev/null +++ b/pkg/dto/request/FindTreasureRequest.go @@ -0,0 +1,45 @@ +package request + +import ( + "errors" + "strings" +) + +type FindTreasureRequest struct { + BaseRequest + PriceType string + BoxIds string +} + +// 签名验证 +func (request *FindTreasureRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PriceType) == 0 { + err = errors.New("PriceType不能为空") + return + } + + if request.PriceType != "1" && request.PriceType != "2" && request.PriceType != "3" { + err = errors.New("PriceType非法") + return + } + + if len(request.BoxIds) == 0 { + err = errors.New("BoxIds不能为空") + return + } + + idList := strings.Split(request.BoxIds, ",") + + if len(idList) < 1 || len(idList) > 9 { + err = errors.New("BoxIds非法") + return + } + + return +} diff --git a/pkg/dto/request/FirstTimeBindMobileRequest.go b/pkg/dto/request/FirstTimeBindMobileRequest.go new file mode 100644 index 0000000..ea844c8 --- /dev/null +++ b/pkg/dto/request/FirstTimeBindMobileRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +// 首次绑定手机号 +type FirstTimeBindMobileRequest struct { + AccessToken string + Mobile string + Vericode string + RegionCode string +} + +// 参数合法性检验 +func (request *FirstTimeBindMobileRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + + if len(request.Vericode) == 0 { + err = errors.New("Vericode不能为空") + return + } + + return +} diff --git a/pkg/dto/request/FirstTimeSetPasswordRequest.go b/pkg/dto/request/FirstTimeSetPasswordRequest.go new file mode 100644 index 0000000..771b4b3 --- /dev/null +++ b/pkg/dto/request/FirstTimeSetPasswordRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type FirstTimeSetPasswordRequest struct { + AccessToken string + Password string +} + +// 参数合法性检验 +func (request *FirstTimeSetPasswordRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Password) == 0 { + err = errors.New("Password不能为空") + return + } + + return +} diff --git a/pkg/dto/request/FollowUserRequest.go b/pkg/dto/request/FollowUserRequest.go new file mode 100644 index 0000000..3d8b1df --- /dev/null +++ b/pkg/dto/request/FollowUserRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type FollowUserRequest struct { + BaseRequest + TargetUserId string +} + +// 参数合法性检验 +func (request *FollowUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GeneralRankRequest.go b/pkg/dto/request/GeneralRankRequest.go new file mode 100644 index 0000000..7a005a8 --- /dev/null +++ b/pkg/dto/request/GeneralRankRequest.go @@ -0,0 +1,18 @@ +package request + +type GeneralRankRequest struct { + BasePageRequest +} + +func (r *GeneralRankRequest) CheckParameter() (err error) { + err = r.BasePageRequest.CheckParameter() + if err != nil { + return err + } + return +} + +type GeneralGiftRequest struct { + BaseRequest + RankCode string +} diff --git a/pkg/dto/request/GetBannerListRequest.go b/pkg/dto/request/GetBannerListRequest.go new file mode 100644 index 0000000..4b55fb8 --- /dev/null +++ b/pkg/dto/request/GetBannerListRequest.go @@ -0,0 +1,20 @@ +package request + +import "errors" + +type GetBannerListRequest struct { + BaseRequest + PositionCode string + GuildId string +} + +// 参数合法性检验 +func (request *GetBannerListRequest) CheckParameter() (err error) { + + if len(request.PositionCode) == 0 { + err = errors.New("PositionCode不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetChatRoomActivityRequest.go b/pkg/dto/request/GetChatRoomActivityRequest.go new file mode 100644 index 0000000..43cee61 --- /dev/null +++ b/pkg/dto/request/GetChatRoomActivityRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type GetChatroomActivityRequest struct { + BaseRequest + ChatroomId string + ViewPosition string // 房间右侧:ROOM_RIGHT 普通礼物栏:GIFT_NORMAL 礼物背包:GIFT_BAG +} + +// 参数合法性检验 +func (request *GetChatroomActivityRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetChatRoomBlackReasonRequest.go b/pkg/dto/request/GetChatRoomBlackReasonRequest.go new file mode 100644 index 0000000..e0494cf --- /dev/null +++ b/pkg/dto/request/GetChatRoomBlackReasonRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type GetChatroomBlackReasonRequest struct { + BaseRequest + TemplateId string +} + +// 参数合法性检验 +func (request *GetChatroomBlackReasonRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TemplateId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetChatroomListRequest.go b/pkg/dto/request/GetChatroomListRequest.go new file mode 100644 index 0000000..ce0aa34 --- /dev/null +++ b/pkg/dto/request/GetChatroomListRequest.go @@ -0,0 +1,56 @@ +package request + +import "errors" + +type GetChatroomListRequest struct { + BaseGuildRequest + TabId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetChatroomListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TabId) == 0 { + err = errors.New("TabId不能为空") + return + } + + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + return +} + +type GetChatroomChildrenListRequest struct { + BaseRequest + CurrentRoomId string + UseDefaultGroup *bool + RootId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetChatroomChildrenListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetChatroomOnlineGuardListRequest.go b/pkg/dto/request/GetChatroomOnlineGuardListRequest.go new file mode 100644 index 0000000..b73b3ad --- /dev/null +++ b/pkg/dto/request/GetChatroomOnlineGuardListRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type GetChatroomOnlineGuardListRequest struct { + BaseRequest + HostUserId string + ChatroomId string +} + +// 参数合法性检验 +func (request *GetChatroomOnlineGuardListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.HostUserId) == 0 { + err = errors.New("HostUserId不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetDispatchOrderCenterDataListRequest.go b/pkg/dto/request/GetDispatchOrderCenterDataListRequest.go new file mode 100644 index 0000000..5e9d153 --- /dev/null +++ b/pkg/dto/request/GetDispatchOrderCenterDataListRequest.go @@ -0,0 +1,58 @@ +package request + +import "errors" + +type GetDispatchOrderCenterDataListRequest struct { + BaseRequest + LastCreateTime string + PageNo string + PageSize string + + Status string // 接单状态 taked=已接单 预留 +} + +// 参数合法性检验 +func (request *GetDispatchOrderCenterDataListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + return +} + +type GetDispatchOrderCenterDataHistoryListRequest struct { + BaseRequest + LastCreateTime string + PageNo string + PageSize string + //DispatchStatus string // 派单状态 dispatching-派单中 success-派单完成 + //TakeStatus string // 接单状态 take=已接单 notTake 未接单 预留 +} + +// 参数合法性检验 +func (request *GetDispatchOrderCenterDataHistoryListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} + +type GetActiveOrderListRequest struct { + BaseRequest + ChatroomId string +} + +// 参数合法性检验 +func (request *GetActiveOrderListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.ChatroomId) == 0 { + err = errors.New("ChartoomId不能为空") + return + } + return +} diff --git a/pkg/dto/request/GetGoodsExchangeConfigRequest.go b/pkg/dto/request/GetGoodsExchangeConfigRequest.go new file mode 100644 index 0000000..67f66cb --- /dev/null +++ b/pkg/dto/request/GetGoodsExchangeConfigRequest.go @@ -0,0 +1,23 @@ +package request + +import "errors" + +// 获取物品兑换配置表 +type GetGoodsExchangeConfigRequest struct { + AccessToken string + GoodsId string + ActId string +} + +// 参数合法性检验 +func (request *GetGoodsExchangeConfigRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.GoodsId) == 0 && len(request.ActId) == 0 { + err = errors.New("GoodsId和ActId不能同时为空") + return + } + return +} diff --git a/pkg/dto/request/GetGoodsOrderListRequest.go b/pkg/dto/request/GetGoodsOrderListRequest.go new file mode 100644 index 0000000..8ebef8d --- /dev/null +++ b/pkg/dto/request/GetGoodsOrderListRequest.go @@ -0,0 +1,26 @@ +package request + +import "errors" + +type GetGoodsOrderListRequest struct { + BaseRequest + GoodsId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetGoodsOrderListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.GoodsId) == 0 { + err = errors.New("GoodsId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetHomeDataRequest.go b/pkg/dto/request/GetHomeDataRequest.go new file mode 100644 index 0000000..1bfdc38 --- /dev/null +++ b/pkg/dto/request/GetHomeDataRequest.go @@ -0,0 +1,20 @@ +package request + +import "errors" + +type GetHomeDataRequest struct { + BaseRequest + PageCode string + GuildId string +} + +// 参数合法性检验 +func (request *GetHomeDataRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetHostGuardListRequest.go b/pkg/dto/request/GetHostGuardListRequest.go new file mode 100644 index 0000000..90de7d9 --- /dev/null +++ b/pkg/dto/request/GetHostGuardListRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type GetHostGuardListRequest struct { + BaseRequest + HostUserId string +} + +// 参数合法性检验 +func (request *GetHostGuardListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.HostUserId) == 0 { + err = errors.New("HostUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetLocalMobileRequest.go b/pkg/dto/request/GetLocalMobileRequest.go new file mode 100644 index 0000000..0aeea1e --- /dev/null +++ b/pkg/dto/request/GetLocalMobileRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +// 获取本机手机号 +type GetLocalMobileRequest struct { + YiDunAccessToken string + YiDunToken string +} + +// 参数合法性检验 +func (request *GetLocalMobileRequest) CheckParameter() (err error) { + + if len(request.YiDunAccessToken) == 0 { + err = errors.New("YiDunAccessToken不能为空") + return + } + + if len(request.YiDunToken) == 0 { + err = errors.New("YiDunToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetMusicListRequest.go b/pkg/dto/request/GetMusicListRequest.go new file mode 100644 index 0000000..c120db1 --- /dev/null +++ b/pkg/dto/request/GetMusicListRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +// 分页获取音乐 +type GetMusicListRequest struct { + AccessToken string + Keyword string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetMusicListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetMyHitEggPrizeListRequest.go b/pkg/dto/request/GetMyHitEggPrizeListRequest.go new file mode 100644 index 0000000..cf47009 --- /dev/null +++ b/pkg/dto/request/GetMyHitEggPrizeListRequest.go @@ -0,0 +1,26 @@ +package request + +import "errors" + +type GetMyHitEggPrizeListRequest struct { + BasePageRequest + SortType string //time=按时间 price=礼物价格 +} + +// 参数合法性检验 +func (request *GetMyHitEggPrizeListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.SortType) > 0 { + if request.SortType != "time" && request.SortType != "price" { + err = errors.New("OrderType参数错误") + return + } + } + + return +} diff --git a/pkg/dto/request/GetSkillLevelListRequest.go b/pkg/dto/request/GetSkillLevelListRequest.go new file mode 100644 index 0000000..c5598e4 --- /dev/null +++ b/pkg/dto/request/GetSkillLevelListRequest.go @@ -0,0 +1,58 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/order" +) + +type GetSkillLevelListRequest struct { + AccessToken string + SkillId string +} + +// 参数合法性检验 +func (request *GetSkillLevelListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + return +} + +type GetOrderRankReq struct { + BasePageRequest + Category string // day week month + GuildId string + GroupByFields []string +} + +// 参数合法性检验 +func (request *GetOrderRankReq) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if request.Category != "week" && request.Category != "day" && request.Category != "month" { + err = errors.New("参数Category错误不支持") + return + } + if len(request.GroupByFields) != 0 { + for _, field := range request.GroupByFields { + _, ok := order.WhitelistFields[field] + if !ok { + err = errors.New("包含不支持的字段") + return + } + } + } + return +} diff --git a/pkg/dto/request/GetSkillSkuListH5Request.go b/pkg/dto/request/GetSkillSkuListH5Request.go new file mode 100644 index 0000000..2e49fde --- /dev/null +++ b/pkg/dto/request/GetSkillSkuListH5Request.go @@ -0,0 +1,27 @@ +package request + +import "errors" + +type GetSkillSkuListRequestH5 struct { + AccessToken string + SkillId string + ShortName string + SortBy string // 排序 1=智能 2=最新 3=人气 + Gender string // 性别 0=女 1=男 ""=不限 + Online string // 在线 1=在线 ""=不限 + Area string // 分区 + SkillLevel string // 技能等级 ""=不限 + AnchorId string // 分页锚点ID + PageSize string +} + +// 参数合法性检验 +func (request *GetSkillSkuListRequestH5) CheckParameter() (err error) { + + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetSkillSkuListRequest.go b/pkg/dto/request/GetSkillSkuListRequest.go new file mode 100644 index 0000000..35214d6 --- /dev/null +++ b/pkg/dto/request/GetSkillSkuListRequest.go @@ -0,0 +1,56 @@ +package request + +import "errors" + +type GetSkillSkuListRequest struct { + AccessToken string + GuildId string + SkillId string + SortBy string // 排序 1=智能 2=最新 3=人气 4=附近 + Gender string // 性别 0=女 1=男 ""=不限 + Online string // 在线 1=在线 ""=不限 + PriceOrder string // 价格 1=升序 2=降序 否则不排序 + Area string // 分区 + SkillMode string // 技能玩法 ""=不限 + SkillLevel string // 技能等级 ""=不限 + AnchorId string // 分页锚点ID + OrderStatus string // 陪玩状态 idle=空闲 accepting=接单中 + PageSize string + Key string +} + +// 参数合法性检验 +func (request *GetSkillSkuListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + // if len(request.SkillId) == 0 { + // err = errors.New("SkillId不能为空") + // return + // } + + return +} + +type SearchSkillSkuListRequest struct { + AccessToken string + GuildId string + Key string + AnchorId string + PageSize string +} + +// 参数合法性检验 +func (request *SearchSkillSkuListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.PageSize) == 0 { + request.PageSize = "20" + } + return +} diff --git a/pkg/dto/request/GetSkillUserListRequest.go b/pkg/dto/request/GetSkillUserListRequest.go new file mode 100644 index 0000000..989d07d --- /dev/null +++ b/pkg/dto/request/GetSkillUserListRequest.go @@ -0,0 +1,37 @@ +package request + +import "errors" + +// 分页获取资质列表数据 +type GetSkillUserListRequest struct { + AccessToken string + SkillId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetSkillUserListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.SkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetTimelineByCategoryRequest.go b/pkg/dto/request/GetTimelineByCategoryRequest.go new file mode 100644 index 0000000..be65042 --- /dev/null +++ b/pkg/dto/request/GetTimelineByCategoryRequest.go @@ -0,0 +1,33 @@ +package request + +import "errors" + +type GetTimelineByCategoryRequest struct { + BaseRequest + CategoryId string + PageNo string + PageSize string + Lat string + Lng string +} + +// 获取用户动态 +func (request *GetTimelineByCategoryRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.CategoryId) == 0 { + err = errors.New("CategoryId不能为空") + return + } + if len(request.PageSize) == 0 || len(request.PageNo) == 0 { + err = errors.New("PageNo或PageSize不能为空") + return + } + return +} + +type GetTimelineNewCntFollowRequest struct { + BaseRequest +} diff --git a/pkg/dto/request/GetTimelineReplyChildrenRequest.go b/pkg/dto/request/GetTimelineReplyChildrenRequest.go new file mode 100644 index 0000000..af59a92 --- /dev/null +++ b/pkg/dto/request/GetTimelineReplyChildrenRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +type GetTimelineReplyChildrenRequest struct { + BaseRequest + ReplyId string + PageNo string + PageSize string +} + +// 获取用户动态 +func (request *GetTimelineReplyChildrenRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ReplyId) == 0 { + err = errors.New("ReplyId不能为空") + return + } + + if len(request.PageSize) == 0 || len(request.PageNo) == 0 { + err = errors.New("PageNo或PageSize不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetTimelineReplyListRequest.go b/pkg/dto/request/GetTimelineReplyListRequest.go new file mode 100644 index 0000000..eecc565 --- /dev/null +++ b/pkg/dto/request/GetTimelineReplyListRequest.go @@ -0,0 +1,26 @@ +package request + +import "errors" + +type GetTimelineReplyListRequest struct { + BaseRequest + TimelineId string + PageNo string + PageSize string +} + +// 获取用户动态 +func (request *GetTimelineReplyListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserAccountRequest.go b/pkg/dto/request/GetUserAccountRequest.go new file mode 100644 index 0000000..008fd2d --- /dev/null +++ b/pkg/dto/request/GetUserAccountRequest.go @@ -0,0 +1,18 @@ +package request + +import "errors" + +type GetUserAccountRequest struct { + BaseRequest +} + +// 参数合法性检验 +func (request *GetUserAccountRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserChatroomRequest.go b/pkg/dto/request/GetUserChatroomRequest.go new file mode 100644 index 0000000..7980399 --- /dev/null +++ b/pkg/dto/request/GetUserChatroomRequest.go @@ -0,0 +1,20 @@ +package request + +import "errors" + +type GetUserChatroomRequest struct { + AccessToken string + TargetUserId string // 获取哪个用户的 获取自己的不传 + +} + +// 参数合法性检验 +func (request *GetUserChatroomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserDetailRequest.go b/pkg/dto/request/GetUserDetailRequest.go new file mode 100644 index 0000000..8d2522f --- /dev/null +++ b/pkg/dto/request/GetUserDetailRequest.go @@ -0,0 +1,56 @@ +package request + +import "errors" + +type GetUserDetailRequest struct { + BaseGuildRequest + GuildId string + TargetUserId string +} + +// 注册用户信息签名验证 +func (request *GetUserDetailRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + if len(request.GuildId) == 0 { + request.GuildId = "-1" + } + + return +} + +type GetCreateOrderRequest struct { + BaseRequest + TargetUserId string + UserSkillId string +} + +// 注册用户信息签名验证 +func (request *GetCreateOrderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("技能ID不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserDiamondJournalRequest.go b/pkg/dto/request/GetUserDiamondJournalRequest.go new file mode 100644 index 0000000..3ddcea9 --- /dev/null +++ b/pkg/dto/request/GetUserDiamondJournalRequest.go @@ -0,0 +1,38 @@ +package request + +import "errors" + +type GetUserDiamondJournalRequest struct { + BaseRequest + ActionType string //1=收入 2=支出 + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetUserDiamondJournalRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + if len(request.ActionType) > 0 { + if request.ActionType != "1" && request.ActionType != "2" { + err = errors.New("ActionType参数错误") + return + } + } + + return +} diff --git a/pkg/dto/request/GetUserGuardSeatRequest.go b/pkg/dto/request/GetUserGuardSeatRequest.go new file mode 100644 index 0000000..ea8ca2b --- /dev/null +++ b/pkg/dto/request/GetUserGuardSeatRequest.go @@ -0,0 +1,27 @@ +package request + +import ( + "errors" +) + +// 购买聊天室表情 +type GetUserGuardSeatRequest struct { + AccessToken string + HostUserId string +} + +// 参数合法性检验 +func (request *GetUserGuardSeatRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.HostUserId) == 0 { + err = errors.New("HostUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserSkillDetailH5Request.go b/pkg/dto/request/GetUserSkillDetailH5Request.go new file mode 100644 index 0000000..ffd7512 --- /dev/null +++ b/pkg/dto/request/GetUserSkillDetailH5Request.go @@ -0,0 +1,19 @@ +package request + +import "errors" + +type GetUserSkillDetailH5Request struct { + AccessToken string + UserSkillId string +} + +// 参数合法性检验 +func (request *GetUserSkillDetailH5Request) CheckParameter() (err error) { + + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserSkillDetailRequest.go b/pkg/dto/request/GetUserSkillDetailRequest.go new file mode 100644 index 0000000..2f4a4ca --- /dev/null +++ b/pkg/dto/request/GetUserSkillDetailRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type GetUserSkillDetailRequest struct { + AccessToken string + UserSkillId string +} + +// 参数合法性检验 +func (request *GetUserSkillDetailRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserSkillRateListH5Request.go b/pkg/dto/request/GetUserSkillRateListH5Request.go new file mode 100644 index 0000000..b9f0342 --- /dev/null +++ b/pkg/dto/request/GetUserSkillRateListH5Request.go @@ -0,0 +1,21 @@ +package request + +import "errors" + +type GetUserSkillRateListH5Request struct { + AccessToken string + UserSkillId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetUserSkillRateListH5Request) CheckParameter() (err error) { + + if len(request.UserSkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserSkillRateListRequest.go b/pkg/dto/request/GetUserSkillRateListRequest.go new file mode 100644 index 0000000..be38617 --- /dev/null +++ b/pkg/dto/request/GetUserSkillRateListRequest.go @@ -0,0 +1,45 @@ +package request + +import "errors" + +type GetUserSkillRateListRequest struct { + AccessToken string + UserSkillId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetUserSkillRateListRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + return +} + +type GetUserSkillRateListByUserIDRequest struct { + AccessToken string + UserId string + PageNo string + PageSize string +} + +// 参数合法性检验 +func (request *GetUserSkillRateListByUserIDRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserId) == 0 { + err = errors.New("用户ID不能为空") + return + } + return +} diff --git a/pkg/dto/request/GetUserStoreModelRequest.go b/pkg/dto/request/GetUserStoreModelRequest.go new file mode 100644 index 0000000..10b7f09 --- /dev/null +++ b/pkg/dto/request/GetUserStoreModelRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type GetUserStoreModelRequest struct { + AccessToken string + GoodsId string + WithProp string +} + +// 参数合法性检验 +func (request *GetUserStoreModelRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.GoodsId) == 0 { + err = errors.New("GoodsId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserTimelineRequest.go b/pkg/dto/request/GetUserTimelineRequest.go new file mode 100644 index 0000000..30acb17 --- /dev/null +++ b/pkg/dto/request/GetUserTimelineRequest.go @@ -0,0 +1,26 @@ +package request + +import "errors" + +type GetUserTimelineRequest struct { + BaseRequest + TargetUserId string + PageNo string + PageSize string +} + +// 获取用户动态 +func (request *GetUserTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GetUserVisitLogRequest.go b/pkg/dto/request/GetUserVisitLogRequest.go new file mode 100644 index 0000000..62619ee --- /dev/null +++ b/pkg/dto/request/GetUserVisitLogRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type GetUserVisitLogRequest struct { + BaseRequest + AnchorId string + PageSize string +} + +// 签名验证 +func (request *GetUserVisitLogRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + + return +} diff --git a/pkg/dto/request/GoodsExchangeRequest.go b/pkg/dto/request/GoodsExchangeRequest.go new file mode 100644 index 0000000..ae8f849 --- /dev/null +++ b/pkg/dto/request/GoodsExchangeRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 物品兑换 +type GoodsExchangeRequest struct { + AccessToken string + ConfigId string + TargetCount string +} + +// 参数合法性检验 +func (request *GoodsExchangeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ConfigId) == 0 { + err = errors.New("ConfigId不能为空") + return + } + + if len(request.TargetCount) == 0 { + err = errors.New("TargetCount不能为空") + return + } + + return +} diff --git a/pkg/dto/request/Guild.go b/pkg/dto/request/Guild.go new file mode 100644 index 0000000..661003f --- /dev/null +++ b/pkg/dto/request/Guild.go @@ -0,0 +1,16 @@ +package request + +type GuildPageReq struct { + BasePageReq + SkillId string + Key string + SelfOperated string +} + +func (d *GuildPageReq) Check() (e error) { + d.BasePageReq.Check() + if err := d.BasePageReq.BaseRequest.CheckParameter(); err != nil { + return err + } + return +} diff --git a/pkg/dto/request/HeaderModel.go b/pkg/dto/request/HeaderModel.go new file mode 100644 index 0000000..4cf708f --- /dev/null +++ b/pkg/dto/request/HeaderModel.go @@ -0,0 +1,31 @@ +package request + +import "github.com/anxpp/beego/context" + +type HeaderModel struct { + ClientVersion string + DeviceId string + Platform string + MarketChannel string + DeviceModel string + TimeStamp string + BundleId string + OsVersion string + ApiVersionNum string +} + +func GetHeaderModel(ctx *context.Context) HeaderModel { + + model := HeaderModel{} + model.ClientVersion = ctx.Input.Header("ClientVersion") + model.DeviceId = ctx.Input.Header("DeviceId") + model.Platform = ctx.Input.Header("Platform") + model.MarketChannel = ctx.Input.Header("MarketChannel") + model.DeviceModel = ctx.Input.Header("DeviceModel") + model.BundleId = ctx.Input.Header("BundleId") + model.OsVersion = ctx.Input.Header("OsVersion") + model.ApiVersionNum = ctx.Input.Header("ApiVersionNum") + model.TimeStamp = ctx.Input.Header("TimeStamp") + + return model +} diff --git a/pkg/dto/request/HitEggRequest.go b/pkg/dto/request/HitEggRequest.go new file mode 100644 index 0000000..69a7934 --- /dev/null +++ b/pkg/dto/request/HitEggRequest.go @@ -0,0 +1,31 @@ +package request + +import ( + "errors" +) + +type HitEggRequest struct { + BaseRequest + HitCount string +} + +// 签名验证 +func (request *HitEggRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.HitCount) == 0 { + err = errors.New("HitCount不能为空") + return + } + + if request.HitCount != "1" && request.HitCount != "10" && request.HitCount != "100" { + err = errors.New("HitCount非法") + return + } + + return +} diff --git a/pkg/dto/request/LeaveRoomRequest.go b/pkg/dto/request/LeaveRoomRequest.go new file mode 100644 index 0000000..068b7ee --- /dev/null +++ b/pkg/dto/request/LeaveRoomRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type LeaveRoomRequest struct { + BaseRequest + ChatroomId string +} + +// 参数合法性检验 +func (request *LeaveRoomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/NoticeRequest.go b/pkg/dto/request/NoticeRequest.go new file mode 100644 index 0000000..0eeb6f8 --- /dev/null +++ b/pkg/dto/request/NoticeRequest.go @@ -0,0 +1,51 @@ +package request + +import "errors" + +type NoticeListRequest struct { + AccessToken string + GuildId string + Page string // + Size string // + +} + +// 参数合法性检验 +func (request *NoticeListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Page) == 0 { + err = errors.New("页码不能为空") + return + } + if len(request.Size) == 0 { + err = errors.New("页大小不能为空") + return + } + return +} + +type NoticeDetailRequest struct { + AccessToken string + GuildId string + Id string +} + +// 参数合法性检验 +func (request *NoticeDetailRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Id) == 0 { + err = errors.New("id不能为空") + return + } + return +} diff --git a/pkg/dto/request/OpenRoomRequest.go b/pkg/dto/request/OpenRoomRequest.go new file mode 100644 index 0000000..b97343d --- /dev/null +++ b/pkg/dto/request/OpenRoomRequest.go @@ -0,0 +1,135 @@ +package request + +import ( + "errors" +) + +type CreateTalkRoomRequest struct { + BaseRequest + RootId string + RoomName string +} + +// 参数合法性检验 +func (request *CreateTalkRoomRequest) CheckParameter() (err error) { + if len(request.RootId) == 0 { + return errors.New("RootId 不能为空") + } + if len(request.RoomName) == 0 { + return errors.New("RoomName 不能为空") + } + if request.AccessToken != "admin_inner_client" { + return errors.New("AccessToken 不能为空") + } + return +} + +type OpenRoomRequest struct { + BaseRequest + UserId string + RoomName string + TabId string // 聊天室分类ID + RoomAvatar string // 房间头像 +} + +// 参数合法性检验 +func (request *OpenRoomRequest) CheckParameter() (err error) { + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + return +} + +type InnerOpenRoomRequest struct { + OpenRoomRequest + GuildId string +} + +type CreateRoomGroupRequest struct { + BaseRequest + Name string + Comment string + SortNo string + RootChatroomId string // 根房间ID + ParentChatroomId string // 父房间ID +} + +// 参数合法性检验 +func (request *CreateRoomGroupRequest) CheckParameter() (err error) { + if len(request.RootChatroomId) == 0 { + request.RootChatroomId = request.ParentChatroomId + } + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.Name) == 0 { + err = errors.New("Name不能为空") + return + } + if len(request.ParentChatroomId) == 0 { + err = errors.New("ParentChatroomId不能为空") + return + } + return +} + +type UpdateRoomGroupRequest struct { + BaseRequest + GroupId string + Name string + Comment string + SortNo string +} + +// 参数合法性检验 +func (request *UpdateRoomGroupRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.Name) == 0 { + err = errors.New("Name不能为空") + return + } + return +} + +type CreateChildRoomRequest struct { + BaseRequest + RoomName string + GroupId string // 分组ID + RootChatroomId string // 根房间ID + ParentChatroomId string // 父房间ID + TemplateId string // 模板ID +} + +// 参数合法性检验 +func (request *CreateChildRoomRequest) CheckParameter() (err error) { + if len(request.RootChatroomId) == 0 { + request.RootChatroomId = request.ParentChatroomId + } + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.RoomName) == 0 { + err = errors.New("RoomName不能为空") + return + } + if len(request.ParentChatroomId) == 0 { + err = errors.New("ParentChatroomId不能为空") + return + } + + if len(request.TemplateId) > 0 { + if request.TemplateId != "5007" && request.TemplateId != "5008" { + err = errors.New("模板ID不合法") + return + } + + } + + return +} diff --git a/pkg/dto/request/PraiseReplyRequest.go b/pkg/dto/request/PraiseReplyRequest.go new file mode 100644 index 0000000..e1d69f5 --- /dev/null +++ b/pkg/dto/request/PraiseReplyRequest.go @@ -0,0 +1,56 @@ +package request + +import "errors" + +type PraiseReplyRequest struct { + BaseRequest + ReplyId string +} + +// 参数合法性检验 +func (request *PraiseReplyRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ReplyId) == 0 { + err = errors.New("ReplyId不能为空") + return + } + + return +} + +// 设置推荐状态 +type SetTimelineRecommandStatusRequest struct { + BaseRequest + TimelineId string + RecommandStatus string // 1=上热门 0=下热门 +} + +// 参数合法性检验 +func (request *SetTimelineRecommandStatusRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("动态ID不能为空") + return + } + if len(request.RecommandStatus) == 0 { + err = errors.New("缺少状态参数") + return + } + + if request.RecommandStatus != "0" && request.RecommandStatus != "1" { + err = errors.New("状态参数错误") + return + } + + return +} diff --git a/pkg/dto/request/PresentActivityGiftFromChatRoomRequest.go b/pkg/dto/request/PresentActivityGiftFromChatRoomRequest.go new file mode 100644 index 0000000..ff5da5e --- /dev/null +++ b/pkg/dto/request/PresentActivityGiftFromChatRoomRequest.go @@ -0,0 +1,65 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" +) + +// 聊天室赠送活动礼物的请求 +type PresentActivityGiftFromChatRoomRequest struct { + BaseRequest + ChatroomId string + ReceiveUserIds string // 赠送的目标用户ID列表,json字符串数组 + Count string // 礼物数量 + ActId string + ActPrice string + HostUserId string // 主持人ID + IsBatch string // 0=打赏个人 1= 打赏全麦 +} + +// 注册用户信息签名验证 +func (request *PresentActivityGiftFromChatRoomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomRoomId不能为空") + return + } + + if len(request.ReceiveUserIds) == 0 { + err = errors.New("ReceiveUserIds不能为空") + return + } + + if len(request.Count) == 0 { + err = errors.New("Count不能为空") + return + } + + if len(request.ActId) == 0 { + err = errors.New("ActId不能为空") + return + } + + if len(request.IsBatch) == 0 { + err = errors.New("IsBatch不能为空") + return + } + + if request.IsBatch != "0" && request.IsBatch != "1" { + err = errors.New("IsBatch只能是0或1") + return + } + + if HyTools.StringToInt(request.ActPrice) <= 0 { + err = errors.New("ActPrice不合法") + return + } + + return +} diff --git a/pkg/dto/request/PresentGiftFromChatRoomRequest.go b/pkg/dto/request/PresentGiftFromChatRoomRequest.go new file mode 100644 index 0000000..eaec4aa --- /dev/null +++ b/pkg/dto/request/PresentGiftFromChatRoomRequest.go @@ -0,0 +1,172 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// PresentGiftFromChatRoomRequest 聊天室打赏的请求 +type PresentGiftFromChatRoomRequest struct { + BaseRequest + ChatroomId string + ReceiveUserId string + ReceiveUserIds string // 打赏全麦的用户ID + GiftCount string // 礼物数量 + GiftId string + GiftDiamond string + HostUserId string // 主持人ID + IsBatch string // 0=打赏个人 1= 打赏全麦 + BoxId string // 背包ID + IsFromGiftBox string // 是否从礼物盒打赏 +} + +// 注册用户信息签名验证 +func (request *PresentGiftFromChatRoomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomRoomId不能为空") + return + } + + if len(request.GiftId) == 0 { + err = errors.New("GiftId不能为空") + return + } + if len(request.GiftDiamond) == 0 { + err = errors.New("GiftDiamond不能为空") + return + } + + if len(request.GiftCount) == 0 { + err = errors.New("GiftCount不能为空") + return + } + + if len(request.IsBatch) == 0 { + err = errors.New("IsBatch不能为空") + return + } + + if request.IsBatch != "0" && request.IsBatch != "1" { + err = errors.New("IsBatch只能是0或1") + return + } + /* + if request.IsBatch == "0"{ + if len(request.ReceiveUserId) == 0 { + err = errors.New("ReceiveUserId不能为空") + return + } + }else if request.IsBatch == "1"{ + if len(request.ReceiveUserIds) == 0 { + err = errors.New("ReceiveUserIds不能为空") + return + } + }*/ + + if htools.StringToInt(request.GiftDiamond) < 0 { + err = errors.New("GiftDiamond不合法") + return + } + + if htools.StringToInt(request.GiftCount) <= 0 { + err = errors.New("GiftCount不合法") + return + } + + if request.IsFromGiftBox == "1" { + if len(request.BoxId) == 0 { + err = errors.New("背包礼物打赏缺少BoxId") + return + } + } + + return +} + +// 动态/消息 打赏 +type PresentGiftRequest struct { + BaseRequest + FromType string // IM TIMELINE + TimelineId string + TargetUserId string + GiftCount string // 礼物数量 + GiftId string + BoxId string // 背包ID + IsFromGiftBox string // 是否从礼物盒打赏 +} + +// 注册用户信息签名验证 +func (request *PresentGiftRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.FromType) == 0 { + err = errors.New("打赏方式不能为空") + return + } + if len(request.GiftId) == 0 { + err = errors.New("GiftId不能为空") + return + } + + if len(request.GiftCount) == 0 { + err = errors.New("GiftCount不能为空") + return + } + + if htools.StringToInt(request.GiftCount) <= 0 { + err = errors.New("GiftCount不合法") + return + } + + if request.IsFromGiftBox == "1" { + if len(request.BoxId) == 0 { + err = errors.New("背包礼物打赏缺少BoxId") + return + } + } + + if request.FromType == "IM" && len(request.TargetUserId) == 0 { + err = errors.New("消息打赏缺少目标用户") + return + } + + if request.FromType == "TIMELINE" && len(request.TimelineId) == 0 { + err = errors.New("动态打赏缺少动态ID") + return + } + + return +} + +// 获取动态打赏列表 +type GetTimelinePresentListRequest struct { + BaseRequest + TimelineId string + AnchorId string +} + +// 获取动态打赏列表 +func (request *GetTimelinePresentListRequest) GetTimelinePresentListRequest() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("缺少动态ID") + return + } + + return +} diff --git a/pkg/dto/request/RefreshAccessTokenRequest.go b/pkg/dto/request/RefreshAccessTokenRequest.go new file mode 100644 index 0000000..a86d72c --- /dev/null +++ b/pkg/dto/request/RefreshAccessTokenRequest.go @@ -0,0 +1,18 @@ +package request + +import "errors" + +type RefreshAccessTokenRequest struct { + BaseRequest +} + +// 注册用户信息签名验证 +func (request *RefreshAccessTokenRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/RefundReq.go b/pkg/dto/request/RefundReq.go new file mode 100644 index 0000000..ea5e87a --- /dev/null +++ b/pkg/dto/request/RefundReq.go @@ -0,0 +1,30 @@ +package request + +import "github.com/shopspring/decimal" + +const ( + WxPayChannelCode = "WxPay" + AlipayChannelCode = "AliPay" +) + +type RefundReq[T any] struct { + TransactionId string // 支付单号 + OutTransactionId string // DD game内部唯一支付单号 + OutRefundNo string // 退款单号,DD Game内部退款唯一单号 + Reason string // 退款原因 1、该退款原因参数的长度不得超过80个字节;2、当订单退款金额小于等于1元且为部分退款时,退款原因将不会在消息中体现。 + RefundDetail T + ChannelCode string //渠道 Code WxPay|AliPay +} + +type AliPayRefund struct { + RefundAmount decimal.Decimal // 退款金额,alipay单位是元(两位小数),此处统一成分 +} + +type WxPayRefund struct { + RefundAmount decimal.Decimal // 退款金额,wx单位是分,alipay单位是元(两位小数),此处统一成分 + PayAmount decimal.Decimal // 原支付订单的金额 +} + +func (req *RefundReq[T]) CheckParameter() (err error) { + return nil +} diff --git a/pkg/dto/request/RelationCancelRequest.go b/pkg/dto/request/RelationCancelRequest.go new file mode 100644 index 0000000..ffc04a9 --- /dev/null +++ b/pkg/dto/request/RelationCancelRequest.go @@ -0,0 +1,22 @@ +package request + +import "errors" + +type RelationCancelRequest struct { + BaseRequest + UserRelationId string + Message string +} + +// 参数合法性检验 +func (request *RelationCancelRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken 不能为空") + return + } + if len(request.UserRelationId) == 0 { + err = errors.New("RelationId 不能为空") + return + } + return +} diff --git a/pkg/dto/request/RelationGiftRequest.go b/pkg/dto/request/RelationGiftRequest.go new file mode 100644 index 0000000..0a6ef57 --- /dev/null +++ b/pkg/dto/request/RelationGiftRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +type RelationGiftRequest struct { + BaseRequest + TargetUserId string + UserStoreId string + Count string +} + +// 参数合法性检验 +func (request *RelationGiftRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken 不能为空 ") + return + } + if len(request.Count) == 0 { + err = errors.New("Count 不能为空 ") + return + } + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId 不能为空 ") + return + } + if len(request.UserStoreId) == 0 { + err = errors.New("UserStoreId 不能为空 ") + return + } + return +} diff --git a/pkg/dto/request/RelationInviteApplyRequest.go b/pkg/dto/request/RelationInviteApplyRequest.go new file mode 100644 index 0000000..4031434 --- /dev/null +++ b/pkg/dto/request/RelationInviteApplyRequest.go @@ -0,0 +1,21 @@ +package request + +import "errors" + +type RelationInviteApplyRequest struct { + BaseRequest + ApplyId string +} + +// 参数合法性检验 +func (request *RelationInviteApplyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken 不能为空") + return + } + if len(request.ApplyId) == 0 { + err = errors.New("ApplyId 不能为空") + return + } + return +} diff --git a/pkg/dto/request/RelationInviteRequest.go b/pkg/dto/request/RelationInviteRequest.go new file mode 100644 index 0000000..6bac04b --- /dev/null +++ b/pkg/dto/request/RelationInviteRequest.go @@ -0,0 +1,27 @@ +package request + +import "errors" + +type RelationInviteRequest struct { + BaseRequest + RelationId string + TargetUserId string + Message string +} + +// 参数合法性检验 +func (request *RelationInviteRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken 不能为空") + return + } + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId 不能为空") + return + } + if len(request.RelationId) == 0 { + err = errors.New("RelationId 不能为空") + return + } + return +} diff --git a/pkg/dto/request/RemoveFromBlackListRequest.go b/pkg/dto/request/RemoveFromBlackListRequest.go new file mode 100644 index 0000000..884557d --- /dev/null +++ b/pkg/dto/request/RemoveFromBlackListRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type RemoveFromBlackListRequest struct { + BaseRequest + TargetUserId string +} + +// 参数合法性检验 +func (request *RemoveFromBlackListRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ReplyTimelineRequest.go b/pkg/dto/request/ReplyTimelineRequest.go new file mode 100644 index 0000000..b4fa825 --- /dev/null +++ b/pkg/dto/request/ReplyTimelineRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +type ReplyTimelineRequest struct { + BaseRequest + TimelineId string + ToReplyId string + ReplyContent string +} + +// 参数合法性检验 +func (request *ReplyTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TimelineId) == 0 { + err = errors.New("TimelineId不能为空") + return + } + + if len(request.ReplyContent) == 0 { + err = errors.New("ReplyText不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ReportChatroomRequest.go b/pkg/dto/request/ReportChatroomRequest.go new file mode 100644 index 0000000..607f1e7 --- /dev/null +++ b/pkg/dto/request/ReportChatroomRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +type ReportChatroomRequest struct { + BaseRequest + ChatroomId string + Reason string // 举报原因 + PicUrls string + ContentExt string +} + +// 参数合法性检验 +func (request *ReportChatroomRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.Reason) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ReportTimelineRequest.go b/pkg/dto/request/ReportTimelineRequest.go new file mode 100644 index 0000000..84defde --- /dev/null +++ b/pkg/dto/request/ReportTimelineRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +type ReportTimelineRequest struct { + BaseRequest + TargetTimelineId string + Reason string // 举报原因 + ContentExt string + PicUrls string //json字符串 +} + +// 参数合法性检验 +func (request *ReportTimelineRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetTimelineId) == 0 { + err = errors.New("TargetTimelineId不能为空") + return + } + + if len(request.Reason) == 0 { + err = errors.New("Reason不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ReportUserRequest.go b/pkg/dto/request/ReportUserRequest.go new file mode 100644 index 0000000..1398548 --- /dev/null +++ b/pkg/dto/request/ReportUserRequest.go @@ -0,0 +1,125 @@ +package request + +import "errors" + +type ReportUserRequest struct { + BaseRequest + TargetUserId string + Reason string // 举报原因 + PicUrls string + ContentExt string +} + +// 参数合法性检验 +func (request *ReportUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + if len(request.Reason) == 0 { + err = errors.New("Reason不能为空") + return + } + + return +} + +type UserTicketRequest struct { + BaseRequest + TicketType string // 工单类型 + ComplaintType string // 投诉类型 + TargetUserId string // 目标用户ID + OrderNo string // 关联订单号 + Title string // 标题 + Reason string // 售后原因 + Content string // 内容 + PicUrls string // 图片链接,逗号分隔 +} + +// 参数合法性检验 +func (request *UserTicketRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.TicketType) == 0 { + err = errors.New("TicketType不能为空") + return + } + if len(request.TicketType) == 0 { + err = errors.New("Title不能为空") + return + } + return +} + +type UserReplyTicketRequest struct { + BaseRequest + TicketId string // 工单ID + Content string // 内容 + PicUrls string // 图片链接,逗号分隔 +} + +// 参数合法性检验 +func (request *UserReplyTicketRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.Content) == 0 && len(request.PicUrls) == 0 { + err = errors.New("内容不能为空") + return + } + return +} + +type GetUserTicketPage struct { + BaseRequest + TicketType string // 工单类型 complaint=投诉 suggestion=建议 + PageNo string // 页码 + PageSize string // 页长 +} + +// 参数合法性检验 +func (request *GetUserTicketPage) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.PageNo) == 0 { + err = errors.New("PageNo不能为空") + return + } + if len(request.PageSize) == 0 { + err = errors.New("PageSize不能为空") + return + } + return +} + +type GetUserTicketDetail struct { + BaseRequest + TicketId string +} + +// 参数合法性检验 +func (request *GetUserTicketDetail) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.TicketId) == 0 { + err = errors.New("TicketId不能为空") + return + } + return +} diff --git a/pkg/dto/request/ResetPasswordRequest.go b/pkg/dto/request/ResetPasswordRequest.go new file mode 100644 index 0000000..8544504 --- /dev/null +++ b/pkg/dto/request/ResetPasswordRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type ResetPasswordRequest struct { + Mobile string + Vericode string + NewPassword string +} + +// 签名验证 +func (request *ResetPasswordRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + + if len(request.Vericode) == 0 { + err = errors.New("Vericode不能为空") + return + } + + if len(request.NewPassword) == 0 { + err = errors.New("NewPassword不能为空") + return + } + + return +} diff --git a/pkg/dto/request/RevenueExchangeDiamondRequest.go b/pkg/dto/request/RevenueExchangeDiamondRequest.go new file mode 100644 index 0000000..86de288 --- /dev/null +++ b/pkg/dto/request/RevenueExchangeDiamondRequest.go @@ -0,0 +1,31 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// RevenueExchangeDiamondRequest 魅力值兑换钻石请求 +type RevenueExchangeDiamondRequest struct { + AccessToken string + FromAmountType string + ToAmountType string + RevenueAmount string +} + +// CheckParameter 参数合法性检验 +func (request *RevenueExchangeDiamondRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + return errors.New("AccessToken不能为空") + } + if len(request.RevenueAmount) == 0 { + return errors.New("PageNo不能为空") + } + revenueInt := htools.StringToInt(request.RevenueAmount) + // 最多每次兑换500000 + if revenueInt <= 0 || revenueInt > 1000000 { + return errors.New("参数不合法") + } + return +} diff --git a/pkg/dto/request/RichRequest.go b/pkg/dto/request/RichRequest.go new file mode 100644 index 0000000..e9b1fd3 --- /dev/null +++ b/pkg/dto/request/RichRequest.go @@ -0,0 +1,27 @@ +package request + +type RichRequest struct { + BasePageRequest + GuildId string +} + +func (r *RichRequest) CheckParameter() (err error) { + err = r.BasePageRequest.CheckParameter() + if err != nil { + return err + } + return +} + +type PopularityRequest struct { + BasePageRequest + GuildId string +} + +func (r *PopularityRequest) CheckParameter() (err error) { + err = r.BasePageRequest.CheckParameter() + if err != nil { + return err + } + return +} diff --git a/pkg/dto/request/SearchFollowUserRequest.go b/pkg/dto/request/SearchFollowUserRequest.go new file mode 100644 index 0000000..87ecb49 --- /dev/null +++ b/pkg/dto/request/SearchFollowUserRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type SearchFollowUserRequest struct { + BaseRequest + Keyword string +} + +// 参数合法性检验 +func (request *SearchFollowUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Keyword) == 0 { + err = errors.New("Keyword不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SearchUserByUserNoRequest.go b/pkg/dto/request/SearchUserByUserNoRequest.go new file mode 100644 index 0000000..130b116 --- /dev/null +++ b/pkg/dto/request/SearchUserByUserNoRequest.go @@ -0,0 +1,47 @@ +package request + +import "errors" + +type SearchRequest struct { + BaseRequest + InputNo string +} + +// 参数合法性检验 +func (request *SearchRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.InputNo) == 0 { + err = errors.New("InputNo不能为空") + return + } + + return +} + +// 新搜索对象 +type SearchV2Request struct { + BaseRequest + Keyword string // 关键词 + TypeCode string // 搜索类型 1=人 2=聊天室 +} + +// 参数合法性检验 +func (request *SearchV2Request) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Keyword) == 0 { + err = errors.New("InputNo不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SearchUserRequest.go b/pkg/dto/request/SearchUserRequest.go new file mode 100644 index 0000000..07bd829 --- /dev/null +++ b/pkg/dto/request/SearchUserRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 搜索用户请求 +type SearchUserRequest struct { + BaseRequest + TypeCode string + Keyword string +} + +// 参数合法性检验 +func (request *SearchUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TypeCode) == 0 { + err = errors.New("TypeCode不能为空") + return + } + + if len(request.Keyword) == 0 { + err = errors.New("Keyword不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SendMobileCodeRequest.go b/pkg/dto/request/SendMobileCodeRequest.go new file mode 100644 index 0000000..2bff091 --- /dev/null +++ b/pkg/dto/request/SendMobileCodeRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +// 验证码类型 + +type SendMobileCodeRequest struct { + Mobile string + CodeType string + StaffId string +} + +// 注册用户信息签名验证 +func (request *SendMobileCodeRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("Mobile 不能为空 ") + return + } + + if len(request.CodeType) == 0 { + err = errors.New("CodeType 不能为空 ") + return + } + + if len(request.StaffId) == 0 { + err = errors.New("StaffId 不能为空 ") + return + } + + return +} diff --git a/pkg/dto/request/SendVericodeRequest.go b/pkg/dto/request/SendVericodeRequest.go new file mode 100644 index 0000000..3cd9e18 --- /dev/null +++ b/pkg/dto/request/SendVericodeRequest.go @@ -0,0 +1,51 @@ +package request + +import "errors" + +// 验证码类型 +const ( + VERICODE_TYPE_SIGN_IN = "1" // 登录验证码 + VERICODE_TYPE_CHANGE_PASSWORD = "2" // 修改密码验证码 + VERICODE_TYPE_UPDATE_MOBILE = "3" // 修改手机号的类型 + VERICODE_TYPE_SIGN_UP = "4" // 注册验证码 + VERICODE_TYPE_FORGOT_PASSWORD = "5" // 忘记密码 + VERICODE_TYPE_BIND_BANK_CARD = "6" // 绑定银行卡 + VERICODE_TYPE_FIRST_TIME_BIND_MOBILE = "7" // 第一次绑定手机号 + VERICODE_TYPE_DELETE_USER = "8" // 注销帐号 + VERICODE_TYPE_STAFF_LOGIN = "9" // 员工登录后台 +) + +type SendVericodeRequest struct { + RegionCode string + Mobile string + BizType string + AccessToken string + Validate string +} + +// 注册用户信息签名验证 +func (request *SendVericodeRequest) CheckParameter() (err error) { + + if len(request.BizType) == 0 { + err = errors.New("BizType不能为空") + return + } + + // 绑定银行卡传accesstoken + if request.BizType == VERICODE_TYPE_BIND_BANK_CARD { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + } else { + + if len(request.Mobile) == 0 { + err = errors.New("手机号不能为空") + return + } + } + + return +} diff --git a/pkg/dto/request/SetChatroomAdminUserRequest.go b/pkg/dto/request/SetChatroomAdminUserRequest.go new file mode 100644 index 0000000..a3cd81d --- /dev/null +++ b/pkg/dto/request/SetChatroomAdminUserRequest.go @@ -0,0 +1,42 @@ +package request + +import "errors" + +type SetChatroomAdminUserRequest struct { + BaseRequest + ChatroomId string + UserId string + ActionType string // 1= 设置管理员 0=取消管理员 + +} + +// 注册用户信息签名验证 +func (request *SetChatroomAdminUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + if len(request.ActionType) == 0 { + err = errors.New("ActionType不能为空") + return + } + + if request.ActionType != "0" && request.ActionType != "1" && request.ActionType != "2" { + err = errors.New("ActionType无效") + return + } + + return +} diff --git a/pkg/dto/request/SetChatroomBlackUserRequest.go b/pkg/dto/request/SetChatroomBlackUserRequest.go new file mode 100644 index 0000000..17041f8 --- /dev/null +++ b/pkg/dto/request/SetChatroomBlackUserRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +type SetChatroomBlackUserRequest struct { + BaseRequest + ChatroomId string + UserId string + Reason string +} + +// 注册用户信息签名验证 +func (request *SetChatroomBlackUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetChatroomHostUserRequest.go b/pkg/dto/request/SetChatroomHostUserRequest.go new file mode 100644 index 0000000..4cca007 --- /dev/null +++ b/pkg/dto/request/SetChatroomHostUserRequest.go @@ -0,0 +1,42 @@ +package request + +import "errors" + +type SetChatroomHostUserRequest struct { + BaseRequest + ChatroomId string + UserId string + ActionType string // 1=设置 0=取消 + +} + +// 注册用户信息签名验证 +func (request *SetChatroomHostUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.UserId) == 0 { + err = errors.New("UserId不能为空") + return + } + + if len(request.ActionType) == 0 { + err = errors.New("ActionType不能为空") + return + } + + if request.ActionType != "0" && request.ActionType != "1" { + err = errors.New("ActionType无效") + return + } + + return +} diff --git a/pkg/dto/request/SetChatroomPwdRequest.go b/pkg/dto/request/SetChatroomPwdRequest.go new file mode 100644 index 0000000..54f317e --- /dev/null +++ b/pkg/dto/request/SetChatroomPwdRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type SetChatroomPwdRequest struct { + BaseRequest + ChatroomId string + RoomPwd string +} + +// 注册用户信息签名验证 +func (request *SetChatroomPwdRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetChildModeRequest.go b/pkg/dto/request/SetChildModeRequest.go new file mode 100644 index 0000000..00623d7 --- /dev/null +++ b/pkg/dto/request/SetChildModeRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type SetChildModeRequest struct { + BaseRequest + Password string +} + +// 签名验证 +func (request *SetChildModeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Password) == 0 { + err = errors.New("Password不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetRoomBackgroundRequest.go b/pkg/dto/request/SetRoomBackgroundRequest.go new file mode 100644 index 0000000..4b43e03 --- /dev/null +++ b/pkg/dto/request/SetRoomBackgroundRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 设置房间背景 +type SetRoomBackgroundRequest struct { + AccessToken string + ChatroomId string + BackgroundId string +} + +// 参数合法性检验 +func (request *SetRoomBackgroundRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.BackgroundId) == 0 { + err = errors.New("BackgroundId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetServiceStatusRequest.go b/pkg/dto/request/SetServiceStatusRequest.go new file mode 100644 index 0000000..a25b982 --- /dev/null +++ b/pkg/dto/request/SetServiceStatusRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 设置接单状态 +type SetServiceStatusRequest struct { + BaseRequest + UserSkillId string + ServiceStatus string // 1=接单 0=不接单 +} + +// 签名验证 +func (request *SetServiceStatusRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + + if len(request.ServiceStatus) == 0 { + err = errors.New("ServiceStatus不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetSkillPriceRequest.go b/pkg/dto/request/SetSkillPriceRequest.go new file mode 100644 index 0000000..523cc51 --- /dev/null +++ b/pkg/dto/request/SetSkillPriceRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 设置技能价格 +type SetSkillPriceRequest struct { + BaseRequest + UserSkillId string + Price string +} + +// 签名验证 +func (request *SetSkillPriceRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("UserSkillId不能为空") + return + } + + if len(request.Price) == 0 { + err = errors.New("Price不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetUpSeatTypeRequest.go b/pkg/dto/request/SetUpSeatTypeRequest.go new file mode 100644 index 0000000..e7420e5 --- /dev/null +++ b/pkg/dto/request/SetUpSeatTypeRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 设置房间上麦方式 +type SetUpSeatTypeRequest struct { + BaseRequest + ChatroomId string + UpSeatType string // 1=排麦 2=自由麦 +} + +// 签名验证 +func (request *SetUpSeatTypeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.UpSeatType) == 0 { + err = errors.New("UpSeatType不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetUserAliasNameRequest.go b/pkg/dto/request/SetUserAliasNameRequest.go new file mode 100644 index 0000000..5d5c177 --- /dev/null +++ b/pkg/dto/request/SetUserAliasNameRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type SetUserAliasNameRequest struct { + BaseRequest + TargetUserId string + AliasName string +} + +// 参数验证 +func (request *SetUserAliasNameRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + if len(request.AliasName) == 0 { + err = errors.New("AliasName不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetUserBankInfoRequest.go b/pkg/dto/request/SetUserBankInfoRequest.go new file mode 100644 index 0000000..3ae05ab --- /dev/null +++ b/pkg/dto/request/SetUserBankInfoRequest.go @@ -0,0 +1,36 @@ +package request + +import "errors" + +type SetUserBankInfoRequest struct { + AccessToken string + BankName string + BankBranchName string + BankCardNo string + AlipayAccount string + Vericode string +} + +// 参数合法性检验 +func (request *SetUserBankInfoRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.BankName) == 0 { + err = errors.New("银行不能为空") + return + } + + if len(request.BankCardNo) == 0 { + err = errors.New("银行卡号不能为空") + return + } + + // if len(request.Vericode) == 0 { + // err = errors.New("验证码不能为空") + // return + // } + return +} diff --git a/pkg/dto/request/SetUserHobbiesRequest.go b/pkg/dto/request/SetUserHobbiesRequest.go new file mode 100644 index 0000000..f117552 --- /dev/null +++ b/pkg/dto/request/SetUserHobbiesRequest.go @@ -0,0 +1,20 @@ +package request + +import "errors" + +type SetUserHobbiesRequest struct { + BaseRequest + HobbiesIds string // 兴趣爱好 + TagIds string // 我是什么样的人 +} + +// 参数合法性检验 +func (request *SetUserHobbiesRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SetUserPrivacyRequest.go b/pkg/dto/request/SetUserPrivacyRequest.go new file mode 100644 index 0000000..fe9282b --- /dev/null +++ b/pkg/dto/request/SetUserPrivacyRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type SetUserPrivacyRequest struct { + BaseRequest + DataType string // RoomInUserPageHidden = 主页显示聊天室 EnterRoomHidden = 隐身进厅 RoomRankHidden = 房间榜单隐身 ImMsgStateHidden = 隐藏消息读取状态 + DataValue string +} + +// 参数合法性检验 +func (request *SetUserPrivacyRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.DataType) == 0 { + err = errors.New("DataType不能为空") + return + } + + if len(request.DataValue) == 0 { + err = errors.New("DataValue不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SignWithAppleRequest.go b/pkg/dto/request/SignWithAppleRequest.go new file mode 100644 index 0000000..0614503 --- /dev/null +++ b/pkg/dto/request/SignWithAppleRequest.go @@ -0,0 +1,18 @@ +package request + +import "errors" + +type SignWithAppleRequest struct { + AuthorizationCode string +} + +// 参数合法性检验 +func (request *SignWithAppleRequest) CheckParameter() (err error) { + + if len(request.AuthorizationCode) == 0 { + err = errors.New("AuthorizationCode 不能为空") + return + } + + return +} diff --git a/pkg/dto/request/SkillApplyRequest.go b/pkg/dto/request/SkillApplyRequest.go new file mode 100644 index 0000000..1a0f1bb --- /dev/null +++ b/pkg/dto/request/SkillApplyRequest.go @@ -0,0 +1,89 @@ +package request + +import ( + "encoding/json" + "errors" +) + +// 申请技能请求 +type SkillApplyRequest struct { + BaseRequest + GuildId string // 俱乐部ID + SkillId string // 技能ID + SkillCertImg string // 认证图片 - + SkillAudioUrl string // 音频 - 现在不需要传 + AudioTime string // 音频时长 - 现在不需要传 + SkillMode string // 游戏玩法 - 比如航天 + SkillLevel string // 游戏等级 - 比如211 + SkillConfigId string // 技能配置ID,这里传技能配置里面选择的等级的ID + GameRole string // 不要 - 现在不需要传 + BriefDesc string // 备注 + CompanionType string // 单配双配(根据技能上的 SpecialRequirements,如果包含 CompanionType 则需要传这个字段 single 和 double) +} + +// 签名验证 +func (request *SkillApplyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + return errors.New("AccessToken不能为空") + } + if len(request.SkillId) == 0 { + return errors.New("SkillId不能为空") + } + if len(request.GuildId) == 0 { + request.GuildId = "1" + } + return +} + +// 申请技能请求 +type SkillApplyV2Request struct { + BaseRequest + GuildId string // 俱乐部ID + SkillId string + SkillAudioUrl string + AudioTime string + ModeList string + Modes []SkillApplyV2ModeRequest `json:"-"` +} + +type SkillApplyV2ModeRequest struct { + SkillCertImg string + SkillMode string + SkillLevel string + GameRole string + ConfigId string + BriefDesc string + CompanionType string // 陪玩类型 single double +} + +// 签名验证 +func (request *SkillApplyV2Request) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + return errors.New("AccessToken不能为空") + } + if len(request.SkillId) == 0 { + return errors.New("SkillId不能为空") + } + if len(request.ModeList) == 0 { + return errors.New("ModeList不能为空") + } + if err = json.Unmarshal([]byte(request.ModeList), &request.Modes); err != nil { + return errors.New("ModeList格式错误") + } + return +} + +type SkillConfigRequest struct { + IdReq + GuildId string +} + +type BaseGuildRequest struct { + BaseRequest + GuildId string +} + +type GuildConfigRequest struct { + BaseGuildRequest + Key string +} diff --git a/pkg/dto/request/SkillEditRequest.go b/pkg/dto/request/SkillEditRequest.go new file mode 100644 index 0000000..fafbed9 --- /dev/null +++ b/pkg/dto/request/SkillEditRequest.go @@ -0,0 +1,90 @@ +package request + +import "errors" + +// 申请技能请求 +type SkillEditRequest struct { + BaseRequest + UserSkillId string + SkillCertImg string + SkillAudioUrl string + AudioTime string + SkillLevel string + GameRole string + BriefDesc string +} + +// 签名验证 +func (request *SkillEditRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + if len(request.SkillCertImg) == 0 { + err = errors.New("SkillCertImg不能为空") + return + } + + return +} + +// 申请技能请求 +type SkillEditCommentRequest struct { + BaseRequest + UserSkillId string + BriefDesc string +} + +func (request *SkillEditCommentRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.UserSkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + return +} + +// 技能价格修改请求 +type SkillPriceEditRequest struct { + BaseRequest + UserSkillId string + PriceId string + NewPrice string +} + +// 签名验证 +func (request *SkillPriceEditRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.UserSkillId) == 0 { + err = errors.New("SkillId不能为空") + return + } + + if len(request.PriceId) == 0 { + err = errors.New("价格ID不能为空") + return + } + + if len(request.NewPrice) == 0 { + err = errors.New("价格ID不能为空") + return + } + + return +} diff --git a/pkg/dto/request/TakeOffStoreGoodsRequest.go b/pkg/dto/request/TakeOffStoreGoodsRequest.go new file mode 100644 index 0000000..73b3740 --- /dev/null +++ b/pkg/dto/request/TakeOffStoreGoodsRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type TakeOffStoreGoodsRequest struct { + BaseRequest + GoodsType string +} + +// 参数合法性检验 +func (request *TakeOffStoreGoodsRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.GoodsType) == 0 { + err = errors.New("GoodsType不能为空") + return + } + + return +} diff --git a/pkg/dto/request/TaskUpdateRequest.go b/pkg/dto/request/TaskUpdateRequest.go new file mode 100644 index 0000000..14dc3c6 --- /dev/null +++ b/pkg/dto/request/TaskUpdateRequest.go @@ -0,0 +1,26 @@ +package request + +import "errors" + +type TaskUpdateRequest struct { + AccessToken string + TaskType string + TaskId string +} + +// 参数合法性检验 +func (request *TaskUpdateRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken 不能为空") + return + } + if len(request.TaskType) == 0 { + err = errors.New("TaskType 不能为空") + return + } + if len(request.TaskId) == 0 { + err = errors.New("taskId 不能为空") + return + } + return +} diff --git a/pkg/dto/request/TransferToAliAccountRequest.go b/pkg/dto/request/TransferToAliAccountRequest.go new file mode 100644 index 0000000..2cb69a9 --- /dev/null +++ b/pkg/dto/request/TransferToAliAccountRequest.go @@ -0,0 +1,20 @@ +package request + +import "errors" + +type TransferToAliAccountRequest struct { + WithdrawId string + StaffUserId string + StaffUserName string +} + +// 参数合法性检验 +func (request *TransferToAliAccountRequest) CheckParameter() (err error) { + + if len(request.WithdrawId) == 0 { + err = errors.New("WithdrawId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UnFollowUserRequest.go b/pkg/dto/request/UnFollowUserRequest.go new file mode 100644 index 0000000..d81cbc3 --- /dev/null +++ b/pkg/dto/request/UnFollowUserRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UnFollowUserRequest struct { + BaseRequest + + TargetUserId string +} + +// 参数合法性检验 +func (request *UnFollowUserRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TargetUserId) == 0 { + err = errors.New("TargetUserId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateChatroomInfoRequest.go b/pkg/dto/request/UpdateChatroomInfoRequest.go new file mode 100644 index 0000000..17472cb --- /dev/null +++ b/pkg/dto/request/UpdateChatroomInfoRequest.go @@ -0,0 +1,47 @@ +package request + +import ( + "errors" + + "github.com/anxpp/common-utils/str" +) + +type UpdateChatroomInfoRequest struct { + BaseRequest + ChatroomId string + Announcement string + WelcomeMessage string + RoomName string + UpSeatType string //1=排麦 2=自由麦 + IsRecordCharm string // 是否记录魅力值 1=记录 0=不记录 + SendMessageTimeGap string // 发消息间隔时间 -1=不可以发 1=每1秒一次 + SeatCountDown string // 麦序的倒计时秒数 +} + +// 注册用户信息签名验证 +func (request *UpdateChatroomInfoRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.RoomName) == 0 { + err = errors.New("RoomName不能为空") + return + } + + if len(request.SeatCountDown) > 0 { + if str.StringToInt(request.SeatCountDown) < 10 || str.StringToInt(request.SeatCountDown) > 9999 { + err = errors.New("SeatCountdown只能在10-9999之间") + return + } + } + + return +} diff --git a/pkg/dto/request/UpdateChatroomNameAndNoticeRequest.go b/pkg/dto/request/UpdateChatroomNameAndNoticeRequest.go new file mode 100644 index 0000000..4c8c59f --- /dev/null +++ b/pkg/dto/request/UpdateChatroomNameAndNoticeRequest.go @@ -0,0 +1,32 @@ +package request + +import "errors" + +type UpdateChatroomNameAndNoticeRequest struct { + BaseRequest + ChatroomId string + Announcement string + RoomName string + GroupId string +} + +// 注册用户信息签名验证 +func (request *UpdateChatroomNameAndNoticeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.RoomName) == 0 { + err = errors.New("房间名称不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateChatroomSeatTypeRequest.go b/pkg/dto/request/UpdateChatroomSeatTypeRequest.go new file mode 100644 index 0000000..9e8a7ac --- /dev/null +++ b/pkg/dto/request/UpdateChatroomSeatTypeRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UpdateChatroomSeatTypeRequest struct { + BaseRequest + ChatroomId string + UpSeatType string //1=排麦 2=自由麦 +} + +// 注册用户信息签名验证 +func (request *UpdateChatroomSeatTypeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateMobileRequest.go b/pkg/dto/request/UpdateMobileRequest.go new file mode 100644 index 0000000..a987292 --- /dev/null +++ b/pkg/dto/request/UpdateMobileRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +type UpdateMobileRequest struct { + BaseRequest + NewMobile string + NewRegionCode string + Vericode string +} + +// 注册用户信息签名验证 +func (request *UpdateMobileRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.NewMobile) == 0 { + err = errors.New("新手机号不能为空") + return + } + + if len(request.Vericode) == 0 { + err = errors.New("验证码不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserAvatarRequest.go b/pkg/dto/request/UpdateUserAvatarRequest.go new file mode 100644 index 0000000..76b5a51 --- /dev/null +++ b/pkg/dto/request/UpdateUserAvatarRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UpdateUserAvatarRequest struct { + BaseRequest + + AvatarPhotoKey string +} + +// 注册用户信息签名验证 +func (request *UpdateUserAvatarRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.AvatarPhotoKey) == 0 { + err = errors.New("VideoKey不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserBirthdayRequest.go b/pkg/dto/request/UpdateUserBirthdayRequest.go new file mode 100644 index 0000000..2a315cb --- /dev/null +++ b/pkg/dto/request/UpdateUserBirthdayRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UpdateUserBirthdayRequest struct { + BaseRequest + + Birthday string +} + +// 参数验证 +func (request *UpdateUserBirthdayRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Birthday) == 0 { + err = errors.New("Birthday不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserNickNameRequest.go b/pkg/dto/request/UpdateUserNickNameRequest.go new file mode 100644 index 0000000..9a90546 --- /dev/null +++ b/pkg/dto/request/UpdateUserNickNameRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type UpdateUserNickNameRequest struct { + BaseRequest + + NickName string +} + +// 参数验证 +func (request *UpdateUserNickNameRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.NickName) == 0 { + err = errors.New("NickName不能为空") + return + } + + if len(request.NickName) > 30 { + err = errors.New("NickName不能超过30字符") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserPhotoIndexRequest.go b/pkg/dto/request/UpdateUserPhotoIndexRequest.go new file mode 100644 index 0000000..0b9085f --- /dev/null +++ b/pkg/dto/request/UpdateUserPhotoIndexRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type UpdateUserPhotoIndexRequest struct { + BaseRequest + PhotoIds string // 排序后的id 以逗号分开 +} + +// 签名验证 +func (request *UpdateUserPhotoIndexRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PhotoIds) == 0 { + err = errors.New("PhotoIds不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserSignRequest.go b/pkg/dto/request/UpdateUserSignRequest.go new file mode 100644 index 0000000..cda45a2 --- /dev/null +++ b/pkg/dto/request/UpdateUserSignRequest.go @@ -0,0 +1,47 @@ +package request + +import "errors" + +type UpdateUserSignRequest struct { + BaseRequest + + Sign string +} + +// 参数验证 +func (request *UpdateUserSignRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + var arr = []rune(request.Sign) + if len(arr) > 500 { + return errors.New("不能超过500字") + } + + return +} + +type UpdateUserGenderRequest struct { + BaseRequest + + Gender string +} + +// 参数验证 +func (request *UpdateUserGenderRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.Gender) == 0 { + err = errors.New("性别不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UpdateUserVideoRequest.go b/pkg/dto/request/UpdateUserVideoRequest.go new file mode 100644 index 0000000..29cb408 --- /dev/null +++ b/pkg/dto/request/UpdateUserVideoRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UpdateUserVideoRequest struct { + BaseRequest + + VideoKey string +} + +// 注册用户信息签名验证 +func (request *UpdateUserVideoRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.VideoKey) == 0 { + err = errors.New("VideoKey不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UploadMusicRequest.go b/pkg/dto/request/UploadMusicRequest.go new file mode 100644 index 0000000..fcff319 --- /dev/null +++ b/pkg/dto/request/UploadMusicRequest.go @@ -0,0 +1,49 @@ +package request + +import ( + "errors" +) + +// 上传音乐 +type UploadMusicRequest struct { + AccessToken string + MusicName string // 音乐名称 + Singer string // 演唱者 + Size string // + Long string // + TypeCode string //1=原唱 2=伴奏 + MusicUrl string // 音乐Key audio/+uuid + PersistId string + AvInfo string +} + +// 参数合法性检验 +func (request *UploadMusicRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.MusicName) == 0 { + err = errors.New("MusicName不能为空") + return + } + + if len(request.Singer) == 0 { + err = errors.New("Singer不能为空") + return + } + + if len(request.TypeCode) == 0 { + err = errors.New("TypeCode不能为空") + return + } + + if len(request.MusicUrl) == 0 { + err = errors.New("MusicUrl不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UploadUserPhotoRequest.go b/pkg/dto/request/UploadUserPhotoRequest.go new file mode 100644 index 0000000..e6d7afd --- /dev/null +++ b/pkg/dto/request/UploadUserPhotoRequest.go @@ -0,0 +1,25 @@ +package request + +import "errors" + +type UploadUserPhotoRequest struct { + BaseRequest + PhotoKey string + PhotoIndex string +} + +// 签名验证 +func (request *UploadUserPhotoRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.PhotoKey) == 0 { + err = errors.New("PhotoKey不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UseHaveRandResultEmojiRequestRequest.go b/pkg/dto/request/UseHaveRandResultEmojiRequestRequest.go new file mode 100644 index 0000000..1b2d0a0 --- /dev/null +++ b/pkg/dto/request/UseHaveRandResultEmojiRequestRequest.go @@ -0,0 +1,31 @@ +package request + +import "errors" + +// 使用有随机结果的表情 +type UseHaveRandResultEmojiRequest struct { + AccessToken string + ChatroomId string + EmojiId string +} + +// 参数合法性检验 +func (request *UseHaveRandResultEmojiRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ChatroomId) == 0 { + err = errors.New("ChatroomId不能为空") + return + } + + if len(request.EmojiId) == 0 { + err = errors.New("EmojiId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UseStoreGoodsRequest.go b/pkg/dto/request/UseStoreGoodsRequest.go new file mode 100644 index 0000000..68b6b4a --- /dev/null +++ b/pkg/dto/request/UseStoreGoodsRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type UseStoreGoodsRequest struct { + BaseRequest + StoreId string +} + +// 参数合法性检验 +func (request *UseStoreGoodsRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.StoreId) == 0 { + err = errors.New("StoreId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UserCertifyApplyAliRequest.go b/pkg/dto/request/UserCertifyApplyAliRequest.go new file mode 100644 index 0000000..5aaaab9 --- /dev/null +++ b/pkg/dto/request/UserCertifyApplyAliRequest.go @@ -0,0 +1,32 @@ +package request + +import ( + "errors" +) + +type UserCertifyApplyAliRequest struct { + AccessToken string + TrueName string + CertNo string +} + +// 参数合法性检验 +func (request *UserCertifyApplyAliRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.TrueName) == 0 { + err = errors.New("TrueName不能为空") + return + } + + if len(request.CertNo) == 0 { + err = errors.New("CertNo不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UserCertifyApplyRequest.go b/pkg/dto/request/UserCertifyApplyRequest.go new file mode 100644 index 0000000..9ac7849 --- /dev/null +++ b/pkg/dto/request/UserCertifyApplyRequest.go @@ -0,0 +1,223 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common" + "gitea.ddegame.cn/open/servicebase/pkg/tools" +) + +type UserThreeFactorsCertifyRequest struct { + AccessToken string + TrueName string + CertNo string +} + +func (request *UserThreeFactorsCertifyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.TrueName) == 0 { + err = errors.New("TrueName不能为空") + return + } + if len(request.CertNo) == 0 { + err = errors.New("CertNo不能为空") + return + } + return +} + +type UserFaceLiveCertifyApplyRequest struct { + AccessToken string + TrueName string + CertNo string + RedirectUrl string +} + +func (request *UserFaceLiveCertifyApplyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.TrueName) == 0 { + err = errors.New("TrueName不能为空") + return + } + if len(request.CertNo) == 0 { + err = errors.New("CertNo不能为空") + return + } + if len(request.RedirectUrl) == 0 { + err = errors.New("RedirectUrl不能为空") + return + } + return +} + +type ReCheckLiveCertifyRequest struct { + AccessToken string + //TrueName string + //CertNo string + AuthToken string +} + +func (request *ReCheckLiveCertifyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.AuthToken) == 0 { + err = errors.New("AuthToken不能为空") + return + } + return +} + +type UserFaceVerifyRequest struct { + AccessToken string + Metainfo string +} + +func (request *UserFaceVerifyRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.Metainfo) == 0 { + err = errors.New("Metainfo不能为空") + return + } + return +} + +type UserFaceVerifyVedioCommitRequest struct { + AccessToken string + AuthVedioUrl string +} + +func (request *UserFaceVerifyVedioCommitRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.AuthVedioUrl) == 0 { + err = errors.New("AuthVedioUrl 不能为空") + return + } + return +} + +type UserFaceVerifyCommitRequest struct { + AccessToken string + CertifyId string + SkillId string + SkillMode string + SkillLevel string + SkillConfigId string + BriefDesc string + AuthVedioUrl string +} + +func (request *UserFaceVerifyCommitRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.CertifyId) == 0 { + err = errors.New("CertifyId不能为空") + return + } + // if len(request.SkillId) == 0 { + // err = errors.New("SkillId 不能为空") + // return + // } + // if len(request.SkillMode) == 0 { + // err = errors.New("SkillMode 不能为空") + // return + // } + // if len(request.SkillLevel) == 0 { + // err = errors.New("SkillLevel 不能为空") + // return + // } + // if len(request.SkillConfigId) == 0 { + // err = errors.New("SkillConfigId 不能为空") + // return + // } + // if len(request.AuthVedioUrl) == 0 { + // err = errors.New("AuthVedioUrl 不能为空") + // return + // } + return +} + +type SellerFaceVerifyApplyRequest struct { + AccessToken string + SkillId string + SkillMode string + Contact string +} + +type UserCertifyApplyRequest struct { + AccessToken string + CertifyType string + TrueName string + CertNo string + CertImgFront string + CertImgBacked string + CertImgInHand string +} + +// 参数合法性检验 +func (request *UserCertifyApplyRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.CertifyType) == 0 { + err = errors.New("CertifyType不能为空") + return + } + + if len(request.TrueName) == 0 { + err = errors.New("TrueName不能为空") + return + } + + if len(request.CertNo) == 0 { + err = errors.New("CertNo不能为空") + return + } + // 当前不允许国内用户使用该功能 + if tools.IsChineseIDCard(request.CertNo) { + err = errors.New("请使用人脸认证方式") + return + } + // 只能是 1或2 + if request.CertifyType != common.CERTIFY_TYPE_ZHIMA && request.CertifyType != common.CERTIFY_TYPE_RENGONG { + err = errors.New("CertifyType错误") + return + } + + if request.CertifyType == common.CERTIFY_TYPE_RENGONG { + if len(request.CertImgFront) == 0 { + err = errors.New("CertImgFront不能为空") + return + } + + if len(request.CertImgBacked) == 0 { + err = errors.New("CertImgBacked不能为空") + return + } + + if len(request.CertImgInHand) == 0 { + err = errors.New("CertImgInHand不能为空") + return + } + } + + return +} diff --git a/pkg/dto/request/UserCharmWithdrawRequest.go b/pkg/dto/request/UserCharmWithdrawRequest.go new file mode 100644 index 0000000..2350ef4 --- /dev/null +++ b/pkg/dto/request/UserCharmWithdrawRequest.go @@ -0,0 +1,61 @@ +package request + +import ( + "errors" + "strconv" + + "gitea.ddegame.cn/open/servicebase/pkg/common" + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// UserCharmWithdrawRequest 用户魅力值提现 +type UserCharmWithdrawRequest struct { + BaseRequest + WithdrawCash string // 提现的金额 +} + +// CheckParameter 普通充值 参数校验 +func (request *UserCharmWithdrawRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.WithdrawCash) == 0 { + err = errors.New("WithdrawCash不能为空") + return + } + + // 提现金额 + cashInt := htools.StringToInt(request.WithdrawCash) + if cashInt <= 0 { + err = errors.New("提现金额非法") + return + } + // 是否整数 + if strconv.Itoa(cashInt) != request.WithdrawCash { + err = errors.New("提现金额只能是整数") + return + } + + // 最小值 + if cashInt < common.CHARM_WITHDRAW_MIN_CASH { + err = errors.New("提现金额最少要" + strconv.Itoa(common.CHARM_WITHDRAW_MIN_CASH)) + return + } + + // 最大值判断 + if cashInt > common.CHARM_WITHDRAW_MAX_CASH { + err = errors.New("提现金额超限,每次最多" + strconv.Itoa(common.CHARM_WITHDRAW_MAX_CASH)) + return + } + + // 是否10的倍数 + if cashInt%10 != 0 { + err = errors.New("提现金额必须是10的倍数") + return + } + + return +} diff --git a/pkg/dto/request/UserIapRechargePreCheckRequest.go b/pkg/dto/request/UserIapRechargePreCheckRequest.go new file mode 100644 index 0000000..d59ce18 --- /dev/null +++ b/pkg/dto/request/UserIapRechargePreCheckRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type UserIapRechargePreCheckRequest struct { + BaseRequest + RechargeAmount string +} + +// IAP充值 参数校验 +func (request *UserIapRechargePreCheckRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.RechargeAmount) == 0 { + err = errors.New("RechargeAmount不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UserNcoinWithdrawRequest.go b/pkg/dto/request/UserNcoinWithdrawRequest.go new file mode 100644 index 0000000..0b63e1e --- /dev/null +++ b/pkg/dto/request/UserNcoinWithdrawRequest.go @@ -0,0 +1,54 @@ +package request + +import ( + "errors" + "strconv" + + "gitea.ddegame.cn/open/servicebase/pkg/common" + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// UserNCoinWithdrawRequest 用户魅力值提现 +type UserNCoinWithdrawRequest struct { + BaseRequest + WithdrawCash string // 提现的金额 +} + +// CheckParameter 普通充值 参数校验 +func (request *UserNCoinWithdrawRequest) CheckParameter() (err error) { + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + if len(request.WithdrawCash) == 0 { + err = errors.New("WithdrawCash不能为空") + return + } + // 提现金额 + cashInt := htools.StringToInt(request.WithdrawCash) + if cashInt <= 0 { + err = errors.New("提现金额非法") + return + } + // 是否整数 + if strconv.Itoa(cashInt) != request.WithdrawCash { + err = errors.New("提现金额只能是整数") + return + } + // 最小值 + if cashInt < common.NCoin_WITHDRAW_MIN_CASH { + err = errors.New("提现金额最少要" + strconv.Itoa(common.CHARM_WITHDRAW_MIN_CASH)) + return + } + // 最大值判断 + if cashInt > common.NCoin_WITHDRAW_MAX_CASH { + err = errors.New("提现金额超限,每次最多" + strconv.Itoa(common.CHARM_WITHDRAW_MAX_CASH)) + return + } + // 是否10的倍数 + if cashInt%10 != 0 { + err = errors.New("提现金额必须是10的倍数") + return + } + return +} diff --git a/pkg/dto/request/UserRechargeRequest.go b/pkg/dto/request/UserRechargeRequest.go new file mode 100644 index 0000000..e0eff77 --- /dev/null +++ b/pkg/dto/request/UserRechargeRequest.go @@ -0,0 +1,110 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common/HyTools" + "gitea.ddegame.cn/open/servicebase/pkg/constant" + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +const ( + PAY_TYPE_ALIPAY = "alipay" + PAY_TYPE_WEIXIN = "wxpay" + PAY_TYPE_IAP = "iap" +) + +// 普通充值 微信 支付宝 +type UserRechargeRequest struct { + BaseRequest + ProductId string + ProductPrice string + PayType string // 支付方式 + RechargeChannel string // 充值渠道 1 = APP-iOS 2= APP-Android 3= 微信公众号 4= 支付宝服务窗 5=H5 + CashAmount string // 自定义金额 +} + +// IAP充值 +type IapRechargeRequest struct { + BaseRequest + ReceiptData string // 苹果支付成功返回的票据 + TransactionId string // 本次支付的交易ID +} + +// 普通充值 参数校验 +func (request *UserRechargeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ProductId) == 0 { + err = errors.New("ProductId不能为空") + return + } + + if len(request.ProductPrice) == 0 { + err = errors.New("ProductPrice不能为空") + return + } + + if len(request.PayType) == 0 { + err = errors.New("PayType不能为空") + return + } + + if len(request.RechargeChannel) == 0 { + err = errors.New("Platform不能为空") + return + } + + platformInt := htools.StringToInt(request.RechargeChannel) + if platformInt < 1 || platformInt > 5 { + err = errors.New("Platform非法") + return + } + + if request.PayType != PAY_TYPE_ALIPAY && request.PayType != PAY_TYPE_WEIXIN { + err = errors.New("PayType不合法") + return + } + + // 自定义充值 + if request.ProductId == constant.CustomerProductId { + + if len(request.CashAmount) == 0 { + err = errors.New("自定义充值金额不能为空") + return + } + + cash := HyTools.StringToInt(request.CashAmount) + + if cash < 1 || cash > 80000 { + err = errors.New("自定义充值金额只能1到80000元") + return + } + } + return +} + +// IAP充值 参数校验 +func (request *IapRechargeRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.ReceiptData) == 0 { + err = errors.New("ReceiptData不能为空") + return + } + + if len(request.TransactionId) == 0 { + err = errors.New("TransactionId不能为空") + return + } + + return +} diff --git a/pkg/dto/request/UserSignInRequest.go b/pkg/dto/request/UserSignInRequest.go new file mode 100644 index 0000000..aeafe31 --- /dev/null +++ b/pkg/dto/request/UserSignInRequest.go @@ -0,0 +1,75 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common" +) + +type UserSignInRequest struct { + Mobile string + Password string + SignInType string + Vericode string + WxUnionId string + QQOpenId string + WebSignInIp string + Validate string // 行为验证,二次验证 +} + +// 注册用户信息签名验证 +func (request *UserSignInRequest) CheckParameter() (err error) { + + if len(request.SignInType) == 0 { + err = errors.New("SignInType不能为空") + return + } + // 手机号密码登录 + if request.SignInType == common.SIGNIN_TYPE_MOBILE_PASSWORD { + if len(request.Mobile) == 0 { + err = errors.New("手机不能为空") + return + } + + if len(request.Password) == 0 { + err = errors.New("密码不能为空") + return + } + } + // 微信登录 + if request.SignInType == common.SIGNIN_TYPE_WEIXIN && len(request.WxUnionId) == 0 { + err = errors.New("WxUnionId不能为空") + return + } + //QQ登录 + if request.SignInType == common.SIGNIN_TYPE_QQ && len(request.QQOpenId) == 0 { + err = errors.New("QQOpenId不能为空") + return + } + // 验证码登录 + if request.SignInType == common.SIGNIN_TYPE_VERICODE { + if len(request.Mobile) == 0 { + err = errors.New("手机不能为空") + return + } + + if len(request.Vericode) == 0 { + err = errors.New("验证码不能为空") + return + } + } + // 手机号或ID登录 + if request.SignInType == common.SIGNIN_TYPE_MOBILE_OR_ID { + if len(request.Mobile) == 0 { + err = errors.New("手机号或用户ID不能为空") + return + } + + if len(request.Password) == 0 { + err = errors.New("密码不能为空") + return + } + } + + return +} diff --git a/pkg/dto/request/UserSignUpRequest.go b/pkg/dto/request/UserSignUpRequest.go new file mode 100644 index 0000000..41eca14 --- /dev/null +++ b/pkg/dto/request/UserSignUpRequest.go @@ -0,0 +1,105 @@ +package request + +import ( + "errors" + + "gitea.ddegame.cn/open/servicebase/pkg/common" +) + +type UserSignUpRequest struct { + RegionCode string //不传默认+86 + Mobile string // 手机号必传 + Password string // 可不传 + Birthday string // 必传 + NickName string // 必传 + Gender string // 男1 女0 必传 + Avatar string // 空或key + VerificationCode string // 登录时的验证码 + SignupSource string // 注册来源 1=手机号 2=微信 3=QQ 4=H5 5=易盾一键 6=苹果注册 99=robot + WxUnionId string // 微信注册时 填写 + QQOpenId string // QQ开放平台 + InviteCode string // 邀请码 + YiDunToken string // 易盾一键注册 + AppleAuthCode string // 苹果登录的code + WebSignUpIp string // H5注册传下IP +} + +// 注册用户信息签名验证 +func (request *UserSignUpRequest) CheckParameter() (err error) { + + if len(request.SignupSource) == 0 { + err = errors.New("SignupSource不能为空") + return + } + + // 手机号注册 + if request.SignupSource == common.SIGNUP_SOURCE_APP_MOBILE { + + if len(request.Mobile) == 0 { + err = errors.New("手机号不能为空") + return + } + + if len(request.VerificationCode) == 0 { + err = errors.New("验证码不能为空") + return + } + } + + if len(request.NickName) == 0 { + err = errors.New("昵称不能为空") + return + } + + // if len(request.Gender) == 0 { + // err = errors.New("性别不能为空") + // return + // } + + if len(request.NickName) > 30 { + err = errors.New("昵称长度不能超过30个字符") + return + } + + //H5注册 + if request.SignupSource == common.SIGNUP_SOURCE_WEB_H5 { + if len(request.Mobile) == 0 { + err = errors.New("Mobile不能为空") + return + } + if len(request.VerificationCode) == 0 { + err = errors.New("VerificationCode不能为空") + return + } + } + + if request.SignupSource == common.SIGNUP_SOURCE_APP_WEIXIN { + if len(request.WxUnionId) == 0 { + err = errors.New("WxUnionId不能为空") + return + } + } + + if request.SignupSource == common.SIGNUP_SOURCE_APP_QQ { + if len(request.QQOpenId) == 0 { + err = errors.New("QQOpenId不能为空") + return + } + } + + if request.SignupSource == common.SIGNUP_SOURCE_YIDUN_ONECLICK { + if len(request.YiDunToken) == 0 { + err = errors.New("YiDunToken不能为空") + return + } + } + + if request.SignupSource == common.SIGNUP_SOURCE_APPLE_SIGN { + if len(request.AppleAuthCode) == 0 { + err = errors.New("AppleAuthCode不能为空") + return + } + } + + return +} diff --git a/pkg/dto/request/UserSignUpRobotRequest.go b/pkg/dto/request/UserSignUpRobotRequest.go new file mode 100644 index 0000000..0be84ee --- /dev/null +++ b/pkg/dto/request/UserSignUpRobotRequest.go @@ -0,0 +1,52 @@ +package request + +import ( + "errors" +) + +type UserSignUpRobotRequest struct { + Mobile string + Password string + Birthday string + NickName string + Gender string + Avatar string + VerificationCode string + SignupSource string // 注册来源 1=手机号 2=微信 3=QQ 4=H5 99=robot +} + +// 注册用户信息签名验证 +func (request *UserSignUpRobotRequest) CheckParameter() (err error) { + + if len(request.SignupSource) == 0 { + err = errors.New("SignupSource不能为空") + return + } + + if len(request.Mobile) == 0 { + err = errors.New("手机号不能为空") + return + } + + if len(request.VerificationCode) == 0 { + err = errors.New("验证码不能为空") + return + } + + if len(request.NickName) == 0 { + err = errors.New("昵称不能为空") + return + } + + if len(request.Gender) == 0 { + err = errors.New("性别不能为空") + return + } + + if len(request.NickName) > 30 { + err = errors.New("昵称长度不能超过30个字符") + return + } + + return +} diff --git a/pkg/dto/request/VerifyNickNameRequest.go b/pkg/dto/request/VerifyNickNameRequest.go new file mode 100644 index 0000000..79091aa --- /dev/null +++ b/pkg/dto/request/VerifyNickNameRequest.go @@ -0,0 +1,18 @@ +package request + +import "errors" + +type VerifyNickNameRequest struct { + NickName string +} + +// 注册用户信息签名验证 +func (request *VerifyNickNameRequest) CheckParameter() (err error) { + + if len(request.NickName) == 0 { + err = errors.New("手机号不能为空") + return + } + + return +} diff --git a/pkg/dto/request/VerifyVericodeRequest.go b/pkg/dto/request/VerifyVericodeRequest.go new file mode 100644 index 0000000..5d7e3ad --- /dev/null +++ b/pkg/dto/request/VerifyVericodeRequest.go @@ -0,0 +1,30 @@ +package request + +import "errors" + +type VerifyVericodeRequest struct { + Mobile string + BizType string + Vericode string +} + +// 注册用户信息签名验证 +func (request *VerifyVericodeRequest) CheckParameter() (err error) { + + if len(request.Mobile) == 0 { + err = errors.New("手机号不能为空") + return + } + + if len(request.BizType) == 0 { + err = errors.New("BizType不能为空") + return + } + + if len(request.Vericode) == 0 { + err = errors.New("Vericode不能为空") + return + } + + return +} diff --git a/pkg/dto/request/ZhimaCertifyConfirmRequest.go b/pkg/dto/request/ZhimaCertifyConfirmRequest.go new file mode 100644 index 0000000..fbdc5c6 --- /dev/null +++ b/pkg/dto/request/ZhimaCertifyConfirmRequest.go @@ -0,0 +1,24 @@ +package request + +import "errors" + +type ZhimaCertifyConfirmRequest struct { + AccessToken string + CertityBizNo string // 芝麻认证业务号 , 初始化会返回 +} + +// 参数合法性检验 +func (request *ZhimaCertifyConfirmRequest) CheckParameter() (err error) { + + if len(request.AccessToken) == 0 { + err = errors.New("AccessToken不能为空") + return + } + + if len(request.CertityBizNo) == 0 { + err = errors.New("TrueName不能为空") + return + } + + return +} diff --git a/pkg/dto/request/admin/GeneralRankRewarRequest.go b/pkg/dto/request/admin/GeneralRankRewarRequest.go new file mode 100644 index 0000000..7387308 --- /dev/null +++ b/pkg/dto/request/admin/GeneralRankRewarRequest.go @@ -0,0 +1,16 @@ +package admin + +type GeneralRankRewardReq struct { + Item []*GeneralRankRewardItem // 下对应top-1 + RankCode string // 排行榜code 唯一 +} + +type GeneralRankRewardItem struct { + Top int // rank top 1 2 3 + GiftIdLst []*GiftReward // 礼物 +} + +type GiftReward struct { + GiftId string // 礼物ID + Count int // 数量 +} diff --git a/pkg/dto/response/Activity.go b/pkg/dto/response/Activity.go new file mode 100644 index 0000000..edaa7bb --- /dev/null +++ b/pkg/dto/response/Activity.go @@ -0,0 +1,19 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/datasource/fields" + +type ActivityRes struct { + ID int32 // 主键 + ActName string // 活动名称 + BriefDesc string // 活动介绍 + BeginTime fields.Time // 活动开始时间 + EndTime fields.Time // 活动结束时间 + ViewBeginAt fields.Time // 什么时候开始可见 + ViewEndAt fields.Time // 什么时候之后不可见 + ActType string // 活动类型 + ActPerPrice int32 // 活动单价 + ActPriceType string // 价格类型 DIAMOND=钻石 POINT=积分 + ActIcon string // 活动图标 + ActImg string // 活动图片 + ActScheme string // 活动链接 +} diff --git a/pkg/dto/response/BasePagingResponse.go b/pkg/dto/response/BasePagingResponse.go new file mode 100644 index 0000000..dd9056c --- /dev/null +++ b/pkg/dto/response/BasePagingResponse.go @@ -0,0 +1,9 @@ +package response + +// 分页返回的基础对象 +type BasePagingResponse struct { + DataList interface{} + HaveMore bool // 是否有更多 + AnchorId string // 分页锚点 + Check00 bool `json:"Check00,omitempty"` // 是否苹果审核账号 +} diff --git a/pkg/dto/response/BaseResponse.go b/pkg/dto/response/BaseResponse.go new file mode 100644 index 0000000..5b2eb23 --- /dev/null +++ b/pkg/dto/response/BaseResponse.go @@ -0,0 +1,91 @@ +package response + +const ( + SuccessCode = "8000" + SystemErrorCode = "8010" + ErrorCode = "8020" + ErrorUserNotExist = "8030" // 用户不存在 + ErrorRedEnvelopeOver = "8080" // 红包已抢完 + ErrorRedEnvelopeOverdue = "8081" // 红包已过期 + ErrorUserNotActive = "8040" // 未激活 + DiamondNotEnough = "8050" // 账户余额不足 + HaveDispatchingOrder = "8031" // 有派单中的订单 + AccessTokenInvalid = "8100" //ACCESSTOKEN无效 + ChangedDeviceCode = "8038" // 切换了设备登录 + NeedUserToAuth = "8037" // 需要身份认证 + CantKickKing = "8039" // 不能踢国王 +) + +type BaseResponse struct { + Code string + Result any + Msg string + // Ext any `json:"Ext,omitempty"` +} + +type EmptyResponse struct { +} + +type PageResponse struct { + List any + Total int64 +} + +func (r *BaseResponse) Success() bool { + return r.Code == SuccessCode +} + +// 构造API错误结果 +func GetErrorResponse(code, errMsg string) BaseResponse { + response := BaseResponse{Code: code, Msg: errMsg} + return response +} + +// 构造API错误结果 +func GetFailed(errMsg string) BaseResponse { + response := BaseResponse{Code: ErrorCode, Msg: errMsg} + return response +} + +// 构造API错误结果 +func GetPageResponse(data any, total int64) BaseResponse { + return BaseResponse{ + Code: SuccessCode, + Result: PageResponse{ + List: data, + Total: total, + }, + Msg: "", + } +} + +// 构造API错误结果 +func Failed(errMsg string) BaseResponse { + response := BaseResponse{Code: ErrorCode, Msg: errMsg} + return response +} + +// 构造API正确结果 +func GetSuccessResponse(result any) BaseResponse { + response := BaseResponse{Code: SuccessCode, Result: result} + return response +} + +// 构造API正确结果 +func GetSuccessMsgResponse(msg string, result any) BaseResponse { + response := BaseResponse{Code: SuccessCode, Msg: msg, Result: result} + return response +} + +// 构造API正确结果 +func GetEmptyResponse() BaseResponse { + object := EmptyResponse{} + response := BaseResponse{Code: SuccessCode, Result: object} + return response +} + +// 获取Result=null 对象不存在 +func GetNullResultResponse() BaseResponse { + response := BaseResponse{Code: SuccessCode, Result: nil} + return response +} diff --git a/pkg/dto/response/ChatroomPresentGiftResponse.go b/pkg/dto/response/ChatroomPresentGiftResponse.go new file mode 100644 index 0000000..c405ba7 --- /dev/null +++ b/pkg/dto/response/ChatroomPresentGiftResponse.go @@ -0,0 +1,15 @@ +package response + +// 打赏礼物返回值 +type ChatroomPresentGiftResponse struct { + DiamondBalance string + NCoinBalance string + DiamondVipLevel string + DiamondVipName string + IsBatch string + AnimationFormat string + AnimationApngUrl string + FillMode string + AnimationGifUrl string + //GiftMsg *yunxin.ChatroomPresentGiftMsgBizData `json:"GiftMsg,omitempty"` // 打赏消息体 +} diff --git a/pkg/dto/response/DispatchOrderEmployedResponse.go b/pkg/dto/response/DispatchOrderEmployedResponse.go new file mode 100644 index 0000000..871a45d --- /dev/null +++ b/pkg/dto/response/DispatchOrderEmployedResponse.go @@ -0,0 +1,12 @@ +package response + +// 在职陪玩及派单报表 返回实体 +type DispatchOrderEmployedRes struct { + SkillMode string `json:"skillMode"` // 玩法 + SkillLevel string `json:"skillLevel"` + Gender string `json:"gender"` + OrderCount int `json:"orderCount"` + CompleteOrderCount int `json:"completeOrderCount"` + SellerCount int `json:"sellerCount"` + CompleteRate float64 `json:"completeRate"` +} diff --git a/pkg/dto/response/FindTreasureResponse.go b/pkg/dto/response/FindTreasureResponse.go new file mode 100644 index 0000000..176f8f6 --- /dev/null +++ b/pkg/dto/response/FindTreasureResponse.go @@ -0,0 +1,8 @@ +package response + +// 寻宝的返回 +type FindTreasureResponse struct { + IsWin string // 是否中奖 + WinDiamond string // 中的钻石 + DiamondBalance string // 余额 +} diff --git a/pkg/dto/response/GetAppVersionResponse.go b/pkg/dto/response/GetAppVersionResponse.go new file mode 100644 index 0000000..9a45174 --- /dev/null +++ b/pkg/dto/response/GetAppVersionResponse.go @@ -0,0 +1,12 @@ +package response + +// 更新版本的返回 +type GetAppVersionResponse struct { + VersionCode string // 数字版本号 + VersionName string // 1.0.1 + MustUpdate string + AndroidDownloadUrl string + AppstoreScheme string + UpdateDesc string + FileName string +} diff --git a/pkg/dto/response/GetChatroomCurrentRoundCharmResponse.go b/pkg/dto/response/GetChatroomCurrentRoundCharmResponse.go new file mode 100644 index 0000000..1d40db8 --- /dev/null +++ b/pkg/dto/response/GetChatroomCurrentRoundCharmResponse.go @@ -0,0 +1,17 @@ +package response + +// 获取当轮魅力值和座位上的男女top1 +type GetChatroomCurrentRoundCharmResponse struct { + ManTopOneUserId string // 男性top one + WomanTopOneUserId string // 女性top one + CurrentRoundCharmList []RoundUserCharm +} + +// 魅力值用户 +type RoundUserCharm struct { + UserId string + Avatar string + NickName string + CharmValue string + Gender string +} diff --git a/pkg/dto/response/GetChatroomSeatAndQueueInfoResponse.go b/pkg/dto/response/GetChatroomSeatAndQueueInfoResponse.go new file mode 100644 index 0000000..1d1ed4c --- /dev/null +++ b/pkg/dto/response/GetChatroomSeatAndQueueInfoResponse.go @@ -0,0 +1,21 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto/yunxin" + +// 聊天室麦序和排队列表对象 +type GetChatroomSeatAndQueueInfoResponse struct { + ChatroomId string // 聊天室ID + RoomName string // 房间名称 + SeatList []yunxin.RoomSeatModel // 嘉宾座位列表 + AdminSeatList []yunxin.RoomSeatModel // 管理员麦序列表(麦序模式) + FreeSeatList []yunxin.RoomSeatModel // 管理员麦序列表(频道模式) + Section string // 相亲模板的阶段 + SurplusTime string `json:"SurplusTime,omitempty"` // 剩余时间 + Version string // 数据版本 + TemplateId string // 模板 + MasterSeat yunxin.RoomSeatModel // 主持位 + BossSeat *yunxin.RoomSeatModel `json:"BossSeat,omitempty"` // 老板位 频道模式为麦序位 + WaitingUserQueue []yunxin.ChatroomWaitUpData // 电台排队列表 + SendMessageTimeGap string // 发言时间 间隔 + +} diff --git a/pkg/dto/response/GetCreateOrderDataResponse.go b/pkg/dto/response/GetCreateOrderDataResponse.go new file mode 100644 index 0000000..1708b54 --- /dev/null +++ b/pkg/dto/response/GetCreateOrderDataResponse.go @@ -0,0 +1,20 @@ +package response + +import ( + "gitea.ddegame.cn/open/servicebase/pkg/dto" +) + +// 获取下单页数据返回 +type GetCreateOrderDataResponse struct { + UserId string // 用户Id + NickName string // 用户昵称 + Avatar string // 用户头像 + Gender string // 性别 + Birthday string // 生日 + IsAuth string // 是否身份认证 + CurrentServerTime string // 当前服务器时间 + + // 用户的技能列表 + UserSkillList []dto.UserSkillDTO // 用户的技能列表 + +} diff --git a/pkg/dto/response/GetDispatchOrderCenterDataListResponse.go b/pkg/dto/response/GetDispatchOrderCenterDataListResponse.go new file mode 100644 index 0000000..0f5c07f --- /dev/null +++ b/pkg/dto/response/GetDispatchOrderCenterDataListResponse.go @@ -0,0 +1,12 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +// 获取派单中心数据列表 +type GetDispatchOrderCenterDataListResponse struct { + LastCreateTime string // 数据截至时间 + + // 派单列表 + DispatchOrderList []dto.DispatchOrderCenterDataDTO + HaveMore bool +} diff --git a/pkg/dto/response/GetHomeTopUsersResponse.go b/pkg/dto/response/GetHomeTopUsersResponse.go new file mode 100644 index 0000000..510d63c --- /dev/null +++ b/pkg/dto/response/GetHomeTopUsersResponse.go @@ -0,0 +1,8 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +type GetHomeTopUsersResponse struct { + TopCharmUserList []dto.ListUserDTO + TopConsumeUserList []dto.ListUserDTO +} diff --git a/pkg/dto/response/GetHostGuardListResponse.go b/pkg/dto/response/GetHostGuardListResponse.go new file mode 100644 index 0000000..d5053d3 --- /dev/null +++ b/pkg/dto/response/GetHostGuardListResponse.go @@ -0,0 +1,29 @@ +package response + +type GetHostGuardListResponse struct { + UserId string + Avatar string + NickName string + TimeDiff string + GoldGuardTime string `json:"GoldGuardTime,omitempty"` + SilverGuardTime string `json:"SilverGuardTime,omitempy"` + BronzeGuardTime string `json:"BronzeGuardTime,omitempy"` + TotalGuardValue int `json:"-"` +} + +type HostGuardListResponseList []GetHostGuardListResponse + +// 获取此 slice 的长度 +func (p HostGuardListResponseList) Len() int { + return len(p) +} + +// 根据实时分钟流水降序排序 (此处按照自己的业务逻辑写) +func (p HostGuardListResponseList) Less(i, j int) bool { + return p[i].TotalGuardValue > p[j].TotalGuardValue +} + +// 交换数据 +func (p HostGuardListResponseList) Swap(i, j int) { + p[i], p[j] = p[j], p[i] +} diff --git a/pkg/dto/response/GetMyWithdrawPageResponse.go b/pkg/dto/response/GetMyWithdrawPageResponse.go new file mode 100644 index 0000000..2640382 --- /dev/null +++ b/pkg/dto/response/GetMyWithdrawPageResponse.go @@ -0,0 +1,14 @@ +package response + +type GetMyWithdrawPageResponse struct { + Id string `json:"id"` + UserId string `json:"user_id"` + CreateTime string `json:"create_time"` + ApplyMoney string `json:"apply_money"` + PreTax string `json:"pre_tax"` + HandleFee string `json:"handle_fee"` + TransferMoney string `json:"transfer_money"` + Status string `json:"status"` + StatusStr string `json:"status_str"` + FeedbackFailReason string `json:"feedback_fail_reason"` +} diff --git a/pkg/dto/response/GetUserAccountResponse.go b/pkg/dto/response/GetUserAccountResponse.go new file mode 100644 index 0000000..f5815ad --- /dev/null +++ b/pkg/dto/response/GetUserAccountResponse.go @@ -0,0 +1,12 @@ +package response + +type GetUserAccountResponse struct { + UserId string + Status string + DiamondBalance int64 + RevenueBalance int64 + NCoinBalance int64 + RevenueCashAmount string // 收益相当于现金 + NCoinCashAmount string //N币相当于现金 + ViewNCoin string // 是否显示N币 +} diff --git a/pkg/dto/response/GetUserBankInfoResponse.go b/pkg/dto/response/GetUserBankInfoResponse.go new file mode 100644 index 0000000..6eb7c6a --- /dev/null +++ b/pkg/dto/response/GetUserBankInfoResponse.go @@ -0,0 +1,10 @@ +package response + +// 获取用户银行信息 +type GetUserBankInfoResponse struct { + BankName string `json:"BankName,omitempty"` + BankUserName string `json:"BankUserName,omitempty"` + BankBranchName string `json:"BankBranchName,omitempty"` + BankCardNo string `json:"BankCardNo,omitempty"` + AlipayAccount string `json:"AlipayAccount,omitempty"` +} diff --git a/pkg/dto/response/GetUserChatroomResponse.go b/pkg/dto/response/GetUserChatroomResponse.go new file mode 100644 index 0000000..7e34287 --- /dev/null +++ b/pkg/dto/response/GetUserChatroomResponse.go @@ -0,0 +1,12 @@ +package response + +import ( + "gitea.ddegame.cn/open/servicebase/pkg/dto" +) + +type GetUserChatroomResponse struct { + UserCreatedRoom *dto.ListChatroomDTO `json:"UserCreatedRoom,omitempty"` // 用户创建的 + + UserInRoom *dto.ListChatroomDTO `json:"UserInRoom,omitempty"` // 用户所在的聊天室 + +} diff --git a/pkg/dto/response/GetUserDetailResponse.go b/pkg/dto/response/GetUserDetailResponse.go new file mode 100644 index 0000000..77159ec --- /dev/null +++ b/pkg/dto/response/GetUserDetailResponse.go @@ -0,0 +1,45 @@ +package response + +import ( + "gitea.ddegame.cn/open/servicebase/pkg/dto" +) + +type GetUserDetailResponse struct { + dto.UserInfoDTO + + IsMySelf string `json:"IsMySelf,omitempty"` // 是否获取的自己 1=自己 0=不是自己 + MeFollowTa string // 我是否关注他 0=未关注 1=已关注 + TaFollowMe string `json:"TaFollowMe,omitempty"` // 他是否关注我 0=未关注 1=已关注 + UserLastActiveTime string `json:"UserLastActiveTime,omitempty"` // 最后登录时间 + LbsViewString string `json:"LbsViewString,omitempty"` // 当前lbs显示的字符串 同城显示距离 不同城显示城市 + // PhotoList []model_app_user.UserPhotoModel `json:"PhotoList,omitempty"` // 照片墙 + MeLaHeiTa string // 是否拉黑了对方 + GiftWallList []dto.GiftWallDTO `json:"GiftWallList",omitempty` // 礼物墙 + + // 用户的动态 + TimelineList []dto.TimelineDTO + TimeLineCount string + // 被评论数量 + SkillRatedCount string + + // 用户卡片技能名称 + UserCardSkillNames string `json:"UserCardSkillNames",omitempty` + + // 用户公会信息 + GuildInfo UserGuild +} + +// 兼容app端 +type UserGuild struct { + dto.GuildBase + GuildLogo string + GuildName string + GuildScheme string +} + +func (d *GetUserDetailResponse) CompleteGuildInfo(guildId string) { + // d.GuildInfo.CompleteGuildInfo(guildId) + d.GuildInfo.GuildLogo = d.GuildInfo.GuildInfo.Logo + d.GuildInfo.GuildName = d.GuildInfo.GuildInfo.Name + // d.GuildInfo.GuildScheme = cache_guild.SchemeOrUrl("guild-notice", "enen://webpage?url=https://h5-test-app.ddegame.cn/Normal/ClubManagement/#/?viewNavigation=0") +} diff --git a/pkg/dto/response/GetUserGuardSeatResponse.go b/pkg/dto/response/GetUserGuardSeatResponse.go new file mode 100644 index 0000000..9828725 --- /dev/null +++ b/pkg/dto/response/GetUserGuardSeatResponse.go @@ -0,0 +1,7 @@ +package response + +// 获取用户守护位返回值 +type GetUserGuardSeatResponse struct { + SeatType string + SurplusDays string +} diff --git a/pkg/dto/response/GetUserRoomBgResponse.go b/pkg/dto/response/GetUserRoomBgResponse.go new file mode 100644 index 0000000..4b7e9e1 --- /dev/null +++ b/pkg/dto/response/GetUserRoomBgResponse.go @@ -0,0 +1,8 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +type UserRoomBgGroup struct { + GroupName string + BackgroundList []dto.RoomBackgroundImgDTO +} diff --git a/pkg/dto/response/GetUserSkillDetailResponse.go b/pkg/dto/response/GetUserSkillDetailResponse.go new file mode 100644 index 0000000..4bc86d0 --- /dev/null +++ b/pkg/dto/response/GetUserSkillDetailResponse.go @@ -0,0 +1,42 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +// 获取用户资质页详情的返回对象 +type GetUserSkillDetailResponse struct { + UserId string // 用户Id + NickName string // 用户昵称 + Avatar string // 用户头像 + Gender string // 性别 + Birthday string // 生日 + OnlineTime string // 在线时间 + IsAuth string // 是否身份认证 + MeFollowTa string // 是否关注 + UserSkillId string // 用户技能ID + SkillName string // 技能名称 + SkillMode string // 游戏玩法 + SkillLevel string // 等级 + SkillCompanionType string // + SkillLevelBgColor string // 等级背景 + SkillCertImg string // 资质图 + SkillAudioUrl string // 音频Url + AudioTime string // 音频时长 + GameRole string // 位置 + Price string // 价格 + UnitName string // 单位 + TotalOrderCount string // 总接单数 + RateCount string // 总评价数 + AvgRateScore string // 平均分 + BriefDesc string // 个人说明 + SkillStatus string // 状态 1=正常 2=待审核 3=冻结 4=拒绝 + ServiceStatus string // 接单状态 1=接单 0=不接单 + SkillLevelIcon string // 等级ICON + GoodRate string + Area string + PlayTimeUnit string + Playing bool + PlayTimeRange []dto.SkillSkuPlayRange + + PropDTO []dto.PropDTO `json:"Props,omitempty"` // 个人属性 + PriceList []dto.SkuPrice `json:"PriceList,omitempty"` // 价格列表 +} diff --git a/pkg/dto/response/Guild.go b/pkg/dto/response/Guild.go new file mode 100644 index 0000000..9520c4f --- /dev/null +++ b/pkg/dto/response/Guild.go @@ -0,0 +1,32 @@ +package response + +type Guild struct { + GuildId string + GuildName string + GuildBriefDesc string + GuildLogo string + GuildNo string + GuildMemberCnt string + ChairmanName string + ChairmanAvatar string + DefaultRoomId string // 默认房间ID + DefaultRoomLock string + OrderInstrScheme string // 点单须知地址 + GuildSkillList []GuildSkill `gorm:"-"` +} + +type GuildSkill struct { + GuildId string `json:"-"` + SkillId string + SkillName string + SkillIcon string + SkillSpecialRequirements string +} + +type GuildConfig struct { + GuildId string + Key string + Value string + LongValue string + Ext string +} diff --git a/pkg/dto/response/MddResponse.go b/pkg/dto/response/MddResponse.go new file mode 100644 index 0000000..76ff452 --- /dev/null +++ b/pkg/dto/response/MddResponse.go @@ -0,0 +1,57 @@ +package response + +type MddResponse struct { + Code int `json:"code"` + Data MddCustomer `json:"data"` + Message string `json:"message"` +} + +type MddCustomer struct { + AccountList []MddAccount `json:"accountList"` + Avatar string `json:"avatar"` + ConsumeAmount float64 `json:"consumeAmount"` + ConsumeTimes int64 `json:"consumeTimes"` + CreateTime string `json:"createTime"` + DDAppID string `json:"ddAppId"` + Gender string `json:"gender"` + ID string `json:"id"` + IDCard string `json:"idCard"` + IsAuth string `json:"isAuth"` + Memo string `json:"memo"` + Mobile string `json:"mobile"` + RechargeAmount float64 `json:"rechargeAmount"` + RechargeTimes int64 `json:"rechargeTimes"` + Status string `json:"status"` + TrueName string `json:"trueName"` + UserName string `json:"userName"` + UserNo string `json:"userNo"` + YyNo string `json:"yyNo"` +} + +type MddAccount struct { + Balance float64 `json:"balance"` + CardID float64 `json:"cardId"` + CardName string `json:"cardName"` + CardType string `json:"cardType"` + CreateAt string `json:"createAt"` + CustomerID int64 `json:"customerId"` + CustomerName string `json:"customerName"` + CustomerNo string `json:"customerNo"` + DiscountRate float64 `json:"discountRate"` + FrozenBalance float64 `json:"frozenBalance"` + GiveBalance float64 `json:"giveBalance"` + ID string `json:"id,omitempty"` + SellerNickName string `json:"sellerNickName"` +} + +// 同步返回的数据 +type SyncData struct { + TotalDiamond int + TotalConsumeAmount int +} + +type MddSyncResponse struct { + Code int `json:"code"` + Data SyncData `json:"data"` + Message string `json:"message"` +} diff --git a/pkg/dto/response/NoticeResponse.go b/pkg/dto/response/NoticeResponse.go new file mode 100644 index 0000000..1dbc249 --- /dev/null +++ b/pkg/dto/response/NoticeResponse.go @@ -0,0 +1,23 @@ +package response + +import ( + "time" +) + +type NoticeListResponse struct { + ID string // ID + Title string // 标题 + Description string // 描述 + HeadImg string // 头图 + JumpContent int32 // 状态1=跳转 2=不跳转 + CreateTime time.Time //创建时间 +} + +type NoticeDetailResponse struct { + Title string // 标题 + Description string // 描述 + HeadImg string // 头图 + JumpContent int32 // 状态1=跳转 2=不跳转 + Content string //富文本内容 + CreateTime time.Time //创建时间 +} diff --git a/pkg/dto/response/OpenRoomResponse.go b/pkg/dto/response/OpenRoomResponse.go new file mode 100644 index 0000000..294cb20 --- /dev/null +++ b/pkg/dto/response/OpenRoomResponse.go @@ -0,0 +1,5 @@ +package response + +type OpenRoomResponse struct { + ActionResult string +} diff --git a/pkg/dto/response/PresentGiftFromChatRoomResponse.go b/pkg/dto/response/PresentGiftFromChatRoomResponse.go new file mode 100644 index 0000000..81ca2e9 --- /dev/null +++ b/pkg/dto/response/PresentGiftFromChatRoomResponse.go @@ -0,0 +1,6 @@ +package response + +type PresentGiftFromChatRoomResponse struct { + ChatroomRoomId string + ChatroomTotalRevenue string +} diff --git a/pkg/dto/response/QiNiuTokenResponse.go b/pkg/dto/response/QiNiuTokenResponse.go new file mode 100644 index 0000000..056fe1c --- /dev/null +++ b/pkg/dto/response/QiNiuTokenResponse.go @@ -0,0 +1,6 @@ +package response + +type QiNiuTokenResponse struct { + UploadToken string + ExpiresTime string +} diff --git a/pkg/dto/response/RefreshAccessTokenResponse.go b/pkg/dto/response/RefreshAccessTokenResponse.go new file mode 100644 index 0000000..f1aab9f --- /dev/null +++ b/pkg/dto/response/RefreshAccessTokenResponse.go @@ -0,0 +1,7 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +type RefreshAccessTokenResponse struct { + dto.AccessTokenDTO +} diff --git a/pkg/dto/response/Response.go b/pkg/dto/response/Response.go new file mode 100644 index 0000000..4f8ae4a --- /dev/null +++ b/pkg/dto/response/Response.go @@ -0,0 +1,32 @@ +package response + +import ( + "encoding/json" +) + +const ( + NeedLogin = "6018" // 登陆过期 + +) + +type Response struct { + Code string + Result interface{} + Msg string +} + +func Fail(msg string) BaseResponse { + response := BaseResponse{Code: ErrorCode, Msg: msg} + return response +} + +func Invalid() string { + response := BaseResponse{Code: NeedLogin, Msg: "用户身份已过期,请重新登录!"} + str, _ := json.Marshal(response) + return string(str) +} + +func Success(Result interface{}) BaseResponse { + response := BaseResponse{Code: SuccessCode, Result: Result} + return response +} diff --git a/pkg/dto/response/SearchResponse.go b/pkg/dto/response/SearchResponse.go new file mode 100644 index 0000000..667546a --- /dev/null +++ b/pkg/dto/response/SearchResponse.go @@ -0,0 +1,14 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +type SearchResponse struct { + UserInfo dto.UserInfoDTO + ChatroomInfo dto.ListChatroomDTO +} + +type SearchV2Response struct { + UserList []dto.UserInfoDTO + ChatroomList []dto.ListChatroomDTO + GuildList []dto.GuildDTO +} diff --git a/pkg/dto/response/SendVericodeResponse.go b/pkg/dto/response/SendVericodeResponse.go new file mode 100644 index 0000000..da9a189 --- /dev/null +++ b/pkg/dto/response/SendVericodeResponse.go @@ -0,0 +1,6 @@ +package response + +type SendVericodeResponse struct { + SendSuccess string + ErrorMsg string +} diff --git a/pkg/dto/response/SubmailResponse.go b/pkg/dto/response/SubmailResponse.go new file mode 100644 index 0000000..9cae472 --- /dev/null +++ b/pkg/dto/response/SubmailResponse.go @@ -0,0 +1,11 @@ +package response + +type SubmailResponse struct { + Status string `json:"status"` + SendId string `json:"send_id"` + Fee float64 `json:"fee"` + AccountBalance float64 `json:"account_balance"` + SmsCredits string `json:"sms_credits"` + Code string `json:"code"` + Msg string `json:"msg"` +} diff --git a/pkg/dto/response/UserGoodsDTO.go b/pkg/dto/response/UserGoodsDTO.go new file mode 100644 index 0000000..20b2887 --- /dev/null +++ b/pkg/dto/response/UserGoodsDTO.go @@ -0,0 +1,21 @@ +package response + +import ( + "gitea.ddegame.cn/open/servicebase/pkg/dto" +) + +type UserMarketDTO struct { + Info UserInfo + StoreList []dto.UserStoreGoodsDTO + Basic map[string]interface{} +} + +type UserInfo struct { + Avatar string + UserNo string + Nickname string + DiamondBalance int64 + RevenueBalance int64 + PointsBalance int64 + // ... +} diff --git a/pkg/dto/response/UserSignInResponse.go b/pkg/dto/response/UserSignInResponse.go new file mode 100644 index 0000000..61c4bee --- /dev/null +++ b/pkg/dto/response/UserSignInResponse.go @@ -0,0 +1,7 @@ +package response + +import "gitea.ddegame.cn/open/servicebase/pkg/dto" + +type UserSignInResponse struct { + dto.AccessTokenDTO +} diff --git a/pkg/dto/yunxin/ImChatroomBizData.go b/pkg/dto/yunxin/ImChatroomBizData.go new file mode 100644 index 0000000..e14b8dd --- /dev/null +++ b/pkg/dto/yunxin/ImChatroomBizData.go @@ -0,0 +1,384 @@ +package yunxin + +import ( + "encoding/json" + + "gitea.ddegame.cn/open/servicebase/pkg/dto" + "gitea.ddegame.cn/open/servicebase/pkg/htools" +) + +// 聊天室有随机结果表情消息data数据结构 +type ChatRoomEmojiMsgBizData struct { + ChatroomId string + UserId string + NickName string + Avatar string + Gender string + Birthday string + SuperManager string + IsHost string + EmojiId string + EmojiUrl string + EmojiType string + ResultArray []string + IsAdmin bool + GameType string // 游戏类型 + VipConfig dto.UserVipConfigDTO //VIP相关信息 +} + +// 聊天室打赏消息data数据结构 303 309 411 +type ChatroomPresentGiftMsgBizData struct { + PresentId string + ChatroomId string + UserId string + NickName string + Avatar string + Gender string + Birthday string + VipLevel string + VipIcon string + VipName string + ToUserId string + ToUserNickName string + GiftId string + GiftName string + GiftCount string // 礼物数量 + GiftStaticUrl string + AnimationGifUrl string + AnimationApngUrl string + AnimationPcUrl string //pc特效 + AnimationFormat string + ComboHitCount string // 连击次数 + ChatroomTotalIncome string // 聊天室总的收益 + TotalDiamond string // 本次打赏钻石数 + Charm string // 本次打赏产生的魅力 交友使用 + ToPrevRoomWeeklyRevenue string // 距离上一个房主周收入差异 + NameColor string // 打赏人昵称颜色 + ToUserTotalCharm string // 被打赏人头上总的魅力值 + FillMode string // 填充模式 1=左右拉满 2=上下拉满 + +} + +// 上麦排队对象 +type ChatroomWaitUpData struct { + UserId string // 排队的用户ID + SeatType string // 要上座位类型 + SeatName string // 要上的座位描述 + ApplyTime string // 申请时间 +} + +type RoomSeatList []RoomSeatModel + +// 获取此 slice 的长度 +func (p RoomSeatList) Len() int { + return len(p) +} + +// 根据麦序排序 (此处按照自己的业务逻辑写) +func (p RoomSeatList) Less(i, j int) bool { + return htools.StringToInt(p[i].SeatIndex) < htools.StringToInt(p[j].SeatIndex) +} + +// 交换数据 +func (p RoomSeatList) Swap(i, j int) { + p[i], p[j] = p[j], p[i] +} + +// 房间座位对象 +type RoomSeatModel struct { + SeatIndex string // 座位编号 + UserId string // 座位上用户ID + NickName string // 用户昵称 + Avatar string // 用户头像 + Gender string + UserNo string + IsMute string // 是否静音 + IsOpen string // 是否打开座位 + IsTop string `json:"IsTop,omitempty"` // 是否魅力值最高 + Charm string `json:"Charm,omitempty"` // 魅力值 + SelectedIndex string `json:"SelectedIndex,omitempty"` // 选择的麦序 + SelectedUserId string `json:"SelectedUserId,omitempty"` // 选择的用户ID + Published string `json:"Published,omitempty"` // 该位置是否已公布 + UpSeatTime string `json:"UpSeatTime,omitempty"` // 上麦时间 + CountDown string `json:"CountDown,omitempty"` // 座位倒计时时间(秒)默认为0 + AvatarDecoration string `json:"AvatarDecoration,omitempty"` // 用户头饰 上麦时带上自己的头饰 + DecorationFormat string `json:"DecorationFormat,omitempty"` // 头饰类型 + SkewerIconUrl string `json:"SkewerIconUrl,omitempty"` + CountDownStartTime string `json:"CountDownStartTime,omitempty"` // 倒计时开始时间 + CountDownSeconds string `json:"CountDownSeconds,omitempty"` // 倒计时时长 + TopOneHatIcon string `json:"TopOneHatIcon,omitempty"` // top1的帽子链接 + NobilitySeatNameColor []string `json:"NobilitySeatNameColor,omitempty"` // 贵族昵称颜色 +} + +func (d RoomSeatModel) ToJson() string { + bytes, _ := json.Marshal(d) + return string(bytes) +} + +func (d *RoomSeatModel) FromJson(src []byte) RoomSeatModel { + _ = json.Unmarshal(src, d) + return *d +} + +// 关闭聊天室消息 302 +type ChatroomCloseBizData struct { + ChatroomId string + MasterUserId string // 房主ID + MasterNickName string // 昵称 + CloseBy string // 被关闭的来源 +} + +// 用户被踢出房间的消息体 407 +type ChatroomKickedUserBizData struct { + ChatroomId string + KickedUserId string // 被踢用户ID + KickedNickName string // 被踢用户昵称 + KickedUserAvatar string // 被踢用户头像 + KickedUserGender string // 被踢用户性别 + KickedUserBirthday string // 被踢用户生日 + KickedUserVipLevel string // 被踢用户VIP + MsgContent string // 消息 + OperationUserId string // 操作人 + KickedUserIsAdmin string // 被踢用户是否是管理员 + +} + +// 系统消息 412 +type ChatroomSystemMsgBizData struct { + ChatroomId string + UserId string // 用户ID + MsgContent string // 消息内容 + MsgColor string // 消息字体颜色 +} + +// 聊天室全服消息 405 +type FullServiceMsgBizData struct { + ChatroomId string // 聊天室ID + ChatroomName string // 聊天室名称 + UserId string // 发送人 + Avatar string // 发送人头像 + NickName string // 发送人头像 + GiftId string // 礼物ID + GiftCount string // 数量 + ComboHitCount string // 连击数量 + Diamond string // 当次打赏金额 + ComboHitTotalDiamond string // 连击累计打赏金额 + ToUserNickName string // 被打赏人昵称 + ToAvatar string // 被打赏人头像 + ToGender string // 被打赏人性别 + Type string // 业务类型 chatroom + GiftName string // 礼物名称 + GiftStaticUrl string // 礼物图片 +} + +// 聊天室礼物飞行消息 433 +type RoomGiftFlyMsgBizData struct { + ChatroomId string // 聊天室ID + FromUserId string // 发送人 + ToUserIdList []string // 被打赏人 + GiftCount string // 数量 + GiftStaticUrl string // 礼物图片 +} + +// 聊天室榜一变化的消息 403 +type ChatroomChangeTopOneBizData struct { + ChatroomId string + UserId string // 用户ID +} + +// 聊天室榜设置和取消管理员的消息 501 +type ChatroomSetAdminBizData struct { + ChatroomId string + UserId string // 管理原ID + Type string // 1=设置 0=取消 +} + +// 聊天室购买守护位成功 317 +type ChatroomBuyGuardSuccessBizData struct { + ChatroomId string + UserId string // 购买人 + NickName string // 购买人昵称 + HostUserId string // 主持人ID + HostNickName string // 主持人昵称 + VipLevel string //VIP等级 + VipIcon string //VIP icon + TotalIncome string // 房间总人气 + SeatType string // 座位类型 + SeatName string // 座位名称 + NameColor string // 昵称颜色 +} + +// 有守护位的人进入电台模板房间 318 +type ChatroomGuardUserEnterBizData struct { + ChatroomId string + UserId string // 购买人 + GuardSeatValue string // 守护权限 + SeatType string // 守护权限 + Type string // 1=进入 2=离开 + Icon string // 1=进入 2=离开 + IconWidth int // 1=进入 2=离开 + IconHeight int // 1=进入 2=离开 +} + +// 热度更新消息 338 +type ChatroomHotUpdatedBizData struct { + ChatroomId string + Hot string // 热度 +} + +// 用户装饰了头饰 321 == 暂不用发,设置头饰,如果在座位更新座位头饰,等下次同步 +type UserSetDecorationBizData struct { + ChatroomId string + UserId string // 用户ID + AvatarDecoration string // 头饰url + ActionType string // 0= 取消 1=设置 +} + +// 有礼物更新发聊天室通知 630 +type ChatroomUpdateGiftBizData struct { + ChatroomId string +} + +// 锁状态更新发聊天室通知 631 +type ChatroomLockStatusUpdateBizData struct { + ChatroomId string + LockStatus string // 1=上锁 0=解锁 +} + +// 聊天室摇签消息 632 +type ChatroomRockSkewerBizData struct { + DataType string // 1= 摇签 2=解签 3= 弃签 + ChatroomId string + UserId string + NickName string + Avatar string + Gender string + Birthday string + VipStatus string + VipLevel string + VipName string + SuperManager string + IsHost string + IsAdmin bool + MsgContent string // 摇签和弃签给内容 显示到公屏 + SkewerIconUrl string // 摇签给icon ,显示到座位上 + RockSkewerResult []string // 解签给结果,显示到座位2秒 显示到公屏 + SkewerLevelIcon string // 签等级icon + NameColor string // 昵称颜色 + +} + +// 聊天室进入和离开消息 633 +type ChatroomComeInOrLeaveBizData struct { + DataType string // 1= 进入 2=离开 + ChatroomId string + UserId string + UserNo string + NickName string + Avatar string + AvatarDecoration string + Gender string + Birthday string + SuperManager string + IsRewardTopOne string //1=是房间榜一 + MountName string // 座驾名字 + MountUrl string // 座驾地址 + MountAnimationFormat string // 座驾动画格式 + VipIconList string //VIP ICONS JSON字符串数组 + EnterRoomScene *dto.EnterRoomSceneDTO `json:"EnterRoomScene,omitempty"` // 进入场景 + VipConfig dto.UserVipConfigDTO `json:"VipConfig,omitempty"` //VipConfig + HiddenEnterMsg string // 隐藏进入消息 +} + +// 聊天室更改上麦方式的通知 634 +type ChatroomUpdateUpSeatTypeBizData struct { + ChatroomId string + UpSeatType string // 上麦方式 1=排麦 2=自由麦 + IsRecordCharm string // 记录魅力值 1=记录 0=不记录 + SendMessageTimeGap string // 发送消息的频率 -1=关闭 + SeatCountDown string +} + +// 聊天室清除魅力的通知 635 +type ChatroomClearCharmBizData struct { + ChatroomId string + ActionType string // 操作类型 1=清楚房间所有人的魅力 2= 清除房间某个人的魅力 + UserId string +} + +// 聊天室更改麦序倒计时通知 637 +type ChatroomUpdateSeatCountdownBizData struct { + ChatroomId string + SeatCountDown string // 麦序倒计时 + +} + +// 聊天室派单对象数据 413 +type ChatroomDispatchOrderBizData struct { + ChatroomId string + DispatchOrderId string // 派单的订单ID + Status string // 状态 1=派单中 2=完成 3=弃单 +} + +// 聊天室设置背景通知 415 +type ChatroomSetBackgroundBizData struct { + ChatroomId string + BackgroundUrl string +} + +// 聊天室变更气泡背景通知 415 +type ChatroomUpdateChatBackgroundBizData struct { + ChatroomId string + UserId string + RoomMsgBgForIOS string + RoomMsgBgForAndroid string + RoomMsgBgForPc string +} + +type TextAndColor struct { + Text string + Color string +} + +// 聊天室打赏活动消息data数据结构 +type ChatroomPresentActivityMsgBizData struct { + ChatroomId string + FromUserId string + FromNickName string + FromAvatar string + FromNickNameColor string // 打赏人昵称颜色 + ActionText string // 动作文本 :赠送一个盲盒给 + ActionTextColor string // 动作文本颜色 + + ToNickName string + ToNickNameColor string // 被打赏人昵称颜色 + + PresentCount string // 物品个数 + PresentGoodsName string + PresentGoodsIcon string + PresentGoodsNameColor string + + ResultGoodsIcon string + ComboHitCount string // 连击次数 + AnimationApngUrl string // 加入播放礼物动效队列 有的话显示播放动画 + AnimationFormat string // 动画格式 SVGA APNG + FillMode string // 填充模式 1=左右 2=上下 + + IsViewFlyView string // 是否显示飘屏view 有的话显示连击信息 + // 显示到信息流 + TextList []TextAndColor // 信息流文字颜色列表 + +} + +// 聊天室活动全服飘屏通知 +type ChatroomFullScreenNoticeMsgBizData struct { + ChatroomId string + ContentIcon string + ContentText string + ContentTextColor string // 内容字体颜色 + ContentBgColor string // 背景颜色 + AnimationApngUrl string // 加入播放礼物动效队列 + BgImgUrl string // 背景图 + TextList []TextAndColor // 文字颜色列表 + StayTime string // 停留时长(秒) +} diff --git a/pkg/dto/yunxin/ImChatroomOnlineMember.go b/pkg/dto/yunxin/ImChatroomOnlineMember.go new file mode 100644 index 0000000..e877379 --- /dev/null +++ b/pkg/dto/yunxin/ImChatroomOnlineMember.go @@ -0,0 +1,10 @@ +package yunxin + +// 聊天室在线成员对象 +type ImChatroomOnlineMember struct { + MessageRoomId int `json:"roomid"` + UserId string `json:"accid"` + EnterTime int64 `json:"enterTime"` + Type string `json:"type"` + OnlineStat bool `json:"onlineStat"` +} diff --git a/pkg/dto/yunxin/ImUserExtData.go b/pkg/dto/yunxin/ImUserExtData.go new file mode 100644 index 0000000..a909e7f --- /dev/null +++ b/pkg/dto/yunxin/ImUserExtData.go @@ -0,0 +1,9 @@ +package yunxin + +// IM用户扩展信息 会话列表用户数据从IM信息获取 +type ImUserExtData struct { + VipLevel string // Vip等级 + AvatarDecoration string // 头饰 + GroupType string + VipConfig string // json字符串dto.UserVipConfigDTO +} diff --git a/pkg/dto/yunxin/UpdateRoomInfoRequest.go b/pkg/dto/yunxin/UpdateRoomInfoRequest.go new file mode 100644 index 0000000..c7eb882 --- /dev/null +++ b/pkg/dto/yunxin/UpdateRoomInfoRequest.go @@ -0,0 +1,7 @@ +package yunxin + +// 更新聊天室信息请求对象 +type UpdateRoomInfoRequest struct { + Roomid string `json:"roomid"` // 房间ID + NotifyExt string `json:"notifyExt" // 扩展信息` +} diff --git a/pkg/helper/AliAudio.go b/pkg/helper/AliAudio.go index 076d64a..6c63ed2 100644 --- a/pkg/helper/AliAudio.go +++ b/pkg/helper/AliAudio.go @@ -75,7 +75,7 @@ func TransAudioToText(fileUrl string) (result string, err error) { fmt.Println("录音文件识别请求失败,Http错误码: ", postResponse.GetHttpStatus()) return } - var postMapResult map[string]interface{} + var postMapResult map[string]any err = json.Unmarshal([]byte(postResponseContent), &postMapResult) if err != nil { panic(err) @@ -111,7 +111,7 @@ func TransAudioToText(fileUrl string) (result string, err error) { fmt.Println("识别结果查询请求失败,Http错误码:", getResponse.GetHttpStatus()) break } - var getMapResult map[string]interface{} + var getMapResult map[string]any err = json.Unmarshal([]byte(getResponseContent), &getMapResult) if err != nil { panic(err) @@ -120,11 +120,11 @@ func TransAudioToText(fileUrl string) (result string, err error) { if statusText == STATUS_RUNNING || statusText == STATUS_QUEUEING { time.Sleep(10 * time.Second) } else if statusText == STATUS_SUCCESS { - var resResult = getMapResult[KEY_RESULT].(map[string]interface{}) - fmt.Println("result:", resResult["Sentences"].([]interface{})) - ss := resResult["Sentences"].([]interface{}) + var resResult = getMapResult[KEY_RESULT].(map[string]any) + fmt.Println("result:", resResult["Sentences"].([]any)) + ss := resResult["Sentences"].([]any) for _, seg := range ss { - item := seg.(map[string]interface{}) + item := seg.(map[string]any) result += item["Text"].(string) } break diff --git a/pkg/helper/NetHelper.go b/pkg/helper/NetHelper.go index b60a3fc..7a207a3 100644 --- a/pkg/helper/NetHelper.go +++ b/pkg/helper/NetHelper.go @@ -44,7 +44,7 @@ func Get(url string) (response string) { // 发送POST请求 // url:请求地址,data:POST请求提交的数据,contentType:请求体格式,如:application/json // response:请求返回的内容 -func Post(url string, data interface{}, header map[string]string) (response string) { +func Post(url string, data any, header map[string]string) (response string) { jsonStr, _ := json.Marshal(data) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) if err != nil { diff --git a/pkg/helper/string_util.go b/pkg/helper/string_util.go index 1113b85..52c87a8 100644 --- a/pkg/helper/string_util.go +++ b/pkg/helper/string_util.go @@ -78,7 +78,7 @@ func ListToSet(list []string) (set []string) { return } -func ToJson(source interface{}) []byte { +func ToJson(source any) []byte { b, _ := json.Marshal(source) return b } diff --git a/pkg/htools/StringBuilder.go b/pkg/htools/StringBuilder.go index fe4127a..ba91b82 100644 --- a/pkg/htools/StringBuilder.go +++ b/pkg/htools/StringBuilder.go @@ -13,7 +13,7 @@ func NewStringBuilder() *StringBuilder { return &StringBuilder{buf: bytes.Buffer{}} } -func (this *StringBuilder) Append(obj interface{}) *StringBuilder { +func (this *StringBuilder) Append(obj any) *StringBuilder { this.buf.WriteString(fmt.Sprintf("%v", obj)) return this } diff --git a/pkg/htools/Tools.go b/pkg/htools/Tools.go index 4bbe49e..778aa9c 100644 --- a/pkg/htools/Tools.go +++ b/pkg/htools/Tools.go @@ -270,13 +270,13 @@ func ByteSplit(buf []byte, lim int) [][]byte { } // 强类型数组转为interface类型的数组 -func ToSlice(arr interface{}) []interface{} { +func ToSlice(arr any) []any { v := reflect.ValueOf(arr) if v.Kind() != reflect.Slice { panic("toslice arr not slice") } l := v.Len() - ret := make([]interface{}, l) + ret := make([]any, l) for i := 0; i < l; i++ { ret[i] = v.Index(i).Interface() } @@ -284,10 +284,10 @@ func ToSlice(arr interface{}) []interface{} { } // 从字符串数组随机获取一个数组 -func GetRandArrayFromArray(sourceArr []interface{}, resultCount int) (resultArr []interface{}) { +func GetRandArrayFromArray(sourceArr []any, resultCount int) (resultArr []any) { // 结果 - resultArr = make([]interface{}, 0) + resultArr = make([]any, 0) if len(sourceArr) < resultCount { return @@ -329,7 +329,7 @@ func IPToUint32(ip string) (uint32, error) { return uint32(num), nil } -func JsonStr(v interface{}) string { +func JsonStr(v any) string { b, _ := json.Marshal(v) return string(b) } diff --git a/pkg/log/zap.go b/pkg/log/zap.go index 72222f3..52be695 100644 --- a/pkg/log/zap.go +++ b/pkg/log/zap.go @@ -121,28 +121,28 @@ func Error(msg string, fields ...zap.Field) { Log.Error(msg, fields...) } -func InfoFWithCtx(ctx context.Context, msg string, args ...interface{}) { +func InfoFWithCtx(ctx context.Context, msg string, args ...any) { Log.Info(fmt.Sprintf(msg, args...), traceID(ctx)...) } -func InfoF(msg string, args ...interface{}) { +func InfoF(msg string, args ...any) { msg = fmt.Sprintf(msg, args...) Info(msg) } -func WarnFWithCtx(ctx context.Context, msg string, args ...interface{}) { +func WarnFWithCtx(ctx context.Context, msg string, args ...any) { Log.Warn(fmt.Sprintf(msg, args...), traceID(ctx)...) } -func WarnF(msg string, args ...interface{}) { +func WarnF(msg string, args ...any) { Log.Warn(fmt.Sprintf(msg, args...)) } -func ErrorFWithCtx(ctx context.Context, msg string, args ...interface{}) { +func ErrorFWithCtx(ctx context.Context, msg string, args ...any) { Log.Warn(fmt.Sprintf(msg, args...), traceID(ctx)...) } -func ErrorF(msg string, args ...interface{}) { +func ErrorF(msg string, args ...any) { Log.Error(fmt.Sprintf(msg, args...)) } @@ -153,15 +153,15 @@ func (g GLog) LogMode(_ logger.LogLevel) logger.Interface { return &g } -func (g GLog) Info(_ context.Context, msg string, args ...interface{}) { +func (g GLog) Info(_ context.Context, msg string, args ...any) { Info(fmt.Sprintf(msg, args...)) } -func (g GLog) Warn(_ context.Context, msg string, args ...interface{}) { +func (g GLog) Warn(_ context.Context, msg string, args ...any) { Warn(fmt.Sprintf(msg, args...)) } -func (g GLog) Error(_ context.Context, msg string, args ...interface{}) { +func (g GLog) Error(_ context.Context, msg string, args ...any) { Error(fmt.Sprintf(msg, args...)) } @@ -173,7 +173,7 @@ func (g GLog) Trace(_ context.Context, begin time.Time, fc func() (sql string, r Info("gorm callback trace", zap.String("sql", sql), zap.Int64("rows", ra), zap.Error(err)) } -func (g GLog) Printf(msg string, args ...interface{}) { +func (g GLog) Printf(msg string, args ...any) { Info(fmt.Sprintf(msg, args...)) } @@ -181,15 +181,15 @@ func (g GLog) Printf(msg string, args ...interface{}) { type CLog struct { } -func (c CLog) Info(msg string, keysAndValues ...interface{}) { +func (c CLog) Info(msg string, keysAndValues ...any) { InfoF(msg, keysAndValues...) } // Error logs an error condition. -func (c CLog) Error(err error, msg string, keysAndValues ...interface{}) { +func (c CLog) Error(err error, msg string, keysAndValues ...any) { ErrorF(msg, keysAndValues...) } -func (c CLog) Printf(msg string, args ...interface{}) { +func (c CLog) Printf(msg string, args ...any) { InfoF(msg, args...) } diff --git a/pkg/middleware/global_panic.go b/pkg/middleware/global_panic.go index 31d48ee..bd73ba0 100644 --- a/pkg/middleware/global_panic.go +++ b/pkg/middleware/global_panic.go @@ -1,9 +1,10 @@ package middleware import ( - "github.com/gin-gonic/gin" "net/http" "runtime/debug" + + "github.com/gin-gonic/gin" ) func Recover(c *gin.Context) { @@ -25,7 +26,7 @@ func Recover(c *gin.Context) { c.Next() } -func errorToString(r interface{}) string { +func errorToString(r any) string { switch v := r.(type) { case error: return v.Error() diff --git a/pkg/partner/Apple/AppleClient.go b/pkg/partner/Apple/AppleClient.go index d83a173..958a38c 100644 --- a/pkg/partner/Apple/AppleClient.go +++ b/pkg/partner/Apple/AppleClient.go @@ -101,7 +101,7 @@ func (client *AppleClient) VerifyAppleAuthCode(authCode string) (appleUserId str resultErr = err return } - token, _ := jwt.ParseWithClaims(resultDTO.IdToken, &Claims{}, func(token *jwt.Token) (interface{}, error) { + token, _ := jwt.ParseWithClaims(resultDTO.IdToken, &Claims{}, func(token *jwt.Token) (any, error) { // Don't forget to validate the alg is what you expect: if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { return nil, fmt.Errorf("Unexpected signing method: %v ", token.Header["alg"]) @@ -120,7 +120,7 @@ func (client *AppleClient) VerifyAppleAuthCode(authCode string) (appleUserId str func (client *AppleClient) GenerateClientSecret() (secret string) { token := &jwt.Token{ - Header: map[string]interface{}{ + Header: map[string]any{ "alg": "ES256", "kid": viper.GetString("apple.KeyId"), }, @@ -152,7 +152,7 @@ func AuthKeyFromBytes(key []byte) (*ecdsa.PrivateKey, error) { } // Parse the key - var parsedKey interface{} + var parsedKey any if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { return nil, err } diff --git a/pkg/partner/WxPay/WxPayClient.go b/pkg/partner/WxPay/WxPayClient.go index 8f8ea9b..7f7a754 100644 --- a/pkg/partner/WxPay/WxPayClient.go +++ b/pkg/partner/WxPay/WxPayClient.go @@ -280,7 +280,7 @@ func (client *WxPayClient) CheckRefundNotifySign(request *http.Request) (*WxRefu if err != nil { return nil, err } - content := new(map[string]interface{}) + content := new(map[string]any) notifyReq, err := handler.ParseNotifyRequest(context.Background(), request, &content) // 如果验签未通过,或者解密失败 if err != nil { diff --git a/pkg/partner/YiDun/YiDunClient.go b/pkg/partner/YiDun/YiDunClient.go index 4861cd6..d550bdc 100644 --- a/pkg/partner/YiDun/YiDunClient.go +++ b/pkg/partner/YiDun/YiDunClient.go @@ -94,9 +94,9 @@ func (client *YiDunClient) OneClickApi(params map[string]string) (mobile string, //{"code":200,"msg":"ok","data":{"phone":"13079217909","resultCode":"0"}} var resultDTO struct { - Code int64 `json:"code"` - Msg string `json:"msg"` - Data map[string]interface{} `json:"data"` + Code int64 `json:"code"` + Msg string `json:"msg"` + Data map[string]any `json:"data"` } err2 := json.Unmarshal([]byte(result), &resultDTO) diff --git a/pkg/partner/mq/message/message_event.go b/pkg/partner/mq/message/message_event.go index 27e3a71..864849d 100644 --- a/pkg/partner/mq/message/message_event.go +++ b/pkg/partner/mq/message/message_event.go @@ -7,10 +7,10 @@ import ( // 事件 type EventMessage struct { Message - Tag EventTag // 消息标签:EventTagUser=用户 - Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新 EventFlagSave=创建或更新 EventFlagDelete=删除 - EventId string // 事件ID - EventContent interface{} // 事件内容 + Tag EventTag // 消息标签:EventTagUser=用户 + Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新 EventFlagSave=创建或更新 EventFlagDelete=删除 + EventId string // 事件ID + EventContent any // 事件内容 } type EventTag string diff --git a/pkg/partner/mq/message_client.go b/pkg/partner/mq/message_client.go index a58d138..8c5d7f6 100644 --- a/pkg/partner/mq/message_client.go +++ b/pkg/partner/mq/message_client.go @@ -586,7 +586,7 @@ func (*MessageClient) PushActiveMessage(userId, deviceId, time, platform, device } // PushErrorMessage 发布错误消息 -func (*MessageClient) PushErrorMessage(code string, content interface{}, tag message2.ErrorTag) (e error) { +func (*MessageClient) PushErrorMessage(code string, content any, tag message2.ErrorTag) (e error) { b, e := json.Marshal(content) if nil != e { return @@ -601,7 +601,7 @@ func (*MessageClient) PushErrorMessage(code string, content interface{}, tag mes } // PushEventMessage 发布事件消息 -func (*MessageClient) PushEventMessage(tag message2.EventTag, flag message2.EventFlag, eventId string, content interface{}) (e error) { +func (*MessageClient) PushEventMessage(tag message2.EventTag, flag message2.EventFlag, eventId string, content any) (e error) { message := message2.EventMessage{ Tag: tag, Flag: flag, diff --git a/pkg/partner/wxpay_utility/util.go b/pkg/partner/wxpay_utility/util.go index 94ad199..ec71fa1 100644 --- a/pkg/partner/wxpay_utility/util.go +++ b/pkg/partner/wxpay_utility/util.go @@ -498,7 +498,7 @@ func NewApiException(statusCode int, header http.Header, body []byte) error { body: body, } - bodyObject := map[string]interface{}{} + bodyObject := map[string]any{} if err := json.Unmarshal(body, &bodyObject); err == nil { if val, ok := bodyObject["code"]; ok { ret.errorCode = val.(string) diff --git a/pkg/repo/admin_privilege.gen.go b/pkg/repo/admin_privilege.gen.go index c1a8c0a..ce1e0f8 100644 --- a/pkg/repo/admin_privilege.gen.go +++ b/pkg/repo/admin_privilege.gen.go @@ -199,14 +199,14 @@ type IAdminPrivilegeDo interface { Find() ([]*model.AdminPrivilege, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminPrivilege, err error) FindInBatches(result *[]*model.AdminPrivilege, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.AdminPrivilege) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IAdminPrivilegeDo Assign(attrs ...field.AssignExpr) IAdminPrivilegeDo @@ -215,9 +215,9 @@ type IAdminPrivilegeDo interface { FirstOrInit() (*model.AdminPrivilege, error) FirstOrCreate() (*model.AdminPrivilege, error) FindByPage(offset int, limit int) (result []*model.AdminPrivilege, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IAdminPrivilegeDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IAdminPrivilegeDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -246,7 +246,7 @@ func (a adminPrivilegeDo) Clauses(conds ...clause.Expression) IAdminPrivilegeDo return a.withDO(a.DO.Clauses(conds...)) } -func (a adminPrivilegeDo) Returning(value interface{}, columns ...string) IAdminPrivilegeDo { +func (a adminPrivilegeDo) Returning(value any, columns ...string) IAdminPrivilegeDo { return a.withDO(a.DO.Returning(value, columns...)) } @@ -429,7 +429,7 @@ func (a adminPrivilegeDo) FindByPage(offset int, limit int) (result []*model.Adm return } -func (a adminPrivilegeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (a adminPrivilegeDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return @@ -439,7 +439,7 @@ func (a adminPrivilegeDo) ScanByPage(result interface{}, offset int, limit int) return } -func (a adminPrivilegeDo) Scan(result interface{}) (err error) { +func (a adminPrivilegeDo) Scan(result any) (err error) { return a.DO.Scan(result) } diff --git a/pkg/repo/admin_role.gen.go b/pkg/repo/admin_role.gen.go index 27ad61c..2e85e15 100644 --- a/pkg/repo/admin_role.gen.go +++ b/pkg/repo/admin_role.gen.go @@ -177,14 +177,14 @@ type IAdminRoleDo interface { Find() ([]*model.AdminRole, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminRole, err error) FindInBatches(result *[]*model.AdminRole, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.AdminRole) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IAdminRoleDo Assign(attrs ...field.AssignExpr) IAdminRoleDo @@ -193,9 +193,9 @@ type IAdminRoleDo interface { FirstOrInit() (*model.AdminRole, error) FirstOrCreate() (*model.AdminRole, error) FindByPage(offset int, limit int) (result []*model.AdminRole, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IAdminRoleDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IAdminRoleDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -224,7 +224,7 @@ func (a adminRoleDo) Clauses(conds ...clause.Expression) IAdminRoleDo { return a.withDO(a.DO.Clauses(conds...)) } -func (a adminRoleDo) Returning(value interface{}, columns ...string) IAdminRoleDo { +func (a adminRoleDo) Returning(value any, columns ...string) IAdminRoleDo { return a.withDO(a.DO.Returning(value, columns...)) } @@ -407,7 +407,7 @@ func (a adminRoleDo) FindByPage(offset int, limit int) (result []*model.AdminRol return } -func (a adminRoleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (a adminRoleDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return @@ -417,7 +417,7 @@ func (a adminRoleDo) ScanByPage(result interface{}, offset int, limit int) (coun return } -func (a adminRoleDo) Scan(result interface{}) (err error) { +func (a adminRoleDo) Scan(result any) (err error) { return a.DO.Scan(result) } diff --git a/pkg/repo/admin_role_privilege.gen.go b/pkg/repo/admin_role_privilege.gen.go index 38e8c68..ecc6511 100644 --- a/pkg/repo/admin_role_privilege.gen.go +++ b/pkg/repo/admin_role_privilege.gen.go @@ -175,14 +175,14 @@ type IAdminRolePrivilegeDo interface { Find() ([]*model.AdminRolePrivilege, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminRolePrivilege, err error) FindInBatches(result *[]*model.AdminRolePrivilege, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.AdminRolePrivilege) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IAdminRolePrivilegeDo Assign(attrs ...field.AssignExpr) IAdminRolePrivilegeDo @@ -191,9 +191,9 @@ type IAdminRolePrivilegeDo interface { FirstOrInit() (*model.AdminRolePrivilege, error) FirstOrCreate() (*model.AdminRolePrivilege, error) FindByPage(offset int, limit int) (result []*model.AdminRolePrivilege, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IAdminRolePrivilegeDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IAdminRolePrivilegeDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -222,7 +222,7 @@ func (a adminRolePrivilegeDo) Clauses(conds ...clause.Expression) IAdminRolePriv return a.withDO(a.DO.Clauses(conds...)) } -func (a adminRolePrivilegeDo) Returning(value interface{}, columns ...string) IAdminRolePrivilegeDo { +func (a adminRolePrivilegeDo) Returning(value any, columns ...string) IAdminRolePrivilegeDo { return a.withDO(a.DO.Returning(value, columns...)) } @@ -405,7 +405,7 @@ func (a adminRolePrivilegeDo) FindByPage(offset int, limit int) (result []*model return } -func (a adminRolePrivilegeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (a adminRolePrivilegeDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return @@ -415,7 +415,7 @@ func (a adminRolePrivilegeDo) ScanByPage(result interface{}, offset int, limit i return } -func (a adminRolePrivilegeDo) Scan(result interface{}) (err error) { +func (a adminRolePrivilegeDo) Scan(result any) (err error) { return a.DO.Scan(result) } diff --git a/pkg/repo/admin_user.gen.go b/pkg/repo/admin_user.gen.go index c9df333..254fd5d 100644 --- a/pkg/repo/admin_user.gen.go +++ b/pkg/repo/admin_user.gen.go @@ -201,14 +201,14 @@ type IAdminUserDo interface { Find() ([]*model.AdminUser, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminUser, err error) FindInBatches(result *[]*model.AdminUser, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.AdminUser) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IAdminUserDo Assign(attrs ...field.AssignExpr) IAdminUserDo @@ -217,9 +217,9 @@ type IAdminUserDo interface { FirstOrInit() (*model.AdminUser, error) FirstOrCreate() (*model.AdminUser, error) FindByPage(offset int, limit int) (result []*model.AdminUser, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IAdminUserDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IAdminUserDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -248,7 +248,7 @@ func (a adminUserDo) Clauses(conds ...clause.Expression) IAdminUserDo { return a.withDO(a.DO.Clauses(conds...)) } -func (a adminUserDo) Returning(value interface{}, columns ...string) IAdminUserDo { +func (a adminUserDo) Returning(value any, columns ...string) IAdminUserDo { return a.withDO(a.DO.Returning(value, columns...)) } @@ -431,7 +431,7 @@ func (a adminUserDo) FindByPage(offset int, limit int) (result []*model.AdminUse return } -func (a adminUserDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (a adminUserDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return @@ -441,7 +441,7 @@ func (a adminUserDo) ScanByPage(result interface{}, offset int, limit int) (coun return } -func (a adminUserDo) Scan(result interface{}) (err error) { +func (a adminUserDo) Scan(result any) (err error) { return a.DO.Scan(result) } diff --git a/pkg/repo/admin_user_role.gen.go b/pkg/repo/admin_user_role.gen.go index a23eda6..75bc086 100644 --- a/pkg/repo/admin_user_role.gen.go +++ b/pkg/repo/admin_user_role.gen.go @@ -175,14 +175,14 @@ type IAdminUserRoleDo interface { Find() ([]*model.AdminUserRole, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminUserRole, err error) FindInBatches(result *[]*model.AdminUserRole, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.AdminUserRole) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IAdminUserRoleDo Assign(attrs ...field.AssignExpr) IAdminUserRoleDo @@ -191,9 +191,9 @@ type IAdminUserRoleDo interface { FirstOrInit() (*model.AdminUserRole, error) FirstOrCreate() (*model.AdminUserRole, error) FindByPage(offset int, limit int) (result []*model.AdminUserRole, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IAdminUserRoleDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IAdminUserRoleDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -222,7 +222,7 @@ func (a adminUserRoleDo) Clauses(conds ...clause.Expression) IAdminUserRoleDo { return a.withDO(a.DO.Clauses(conds...)) } -func (a adminUserRoleDo) Returning(value interface{}, columns ...string) IAdminUserRoleDo { +func (a adminUserRoleDo) Returning(value any, columns ...string) IAdminUserRoleDo { return a.withDO(a.DO.Returning(value, columns...)) } @@ -405,7 +405,7 @@ func (a adminUserRoleDo) FindByPage(offset int, limit int) (result []*model.Admi return } -func (a adminUserRoleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (a adminUserRoleDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return @@ -415,7 +415,7 @@ func (a adminUserRoleDo) ScanByPage(result interface{}, offset int, limit int) ( return } -func (a adminUserRoleDo) Scan(result interface{}) (err error) { +func (a adminUserRoleDo) Scan(result any) (err error) { return a.DO.Scan(result) } diff --git a/pkg/repo/data_attach.gen.go b/pkg/repo/data_attach.gen.go index d6dbf02..5e4b660 100644 --- a/pkg/repo/data_attach.gen.go +++ b/pkg/repo/data_attach.gen.go @@ -217,14 +217,14 @@ type IDataAttachDo interface { Find() ([]*model.DataAttach, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.DataAttach, err error) FindInBatches(result *[]*model.DataAttach, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.DataAttach) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IDataAttachDo Assign(attrs ...field.AssignExpr) IDataAttachDo @@ -233,9 +233,9 @@ type IDataAttachDo interface { FirstOrInit() (*model.DataAttach, error) FirstOrCreate() (*model.DataAttach, error) FindByPage(offset int, limit int) (result []*model.DataAttach, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IDataAttachDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IDataAttachDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -264,7 +264,7 @@ func (d dataAttachDo) Clauses(conds ...clause.Expression) IDataAttachDo { return d.withDO(d.DO.Clauses(conds...)) } -func (d dataAttachDo) Returning(value interface{}, columns ...string) IDataAttachDo { +func (d dataAttachDo) Returning(value any, columns ...string) IDataAttachDo { return d.withDO(d.DO.Returning(value, columns...)) } @@ -447,7 +447,7 @@ func (d dataAttachDo) FindByPage(offset int, limit int) (result []*model.DataAtt return } -func (d dataAttachDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (d dataAttachDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = d.Count() if err != nil { return @@ -457,7 +457,7 @@ func (d dataAttachDo) ScanByPage(result interface{}, offset int, limit int) (cou return } -func (d dataAttachDo) Scan(result interface{}) (err error) { +func (d dataAttachDo) Scan(result any) (err error) { return d.DO.Scan(result) } diff --git a/pkg/repo/game.gen.go b/pkg/repo/game.gen.go index 16fdc8c..30e1d59 100644 --- a/pkg/repo/game.gen.go +++ b/pkg/repo/game.gen.go @@ -179,14 +179,14 @@ type IGameDo interface { Find() ([]*model.Game, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Game, err error) FindInBatches(result *[]*model.Game, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.Game) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IGameDo Assign(attrs ...field.AssignExpr) IGameDo @@ -195,9 +195,9 @@ type IGameDo interface { FirstOrInit() (*model.Game, error) FirstOrCreate() (*model.Game, error) FindByPage(offset int, limit int) (result []*model.Game, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IGameDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IGameDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -226,7 +226,7 @@ func (g gameDo) Clauses(conds ...clause.Expression) IGameDo { return g.withDO(g.DO.Clauses(conds...)) } -func (g gameDo) Returning(value interface{}, columns ...string) IGameDo { +func (g gameDo) Returning(value any, columns ...string) IGameDo { return g.withDO(g.DO.Returning(value, columns...)) } @@ -409,7 +409,7 @@ func (g gameDo) FindByPage(offset int, limit int) (result []*model.Game, count i return } -func (g gameDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (g gameDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = g.Count() if err != nil { return @@ -419,7 +419,7 @@ func (g gameDo) ScanByPage(result interface{}, offset int, limit int) (count int return } -func (g gameDo) Scan(result interface{}) (err error) { +func (g gameDo) Scan(result any) (err error) { return g.DO.Scan(result) } diff --git a/pkg/repo/trade_commodity.gen.go b/pkg/repo/trade_commodity.gen.go index 168318f..6985da6 100644 --- a/pkg/repo/trade_commodity.gen.go +++ b/pkg/repo/trade_commodity.gen.go @@ -191,14 +191,14 @@ type ITradeCommodityDo interface { Find() ([]*model.TradeCommodity, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TradeCommodity, err error) FindInBatches(result *[]*model.TradeCommodity, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.TradeCommodity) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) ITradeCommodityDo Assign(attrs ...field.AssignExpr) ITradeCommodityDo @@ -207,9 +207,9 @@ type ITradeCommodityDo interface { FirstOrInit() (*model.TradeCommodity, error) FirstOrCreate() (*model.TradeCommodity, error) FindByPage(offset int, limit int) (result []*model.TradeCommodity, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) ITradeCommodityDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) ITradeCommodityDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -238,7 +238,7 @@ func (t tradeCommodityDo) Clauses(conds ...clause.Expression) ITradeCommodityDo return t.withDO(t.DO.Clauses(conds...)) } -func (t tradeCommodityDo) Returning(value interface{}, columns ...string) ITradeCommodityDo { +func (t tradeCommodityDo) Returning(value any, columns ...string) ITradeCommodityDo { return t.withDO(t.DO.Returning(value, columns...)) } @@ -421,7 +421,7 @@ func (t tradeCommodityDo) FindByPage(offset int, limit int) (result []*model.Tra return } -func (t tradeCommodityDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (t tradeCommodityDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = t.Count() if err != nil { return @@ -431,7 +431,7 @@ func (t tradeCommodityDo) ScanByPage(result interface{}, offset int, limit int) return } -func (t tradeCommodityDo) Scan(result interface{}) (err error) { +func (t tradeCommodityDo) Scan(result any) (err error) { return t.DO.Scan(result) } diff --git a/pkg/repo/user.gen.go b/pkg/repo/user.gen.go index e30795b..fe35410 100644 --- a/pkg/repo/user.gen.go +++ b/pkg/repo/user.gen.go @@ -179,14 +179,14 @@ type IUserDo interface { Find() ([]*model.User, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.User) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IUserDo Assign(attrs ...field.AssignExpr) IUserDo @@ -195,9 +195,9 @@ type IUserDo interface { FirstOrInit() (*model.User, error) FirstOrCreate() (*model.User, error) FindByPage(offset int, limit int) (result []*model.User, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IUserDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IUserDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -226,7 +226,7 @@ func (u userDo) Clauses(conds ...clause.Expression) IUserDo { return u.withDO(u.DO.Clauses(conds...)) } -func (u userDo) Returning(value interface{}, columns ...string) IUserDo { +func (u userDo) Returning(value any, columns ...string) IUserDo { return u.withDO(u.DO.Returning(value, columns...)) } @@ -409,7 +409,7 @@ func (u userDo) FindByPage(offset int, limit int) (result []*model.User, count i return } -func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (u userDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = u.Count() if err != nil { return @@ -419,7 +419,7 @@ func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int return } -func (u userDo) Scan(result interface{}) (err error) { +func (u userDo) Scan(result any) (err error) { return u.DO.Scan(result) } diff --git a/pkg/repo/user_game_role.gen.go b/pkg/repo/user_game_role.gen.go index 63dd60c..427abfd 100644 --- a/pkg/repo/user_game_role.gen.go +++ b/pkg/repo/user_game_role.gen.go @@ -187,14 +187,14 @@ type IUserGameRoleDo interface { Find() ([]*model.UserGameRole, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserGameRole, err error) FindInBatches(result *[]*model.UserGameRole, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.UserGameRole) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IUserGameRoleDo Assign(attrs ...field.AssignExpr) IUserGameRoleDo @@ -203,9 +203,9 @@ type IUserGameRoleDo interface { FirstOrInit() (*model.UserGameRole, error) FirstOrCreate() (*model.UserGameRole, error) FindByPage(offset int, limit int) (result []*model.UserGameRole, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IUserGameRoleDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IUserGameRoleDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -234,7 +234,7 @@ func (u userGameRoleDo) Clauses(conds ...clause.Expression) IUserGameRoleDo { return u.withDO(u.DO.Clauses(conds...)) } -func (u userGameRoleDo) Returning(value interface{}, columns ...string) IUserGameRoleDo { +func (u userGameRoleDo) Returning(value any, columns ...string) IUserGameRoleDo { return u.withDO(u.DO.Returning(value, columns...)) } @@ -417,7 +417,7 @@ func (u userGameRoleDo) FindByPage(offset int, limit int) (result []*model.UserG return } -func (u userGameRoleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (u userGameRoleDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = u.Count() if err != nil { return @@ -427,7 +427,7 @@ func (u userGameRoleDo) ScanByPage(result interface{}, offset int, limit int) (c return } -func (u userGameRoleDo) Scan(result interface{}) (err error) { +func (u userGameRoleDo) Scan(result any) (err error) { return u.DO.Scan(result) } diff --git a/pkg/repo/user_game_role_prop.gen.go b/pkg/repo/user_game_role_prop.gen.go index dce2c78..56ec2ee 100644 --- a/pkg/repo/user_game_role_prop.gen.go +++ b/pkg/repo/user_game_role_prop.gen.go @@ -199,14 +199,14 @@ type IUserGameRolePropDo interface { Find() ([]*model.UserGameRoleProp, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserGameRoleProp, err error) FindInBatches(result *[]*model.UserGameRoleProp, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error + Pluck(column field.Expr, dest any) error Delete(...*model.UserGameRoleProp) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Update(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + Updates(value any) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value any) (info gen.ResultInfo, err error) UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateColumns(value any) (info gen.ResultInfo, err error) UpdateFrom(q gen.SubQuery) gen.Dao Attrs(attrs ...field.AssignExpr) IUserGameRolePropDo Assign(attrs ...field.AssignExpr) IUserGameRolePropDo @@ -215,9 +215,9 @@ type IUserGameRolePropDo interface { FirstOrInit() (*model.UserGameRoleProp, error) FirstOrCreate() (*model.UserGameRoleProp, error) FindByPage(offset int, limit int) (result []*model.UserGameRoleProp, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IUserGameRolePropDo + ScanByPage(result any, offset int, limit int) (count int64, err error) + Scan(result any) (err error) + Returning(value any, columns ...string) IUserGameRolePropDo UnderlyingDB() *gorm.DB schema.Tabler } @@ -246,7 +246,7 @@ func (u userGameRolePropDo) Clauses(conds ...clause.Expression) IUserGameRolePro return u.withDO(u.DO.Clauses(conds...)) } -func (u userGameRolePropDo) Returning(value interface{}, columns ...string) IUserGameRolePropDo { +func (u userGameRolePropDo) Returning(value any, columns ...string) IUserGameRolePropDo { return u.withDO(u.DO.Returning(value, columns...)) } @@ -429,7 +429,7 @@ func (u userGameRolePropDo) FindByPage(offset int, limit int) (result []*model.U return } -func (u userGameRolePropDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { +func (u userGameRolePropDo) ScanByPage(result any, offset int, limit int) (count int64, err error) { count, err = u.Count() if err != nil { return @@ -439,7 +439,7 @@ func (u userGameRolePropDo) ScanByPage(result interface{}, offset int, limit int return } -func (u userGameRolePropDo) Scan(result interface{}) (err error) { +func (u userGameRolePropDo) Scan(result any) (err error) { return u.DO.Scan(result) } diff --git a/pkg/res/abstract.go b/pkg/res/abstract.go index fef531d..cfb253b 100644 --- a/pkg/res/abstract.go +++ b/pkg/res/abstract.go @@ -35,24 +35,24 @@ func WrapApi(f Fn) gin.HandlerFunc { } type Response struct { - Code int `json:"code"` - Msg string `json:"msg,omitempty"` - Data interface{} `json:"data,omitempty"` - Cause error `json:"-"` + Code int `json:"code"` + Msg string `json:"msg,omitempty"` + Data any `json:"data,omitempty"` + Cause error `json:"-"` } type PageData struct { - Total int64 `json:"total"` - CountPage int64 `json:"count_page"` - HasNext bool `json:"has_next"` - List interface{} `json:"list"` + Total int64 `json:"total"` + CountPage int64 `json:"count_page"` + HasNext bool `json:"has_next"` + List any `json:"list"` } func (t Response) Success() bool { return t.Code == CodeSuccess } -func Success(data interface{}) Response { +func Success(data any) Response { return Response{ Code: CodeSuccess, Msg: "", @@ -67,7 +67,7 @@ func Empty() Response { } } -func Page(pageable req.Page, count int64, data interface{}) Response { +func Page(pageable req.Page, count int64, data any) Response { cnt := (count + pageable.Size - 1) / pageable.Size return Success(PageData{ Total: count, @@ -128,7 +128,7 @@ func AuthFailed(msg string) Response { } } -func FailedF(msg string, args ...interface{}) Response { +func FailedF(msg string, args ...any) Response { return Response{ Code: CodeFailed, Msg: fmt.Sprintf(msg, args...), diff --git a/pkg/res/match.go b/pkg/res/match.go index ba0a055..b8b4fbc 100644 --- a/pkg/res/match.go +++ b/pkg/res/match.go @@ -35,12 +35,12 @@ type WinTeam struct { } type MatchItem struct { - BasicInfo BasicInfo `json:"basic_info"` - IsFollow int64 `json:"is_follow"` - PageToken string `json:"page_token"` - RecentMatch interface{} `json:"recent_match"` - Teams []Team `json:"teams"` - WinTeam WinTeam `json:"win_team"` + BasicInfo BasicInfo `json:"basic_info"` + IsFollow int64 `json:"is_follow"` + PageToken string `json:"page_token"` + RecentMatch any `json:"recent_match"` + Teams []Team `json:"teams"` + WinTeam WinTeam `json:"win_team"` } type Data struct { APIGo bool `json:"api_go"` @@ -49,10 +49,10 @@ type Data struct { } type MatchResponse struct { - Data Data `json:"data"` - Errcode int64 `json:"errcode"` - Message interface{} `json:"message"` - Success bool `json:"success"` + Data Data `json:"data"` + Errcode int64 `json:"errcode"` + Message any `json:"message"` + Success bool `json:"success"` } // 详情返回的 @@ -159,23 +159,23 @@ type PromotionFromTt struct { type MatchDetailResponse struct { Data MatchDetailData `json:"data"` Errcode int64 `json:"errcode"` - Message interface{} `json:"message"` + Message any `json:"message"` Success bool `json:"success"` } // 赛程的 type MatchBattleResponse struct { - Data BattleData `json:"data"` - Errcode int64 `json:"errcode"` - Message interface{} `json:"message"` - Success bool `json:"success"` + Data BattleData `json:"data"` + Errcode int64 `json:"errcode"` + Message any `json:"message"` + Success bool `json:"success"` } type BattleData struct { - Matches []Match `json:"matches"` - StateVer string `json:"state_ver"` - StateVerV1 interface{} `json:"state_ver_v1"` - TodayMcTotal string `json:"today_mc_total"` + Matches []Match `json:"matches"` + StateVer string `json:"state_ver"` + StateVerV1 any `json:"state_ver_v1"` + TodayMcTotal string `json:"today_mc_total"` } type Match struct { @@ -212,23 +212,23 @@ type McInfo struct { } type T1Info struct { - Bonus string `json:"bonus"` - Country string `json:"country"` - DispName string `json:"disp_name"` - ID string `json:"id"` - Logo string `json:"logo"` - Rank string `json:"rank"` - VRank interface{} `json:"v_rank"` + Bonus string `json:"bonus"` + Country string `json:"country"` + DispName string `json:"disp_name"` + ID string `json:"id"` + Logo string `json:"logo"` + Rank string `json:"rank"` + VRank any `json:"v_rank"` } type T2Info struct { - Bonus string `json:"bonus"` - Country string `json:"country"` - DispName string `json:"disp_name"` - ID string `json:"id"` - Logo string `json:"logo"` - Rank string `json:"rank"` - VRank interface{} `json:"v_rank"` + Bonus string `json:"bonus"` + Country string `json:"country"` + DispName string `json:"disp_name"` + ID string `json:"id"` + Logo string `json:"logo"` + Rank string `json:"rank"` + VRank any `json:"v_rank"` } type UserData struct { @@ -313,7 +313,7 @@ type Status struct { type PlayerRankResponse struct { Data PlayerRankData `json:"data"` Errcode int64 `json:"errcode"` - Message interface{} `json:"message"` + Message any `json:"message"` Success bool `json:"success"` } @@ -340,7 +340,7 @@ type FieldValues struct { type TeamRankResponse struct { Data TeamRankData `json:"data"` Errcode int64 `json:"errcode"` - Message interface{} `json:"message"` + Message any `json:"message"` Success bool `json:"success"` } diff --git a/pkg/secure/jwt.go b/pkg/secure/jwt.go index 4a1f58d..0f678f1 100644 --- a/pkg/secure/jwt.go +++ b/pkg/secure/jwt.go @@ -71,7 +71,7 @@ func VerifyToken(tokenStr, publicKey string) (access bool, claims Claims, e erro return } var token *jwt.Token - if token, e = jwt.ParseWithClaims(tokenStr, &claims, func(token *jwt.Token) (interface{}, error) { + if token, e = jwt.ParseWithClaims(tokenStr, &claims, func(token *jwt.Token) (any, error) { return ecdsaKeyPub, nil }); e != nil { return diff --git a/pkg/tools/jwt.go b/pkg/tools/jwt.go index b40f7c8..3af97c0 100644 --- a/pkg/tools/jwt.go +++ b/pkg/tools/jwt.go @@ -80,7 +80,7 @@ func VerifyToken(tokenStr string) (access bool, claims Claims, e error) { return } var token *jwt.Token - if token, e = jwt.ParseWithClaims(tokenStr, &claims, func(token *jwt.Token) (interface{}, error) { + if token, e = jwt.ParseWithClaims(tokenStr, &claims, func(token *jwt.Token) (any, error) { return ecdsaKeyPub, nil }); e != nil { return diff --git a/pkg/utils/time_tool.go b/pkg/utils/time_tool.go index 9c4a00e..5d4fd44 100644 --- a/pkg/utils/time_tool.go +++ b/pkg/utils/time_tool.go @@ -3,8 +3,9 @@ package utils import ( "database/sql/driver" "fmt" - "github.com/anxpp/common-utils/str" "time" + + "github.com/anxpp/common-utils/str" ) type Time struct { @@ -19,7 +20,7 @@ func (t *Time) UnmarshalJSON(data []byte) (e error) { func (t Time) MarshalJSON() ([]byte, error) { return ([]byte)(fmt.Sprintf("\"%s\"", t.Time.Format(str.TimeLayout))), nil } -func (t *Time) Scan(value interface{}) error { +func (t *Time) Scan(value any) error { bytes, _ := value.([]byte) tt, _ := time.ParseInLocation(str.TimeLayout, string(bytes), time.Local) *t = Time{