本文整理汇总了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)
示例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()
示例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)
示例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)
示例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)
示例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)
示例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())
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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())
示例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())