Пример #1
0
 def POST(self):
     args = web.input()
     email = args.pop("email")
     password = args.pop("password")
     user = User()
     user.login(email, password)
     if user.islogined:
         xiamidb.add(user["user_id"], email, password)
         account = xiamidb.get(user["user_id"])
         account["last"] = time.time()
         account["cookie"] = user.dumpCookie()
         account["email"] = email
         if "savepw" in args:
             account["password"] = password
         else:
             account["password"] = None
         if "notifyme" in args:
             account["notify"] = True
         else:
             account["notify"] = False
         account["errcount"] = 0
         account["nexttime"] = account["last"]
         account["days"] = int(user["sign"]["persist_num"])
         xiamidb.update(**account)
         yield "email:%s\n" % email
         yield "uid:%s\n" % account['uid']
         yield "cookie:\n%s" % account['cookie']
         yield "days:%s\n" % account["days"]
         yield '\xe7\x99\xbb\xe8\xae\xb0\xe6\x88\x90\xe5\x8a\x9f\xef\xbc\x8c\xe8\xaf\xb7\xe5\x85\xb3\xe9\x97\xad\xe9\xa1\xb5\xe9\x9d\xa2'
     else:
         yield '\xe6\x97\xa0\xe6\xb3\x95\xe8\x8e\xb7\xe5\x8f\x96\xe7\x94\xa8\xe6\x88\xb7\xe4\xbf\xa1\xe6\x81\xaf\xef\xbc\x8c\xe8\xaf\xb7\xe6\xa3\x80\xe6\x9f\xa5\xe5\xb8\x90\xe5\x8f\xb7\xe6\x88\x96\xe5\xaf\x86\xe7\xa0\x81'
Пример #2
0
 def POST(self):
     args = web.input()
     email = args.pop("email")
     password = args.pop("password")
     user = User()
     user.login(email,password)
     if user.islogined:
         xiamidb.add(user["user_id"],email,password)
         account = xiamidb.get(user["user_id"])
         account["last"] = time.time()
         account["cookie"] = user.dumpCookie()
         account["email"] = email
         if "savepw" in args:
             account["password"] = password
         else:
             account["password"] = None
         if "notifyme" in args:
             account["notify"] = True
         else:
             account["notify"] = False
         account["errcount"] = 0
         account["nexttime"] = account["last"]
         account["days"] = int(user["sign"]["persist_num"])
         xiamidb.update(**account)
         yield "email:%s\n"%email
         yield "uid:%s\n"%account['uid']
         yield "cookie:\n%s"%account['cookie']
         yield "days:%s\n"%account["days"]
         yield '\xe7\x99\xbb\xe8\xae\xb0\xe6\x88\x90\xe5\x8a\x9f\xef\xbc\x8c\xe8\xaf\xb7\xe5\x85\xb3\xe9\x97\xad\xe9\xa1\xb5\xe9\x9d\xa2'
     else:
         yield '\xe6\x97\xa0\xe6\xb3\x95\xe8\x8e\xb7\xe5\x8f\x96\xe7\x94\xa8\xe6\x88\xb7\xe4\xbf\xa1\xe6\x81\xaf\xef\xbc\x8c\xe8\xaf\xb7\xe6\xa3\x80\xe6\x9f\xa5\xe5\xb8\x90\xe5\x8f\xb7\xe6\x88\x96\xe5\xaf\x86\xe7\xa0\x81'
Пример #3
0
def checkin(account):
    user = User()
    user.loadCookie(account["cookie"])
    if not user.islogined and account["password"]:
        user.login(account["email"], account["password"])
    if user.islogined:
        if not user.ischeckined:
            days = user.checkin()
            if days:
                account["days"] = days
            else:
                account["errcount"] += 1
                account["nexttime"] = time.time() + 600
                account["status"] = u'\u7b7e\u5230\u5931\u8d25'
        else:
            days = int(user["sign"]["persist_num"])
            account["nexttime"] = time.time() + 3600
        account["status"] = u'\u6ca1\u6709\u5f02\u5e38'
    else:
        account["errcount"] += 1
        account["nexttime"] = time.time() + 600
        account["status"] = u'\u767b\u5f55\u5931\u8d25'
    account["last"] = time.time()
    xiamidb.update(**account)
Пример #4
0
def checkin(account):
    user = User()
    user.loadCookie(account["cookie"])
    if not user.islogined and account["password"]:
        user.login(account["email"],account["password"])
    if user.islogined:
        if not user.ischeckined:
            days = user.checkin()
            if days:
                account["days"] = days
            else:
                account["errcount"] += 1
                account["nexttime"] = time.time() + 600
                account["status"] = u'\u7b7e\u5230\u5931\u8d25'
        else:
            days = int(user["sign"]["persist_num"])
            account["nexttime"] = time.time() + 3600
        account["status"] = u'\u6ca1\u6709\u5f02\u5e38'
    else:
        account["errcount"] += 1
        account["nexttime"] = time.time() + 600
        account["status"] = u'\u767b\u5f55\u5931\u8d25'
    account["last"] = time.time()
    xiamidb.update (**account)