Esempio n. 1
0
def addScore2Stream(theScore, deviceID):
    try:
        if not streamOperation.addDataStream(deviceID, theScore):
            return HttpResponse('Error:addDataStream failded!'+deviceID+" "+str(theScore))
        return HttpResponse(getRank(deviceID))
    except Exception as e:
        return HttpResponse(str(e)+'Error')
Esempio n. 2
0
def heartBeatProcess(theUUID,theScore, isReset):
    print __aliveUserDict__
    try:
        if not __aliveUserDict__.has_key(theUUID) :
            return HttpResponse('No user info,need to login again!')
        else:
            userInfo=__aliveUserDict__[theUUID]
            userInfo["visitTime"]=datetime.datetime.now()
            if isReset :               
                streamOperation.addDataStream(theUUID.split("%")[0], userInfo["score"])
                userInfo["score"]=0
            elif userInfo["score"] < theScore:                
                userInfo["score"]=theScore
            return HttpResponse(getRank(theUUID))
    except Exception as e:
        print e
        return HttpResponse('error, need to login again!')