當前位置: 首頁>>代碼示例>>Python>>正文


Python UserEntityManager.findUserEntityBySessionKey方法代碼示例

本文整理匯總了Python中user.userentitymanager.UserEntityManager.findUserEntityBySessionKey方法的典型用法代碼示例。如果您正苦於以下問題:Python UserEntityManager.findUserEntityBySessionKey方法的具體用法?Python UserEntityManager.findUserEntityBySessionKey怎麽用?Python UserEntityManager.findUserEntityBySessionKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在user.userentitymanager.UserEntityManager的用法示例。


在下文中一共展示了UserEntityManager.findUserEntityBySessionKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: updateAdress

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    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,代碼行數:29,代碼來源:iuserinfoimpl.py

示例2: updateFamilyMembers

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    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,代碼行數:30,代碼來源:iuserinfoimpl.py

示例3: getFansByPageIndex

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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

示例4: replySysTopicComment

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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

示例5: unupvoteSysTopic

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    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,代碼行數:30,代碼來源:ipostoperimpl.py

示例6: getAllMyFocuses

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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

示例7: unfollowAUser

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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: replyUserPostComment

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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

示例9: unupvoteUserPost

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    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,代碼行數:32,代碼來源:ipostoperimpl.py

示例10: getMyDetails

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    def getMyDetails(self, sessionKey, _request):
        """
        :type sessionKey: str
        :type _request: message.gate.iuserinfo.IUserInfo_Getmydetails_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        details = userEntity.getDetails()
        _request.response(details)
開發者ID:bropony,項目名稱:gamit,代碼行數:13,代碼來源:iuserinfoimpl.py

示例11: getAddressList

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    def getAddressList(self, sessionKey, _request):
        """
        :type sessionKey: str
        :type _request: message.gate.iuserinfo.IUserInfo_Getaddresslist_Request
        """

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

        _request.response(userEntity.getTUserAddress().addressList)
開發者ID:bropony,項目名稱:gamit,代碼行數:13,代碼來源:iuserinfoimpl.py

示例12: getPostCommentsHints

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    def getPostCommentsHints(self, sessionKey, _request):
        """
        :type sessionKey: str
        :type _request: message.gate.ipostoper.IPostOper_Getpostcommentshints_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        hints = userEntity.getAllCommentHints()
        _request.response(hints)
開發者ID:bropony,項目名稱:gamit,代碼行數:13,代碼來源:ipostoperimpl.py

示例13: getNewFanList

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    def getNewFanList(self, sessionKey, _request):
        """
        :type sessionKey: str
        :type _request: message.gate.ipostoper.IPostOper_Getnewfanlist_Request
        """
        userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")

        res = userEntity.getNewFans()
        _request.response(res)
開發者ID:bropony,項目名稱:gamit,代碼行數:13,代碼來源:ipostoperimpl.py

示例14: followAUser

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [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

示例15: updateBirthDay

# 需要導入模塊: from user.userentitymanager import UserEntityManager [as 別名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityBySessionKey [as 別名]
    def updateBirthDay(self, sessionKey, birthday, _request):
        """
        :type sessionKye: str
        :type birthday: datetime.datetime
        :type _request: message.gate.iuserinfo.IUserInfo_Updatebirthday_Request
        """

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

        if birthday > datetime.datetime.now():
            ErrorCodeManager.raiseError("ErrorGate_invalidBirthday")

        userEntity.getTUserBasic().birthday = birthday
        DbCacheHelper.updateTUserBasic(userEntity.getTUserBasic())
開發者ID:bropony,項目名稱:gamit,代碼行數:18,代碼來源:iuserinfoimpl.py


注:本文中的user.userentitymanager.UserEntityManager.findUserEntityBySessionKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。