当前位置: 首页>>代码示例>>Python>>正文


Python userentitymanager.UserEntityManager类代码示例

本文整理汇总了Python中user.userentitymanager.UserEntityManager的典型用法代码示例。如果您正苦于以下问题:Python UserEntityManager类的具体用法?Python UserEntityManager怎么用?Python UserEntityManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UserEntityManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getAllMyFocuses

    def getAllMyFocuses(self, sessionKey, _request):
        """
        :type sessionKey: str
        :type _request: message.gate.ipostoper.IPostOper_Getallmyfocuses_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        tb = MongoDatabase.findTableByMessageType(TUserFan)
        if not tb:
            Logger.log("Table {} not found".format(TUserFan.__name__))
            ErrorCodeManager.raiseError("ErrorDb_TableNotFound")

        tFocusList = tb.findManyWithQuey({TUserFan.fn_fanUserId: userEntity.getUserId()})

        sFocusList = SeqMyFocus()

        for tFan in tFocusList:
            userEntity = UserEntityManager.findUserEntityByUserId(tFan.myUserId)
            if not userEntity:
                Logger.log("getAllMyFocuses",
                           "UserNotFound:", tFan.myUserId)
                continue

            sFocus = SMyFocus()
            sFocus.userInfo = userEntity.getUserBriefInfo()
            sFocus.operDt = tFan.createDt

            sFocusList.append(sFocus)

        _request.response(sFocusList)
开发者ID:bropony,项目名称:gamit,代码行数:32,代码来源:ipostoperimpl.py

示例2: login

    def login(self, loginInfo, _request):
        """
        :type loginInfo: message.gate.gatemsg.SLogin
        :type _request: message.gate.ilogin.ILogin_Login_Request
        """

        Logger.log("ILoginImpl.login: ", loginInfo.account)

        userEntity = UserEntityManager.findUserEntityByAccount(loginInfo.account)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")

        if not userEntity.isPasswordValid(loginInfo.password):
            ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")

        if not userEntity.isDataLoaded():
            userDataView = UserDbHelper.loadUserDataView(userEntity.getUserId())
            userEntity.updateUserData(userDataView)

        sessionKey = MyUuid.getUuid()
        userEntity.updateDeviceCodeAndSessionKey(loginInfo.deviceCode, sessionKey)
        UserEntityManager.onUserLogin(userEntity, _request.connId, loginInfo.deviceCode)

        loginReturn = userEntity.getLoginReturn()
        _request.response(loginReturn)

        DbSaver.saveTable(userEntity.getTUserSettings())
        DbSaver.saveTable(userEntity.getTUserBasic())
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:iloginimpl.py

示例3: unfollowAUser

    def unfollowAUser(self, sessionKey, userId, _request):
        """
        :type sessionKey: str
        :type userId: str
        :type _request: message.gate.ipostoper.IPostOper_Unfollowauser_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        hisEntity = UserEntityManager.findUserEntityByUserId(userId)
        if not hisEntity:
            ErrorCodeManager.raiseError("ErrorGate_noSuchUser")

        tb = MongoDatabase.findTableByMessageType(TUserFan)
        if not tb:
            Logger.log("Table {} not found".format(TUserFan.__name__))
            ErrorCodeManager.raiseError("ErrorDb_TableNotFound")

        fanFound = tb.findOneWithQuery({TUserFan.fn_fanUserId: userEntity.getUserId(), TUserFan.fn_myUserId: userId})
        if not fanFound:
            ErrorCodeManager.raiseError("ErrorGate_didNotFollowThisUser")

        tb.delete({TUserFan.fn_recordId: fanFound.recordId}, delete_one=True)

        _request.response()

        userEntity.getTUserProperty().focusNum -= 1
        hisEntity.getTUserProperty().fanNum -= 1

        DbSaver.saveTable(userEntity.getTUserProperty())
        DbSaver.saveTable(hisEntity.getTUserProperty())
开发者ID:bropony,项目名称:gamit,代码行数:32,代码来源:ipostoperimpl.py

示例4: replyUserPostComment

    def replyUserPostComment(self, sessionKey, postId, commentId, mentionedUserId, comments, _request):
        """
        :type sessionKey: str
        :type postId: str
        :type commentId: str
        :type mentionedUserId: str
        :type comments: str
        :type _request: message.gate.ipostoper.IPostOper_Replyuserpostcomment_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        wuPost = PostManager.findPostByPostId(postId)
        if not wuPost:
            ErrorCodeManager.raiseError("ErrorGate_noSuchPost")

        mentionedEntity = UserEntityManager.findUserEntityByUserId(mentionedUserId)
        if not mentionedEntity:
            ErrorCodeManager.raiseError("ErrorGate_mentionedUserNotExisted")

        if not wuPost.hasComment(commentId):
            ErrorCodeManager.raiseError("ErrorGate_dstCommentNotExisted")

        commentId = PostHelper.addNewCommentToUserPost(userEntity,
                        wuPost, EInteractiveType.Comment, comments, [mentionedUserId], True)

        _request.response(commentId)
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:ipostoperimpl.py

示例5: getFansByPageIndex

    def getFansByPageIndex(self, sessionKey, pageIndex, _request):
        """
        :type sessionKey: str
        :type pageIndex: int
        :type _request: message.gate.ipostoper.IPostOper_Getfansbypageindex_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        numPerPage = 100
        tb = MongoDatabase.findTableByMessageType(TUserFan)
        if not tb:
            Logger.log("Table {} not found".format(TUserFan.__name__))
            ErrorCodeManager.raiseError("ErrorDb_TableNotFound")

        skips = numPerPage * pageIndex
        tFanList = tb.findManyWithQuey({TUserFan.fn_myUserId: userEntity.getUserId()},
                                  limit=numPerPage, skip=skips, sort=MongoDatabase.SortByIdDesc)

        sFanList = SeqMyFan()
        for tFan in tFanList:
            userEntity = UserEntityManager.findUserEntityByUserId(tFan.fanUserId)
            if not userEntity:
                Logger.log("getFansByPageIndex",
                           "UserNotFound:", tFan.fanUserId)
                continue

            sFan = SMyFan()
            sFan.fanInfo = userEntity.getUserBriefInfo()
            sFan.operDt = tFan.createDt

            sFanList.append(sFan)

        _request.response(sFanList)
开发者ID:bropony,项目名称:gamit,代码行数:35,代码来源:ipostoperimpl.py

示例6: replySysTopicComment

    def replySysTopicComment(self, sessionKey, topicId, dstCommentId, mentionedUserId, comments, _request):
        """
        :type sessionKey: str
        :type topicId: str
        :type dstCommentId: str
        :type mentionedUserId: str
        :type comments: str
        :type _request: message.gate.ipostoper.IPostOper_Replysystopiccomment_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        wSysTopic = SysTopicManager.getSysTopicByTopicId(topicId)
        if not wSysTopic:
            ErrorCodeManager.raiseError("ErrorGate_noSuchSysTopic")

        mentionedEntity = UserEntityManager.findUserEntityByUserId(mentionedUserId)
        if not mentionedEntity:
            ErrorCodeManager.raiseError("ErrorGate_mentionedUserNotExisted")

        if not wSysTopic.hasComment(dstCommentId):
            ErrorCodeManager.raiseError("ErrorGate_dstCommentNotExisted")

        commentId = SysTopicHelper.addNewCommentToSysTopic(
            userEntity, wSysTopic, EInteractiveType.Comment, comments, [mentionedUserId])

        _request.response(commentId)
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:ipostoperimpl.py

示例7: loadEveryThing

def loadEveryThing():
    """
    # load anything necessary before the server starts
    """
    UserEntityManager.loadAllUserBasics()
    UserEntityManager.loadAllUserBasics()
    SysTopicManager.loadSysTopics()
    PostManager.loadPosts()
开发者ID:bropony,项目名称:gamit,代码行数:8,代码来源:gate.py

示例8: followAUser

    def followAUser(self, sessionKey, userId, _request):
        """
        :type sessionKey: str
        :type userId: str
        :type _request: message.gate.ipostoper.IPostOper_Followauser_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        hisEntity = UserEntityManager.findUserEntityByUserId(userId)
        if not hisEntity:
            ErrorCodeManager.raiseError("ErrorGate_noSuchUser")

        tb = MongoDatabase.findTableByMessageType(TUserFan)
        if not tb:
            Logger.log("Table {} not found".format(TUserFan.__name__))
            ErrorCodeManager.raiseError("ErrorDb_TableNotFound")

        res = tb.findOneWithQuery({TUserFan.fn_fanUserId: userEntity.getUserId(),
                                   TUserFan.fn_myUserId: hisEntity.getUserId()})

        if res:
            ErrorCodeManager.raiseError("ErrorGate_hasFollowedThisUser")

        tFan = TUserFan()
        tFan.recordId = MyUuid.getUuid()
        tFan.fanUserId = userEntity.getUserId()
        tFan.myUserId = hisEntity.getUserId()
        DbSaver.saveTable(tFan)

        sNewFocus = SMyFocus()
        sNewFocus.userInfo = hisEntity.getUserBriefInfo()
        sNewFocus.operDt = tFan.createDt

        # response
        _request.response(sNewFocus)

        sNewFan = SMyFan()
        sNewFan.fanInfo = userEntity.getUserBriefInfo()
        sNewFan.operDt = tFan.createDt
        hisEntity.addNewFan(sNewFan)

        userEntity.getTUserProperty().focusNum += 1
        hisEntity.getTUserProperty().fanNum += 1

        DbSaver.saveTable(userEntity.getTUserProperty())
        DbSaver.saveTable(hisEntity.getTUserProperty())
开发者ID:bropony,项目名称:gamit,代码行数:48,代码来源:ipostoperimpl.py

示例9: unupvoteSysTopic

    def unupvoteSysTopic(self, sessionKey, topicId, _request):
        """
        :type sessionKey: str
        :type topicId: str
        :type _request: message.gate.ipostoper.IPostOper_Unupvotesystopic_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        wSysTopic = SysTopicManager.getSysTopicByTopicId(topicId)
        if not wSysTopic:
            ErrorCodeManager.raiseError("ErrorGate_noSuchSysTopic")

        commentId = wSysTopic.removeUpvoteRecordByUserId(userEntity.getUserId())
        if not commentId:
            ErrorCodeManager.raiseError("ErrorGate_noSuchUpvote")

        wSysTopic.getTSysTopic().upvotedTimes -= 1
        DbSaver.saveTable(wSysTopic.getTSysTopic())

        DbSaver.deleteFromTable(TSysTopicComment, {TSysTopicComment.fn_commentId: commentId})

        _request.response()

        DbLogHepler.logSysTopicOper(userEntity.getLogUserInfo(),
                                    wSysTopic.getTopicId(),
                                    ELogPostOperType.Unupvote)
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:ipostoperimpl.py

示例10: updateAdress

    def updateAdress(self, sessionKey, addressInfo, _request):
        """
        :type sessionKey: str
        :type addressInfo: message.common.publicmsg.SAddress
        :type _request: message.gate.iuserinfo.IUserInfo_Updateadress_Request
        """

        if not addressInfo.recipientName:
            ErrorCodeManager.raiseError("ErrorGate_addressRecipentNameEmpty")

        if not addressInfo.recipientPhoneNum:
            ErrorCodeManager.raiseError("ErrorGate_addressRecipentPhoneNumEmpty")

        if not addressInfo.city:
            ErrorCodeManager.raiseError("ErrorGate_addressCityEmpty")

        if not addressInfo.details:
            ErrorCodeManager.raiseError("ErrorGate_addressDetailsEmpty")

        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        addressIndex = userEntity.updateUserAddress(addressInfo)
        DbSaver.saveTable(userEntity.getTUserAddress())

        _request.response(addressIndex)
开发者ID:bropony,项目名称:gamit,代码行数:27,代码来源:iuserinfoimpl.py

示例11: getFormerSysTopics

    def getFormerSysTopics(self, deviceCode, tagId, oldestTopicDt, targetNum, imgFormat, _request):
        """
        :type deviceCode: str
        :type tagId: str
        :type oldestTopicDt: datetime.datetime
        :type targetNum: int
        :type _request: message.gate.ipostoper.IPostOper_Getformersystopics_Request
        """

        tag = TopicTagConfigManager.getTagNameByTagId(tagId)

        sysTopicList = SysTopicManager.getOlderSysTopicInDateOrder(tag, oldestTopicDt, targetNum, imgFormat)
        _request.response(sysTopicList)

        # loggings
        userEntity = UserEntityManager.findUserEntityByDeviceCode(deviceCode)
        if userEntity:
            logUserInfo = userEntity.getLogUserInfo()
        else:
            logUserInfo = SLogUserInfo()
            logUserInfo.deviceCode = deviceCode

        tags = SeqString()
        tags.append(tag)
        DbLogHepler.logRefreshSysTopic(logUserInfo, tags)
开发者ID:bropony,项目名称:gamit,代码行数:25,代码来源:ipostoperimpl.py

示例12: updateFamilyMembers

    def updateFamilyMembers(self, sessionKey, familyMembers, _request):
        """
        :type sessionKey: str
        :type familyMembers: list[message.gate.gatemsg.SFamilyMember]
        :type _request: IUserInfo_Updatefamilymembers_Request
        """

        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        indexSet = set()
        tfms = SeqTFamilyMember()

        for fm in familyMembers:
            if fm.index in indexSet:
                Logger.log("Duplicated index:", fm.index)
                ErrorCodeManager.raiseError("ErrorGate_clientInputError")

            if not EGender.isValueValid(fm.gender):
                Logger.log("Invalid Gender:", fm.index)
                ErrorCodeManager.raiseError("ErrorGate_clientInputError")

            tfm = userEntity.updateFamilyMember(fm)
            tfms.append(tfm)

        DbSaver.saveTableBatch(tfms)
        _request.response()
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:iuserinfoimpl.py

示例13: unupvoteUserPost

    def unupvoteUserPost(self, sessionKey, postId, _request):
        """
        :type sessionKey: str
        :type postId: str
        :type _request: message.gate.ipostoper.IPostOper_Unupvoteuserpost_Request
        """

        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        wuPost = PostManager.findPostByPostId(postId)
        if not wuPost:
            ErrorCodeManager.raiseError("ErrorGate_noSuchPost")

        commentId = wuPost.removeUpvoteRecordByUserId(userEntity.getUserId())

        if not commentId:
            ErrorCodeManager.raiseError("ErrorGate_noSuchUpvote")

        DbSaver.deleteFromTable(TUserPostComment, {TUserPostComment.fn_commentId: commentId})

        wuPost.getTUserPost().upvotedTimes -= 1
        DbSaver.saveTable(wuPost.getTUserPost())

        _request.response()

        DbLogHepler.logUserPostOper(userEntity.getLogUserInfo(),
                                    wuPost.getPostId(),
                                    ELogPostOperType.Unupvote)
开发者ID:bropony,项目名称:gamit,代码行数:30,代码来源:ipostoperimpl.py

示例14: addNewCommentToUserPost

    def addNewCommentToUserPost(userEntity, wuPost, interactiveType, content="", mentiondUsers=[], replyComment=False):
        """
        :type userEntity: user.userentity.UserEntity
        :type wuPost: WUserPost
        :type interactiveType: int
        :type content: str
        :type mentiondUsers: list[str]
        :type replyComment: bool
        :rtype: str
        """

        tComment = TUserPostComment()
        tComment.commentId = MyUuid.getUuid()
        tComment.interActiveType = interactiveType
        tComment.userId = userEntity.getUserId()
        tComment.postId = wuPost.getPostId()
        tComment.content = content
        tComment.mentionedUsers.extend(mentiondUsers)

        wuPost.addNewComment(tComment)
        DbCacheHelper.getITableSaverProxy().updateTUserPostComment(None, tComment)
        DbCacheHelper.getITableSaverProxy().updateTUserPost(None, wuPost.getTUserPost())

        hintType = 0
        logType = 0

        if interactiveType == EInteractiveType.Comment:
            if replyComment:
                hintType = EHintType.PostCommentReplied
            else:
                hintType = EHintType.PostCommented
            logType = ELogPostOperType.Comment

        elif interactiveType == EInteractiveType.Upvote:
            hintType = EHintType.PostUpvoted
            logType = ELogPostOperType.Upvote

        elif interactiveType == EInteractiveType.Shared:
            hintType = EHintType.PostReposted
            logType = ELogPostOperType.Share

        if not hintType:
            Logger.log("[PostHelper.addNewCommentToUserPost] Unknown InteractiveType:", interactiveType)
        else:
            ownerEntity = UserEntityManager.findUserEntityByUserId(wuPost.getOwnerUserId())
            if not ownerEntity:
                Logger.log("[PostHelper.addNewCommentToUserPost] UserNotFound:", wuPost.getOwnerUserId())
            else:
                cmtHit = SUserPostCommentHint()
                cmtHit.hintType = hintType
                cmtHit.operUserInfo = userEntity.getUserBriefInfo()
                cmtHit.content = content
                cmtHit.postId = wuPost.getPostId()
                cmtHit.commentId = tComment.commentId

                ownerEntity.addCommentHint(cmtHit)

        DbLogHepler.logUserPostOper(userEntity.getLogUserInfo(), wuPost.getPostId(), logType)

        return tComment.commentId
开发者ID:bropony,项目名称:gamit,代码行数:60,代码来源:posthelper.py

示例15: getClientInfo

    def getClientInfo(self, imgFormat=""):
        """
        :rtype: SUserPost
        """

        clientInfo = SUserPost()
        clientInfo.postId = self.tUserPost.postId
        clientInfo.title = self.tUserPost.title
        clientInfo.content = self.tUserPost.content
        clientInfo.createDt = self.tUserPost.createDt
        clientInfo.sharedTimes = self.tUserPost.sharedTimes
        clientInfo.commentedTimes = self.tUserPost.commentedTimes
        clientInfo.upvotedTimes = self.tUserPost.upvotedTimes
        clientInfo.viewTimes = self.tUserPost.viewTimes

        userEntity = UserEntityManager.findUserEntityByUserId(self.tUserPost.userId)
        if userEntity:
            clientInfo.userInfo = userEntity.getUserBriefInfo()
        else:
            Logger.log("WUserPost.getClientInfo", "UserInfoNotFoundForPost:", self.tUserPost.postId)

        for imgKey in self.tUserPost.imageKeys:
            imgInfo = ImageHelper.genImageDownloadToken(imgKey, imgFormat)
            clientInfo.images.append(imgInfo)

        return clientInfo
开发者ID:bropony,项目名称:gamit,代码行数:26,代码来源:post.py


注:本文中的user.userentitymanager.UserEntityManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。