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


Python UserEntityManager.findUserEntityByUserId方法代码示例

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


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

示例1: getAllMyFocuses

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:34,代码来源:ipostoperimpl.py

示例2: getClientInfo

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:28,代码来源:post.py

示例3: addNewCommentToUserPost

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:62,代码来源:posthelper.py

示例4: replyUserPostComment

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:30,代码来源:ipostoperimpl.py

示例5: getFansByPageIndex

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:37,代码来源:ipostoperimpl.py

示例6: replySysTopicComment

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:30,代码来源:ipostoperimpl.py

示例7: unfollowAUser

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:34,代码来源:ipostoperimpl.py

示例8: cmtTabel2Struct

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    def cmtTabel2Struct(self, tcmt, scmt):
        """
        :type tcmt: TSysTopicComment
        :type scmt: SComment
        """
        scmt.commentId = tcmt.commentId
        scmt.comment = tcmt.content
        scmt.interActiveType = tcmt.interActiveType
        scmt.commentDt = tcmt.createDt

        userEntity = UserEntityManager.findUserEntityByUserId(tcmt.userId)
        if userEntity:
            scmt.commenterInfo = userEntity.getUserBriefInfo()
        else:
            scmt.commenterInfo.userId = tcmt.userId

        for userId in tcmt.mentionedUsers:
            userEntity = UserEntityManager.findUserEntityByUserId(userId)
            if userEntity:
                scmt.mentioned.append(userEntity.getUserBriefWithoutAvatar())
开发者ID:bropony,项目名称:gamit,代码行数:22,代码来源:systopic.py

示例9: getComments

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    def getComments(self, dtThres, targetNum):
        """
        :rtype: list[SComment]
        """
        self.__loadComments()

        res = SeqComment()
        now = datetime.datetime.now()

        for cmt in self.comments:
            if cmt.interActiveType != EInteractiveType.Comment:
                continue

            if (dtThres < now) and (dtThres <= cmt.createDt):
                continue

            sComment = SComment()
            sComment.comment = cmt.commentId
            sComment.interActiveType = cmt.interActiveType
            sComment.comment = cmt.content
            sComment.commentDt = cmt.createDt

            userEntity = UserEntityManager.findUserEntityByUserId(cmt.userId)
            if userEntity:
                sComment.commenterInfo = userEntity.getUserBriefInfo()
            else:
                sComment.commenterInfo.userId = cmt.userId

            for userId in cmt.mentionedUsers:
                userEntity = UserEntityManager.findUserEntityByUserId(userId)
                if userEntity:
                    sComment.mentioned.append(userEntity.getUserBriefWithoutAvatar())

            res.append(sComment)

            if len(res) >= targetNum:
                break

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

示例10: followAUser

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByUserId [as 别名]
    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,代码行数:50,代码来源:ipostoperimpl.py


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