예제 #1
0
    def POST(self,id):
        data = web.input()
        currentuser_id = session.get_user_id()
        reply_userid = data.toId
        content = data.content
        ans, bigComment = infoDBserver.insert_comment(id, currentuser_id, reply_userid, content)
        if ans:
            success, bigVideo = infoDBserver.get_video(id)
            success0, bigUser = infoDBserver.get_user(currentuser_id)
            if success:
                success1, bigNotice = infoDBserver.insert_notice(currentuser_id, bigVideo.ownerId, 2, str(bigUser.userName)+' replied to your video', '/video/'+str(id))
                if data.toId!=None:
                    success2, bigNotice = infoDBserver.insert_notice(currentuser_id, data.toId, 2, str(bigUser.userName)+' replied to your comments in video '+str(bigVideo.videoName),'/video/'+str(id))
            comments = []
            comments.append(transclass.comment_trans(bigComment))
            return_message = comment2json(True,comments)

        else:
            return_message = comment2json(False, None)

        return return_message
예제 #2
0
 def POST(self,id):
     current_userid = session.get_user_id()
     ans, bigFollow = infoDBserver.insert_follow(current_userid, id)
     if ans != False:
         usersFind, current_user = infoDBserver.get_user(current_userid)
         success, bigNotice = infoDBserver.insert_notice(current_userid, id, 1, str(current_user.userName)+' is following you. Click it to see.', '/personal/'+str(current_userid))
         js = {}
         js['ok'] = True
         js['message'] = '成功添加好友!'
         return_message = json.dumps(js)
         return return_message
     else:
         js = {}
         js['ok'] = False
         js['message'] = '添加好友失败!'
         return_message = json.dumps(js)
         return return_message