Esempio n. 1
0
 def update_user_token(self, uid):
     """temp function """
     token = PublicFunc.create_token(uid)
     change_param = {'token': token}
     self.update_db(change_param, uid=uid)
     self.clear_user_cache(uid)
     self.cache_import_user_info(uid)
     return token
Esempio n. 2
0
 def update_user_token(self,uid):
     """temp function """
     token = PublicFunc.create_token(uid)
     change_param = {'token':token}
     self.update_db(change_param,uid=uid)
     self.clear_user_cache(uid)
     self.cache_import_user_info(uid)
     return token
Esempio n. 3
0
	def login(self,tel,password):
		"""
		用户登录接口,登录成功之后要判断mongo里面是否有这个用户了,如果没有的话,新建
		"""
		user_exist = UsersModel().check_tel_register(tel)
		if not user_exist: return 0#用户还没有注册
		login_info  = self.usersmodel.login(tel,password) #mysql  
		if not password == login_info['password']: return 1 #
		#if the user has not clear the token before!! then continue use this token!!
		token = login_info['token']
		if not token:
			token = PublicFunc.create_token(login_info['uid'])
		change_param = {'token':token,'login_times':login_info['login_times']+1,'last_login':int(time.time())}
		self.usersmodel.update_db(change_param,tel=tel)
		self.usersmodel.clear_user_cache(login_info['uid'])
		self.usersmodel.cache_import_user_info(login_info['uid'])
		bind_layer_show = 1 if self.usersmodel.judge_show_bind_layer(login_info['uid']) else 0
		return token,login_info['uid'],bind_layer_show
Esempio n. 4
0
    def login(self, tel, password):
        """
		用户登录接口,登录成功之后要判断mongo里面是否有这个用户了,如果没有的话,新建
		"""
        user_exist = UsersModel().check_tel_register(tel)
        if not user_exist: return 0  #用户还没有注册
        login_info = self.usersmodel.login(tel, password)  #mysql
        if not password == login_info['password']: return 1  #
        #if the user has not clear the token before!! then continue use this token!!
        token = login_info['token']
        if not token:
            token = PublicFunc.create_token(login_info['uid'])
        change_param = {
            'token': token,
            'login_times': login_info['login_times'] + 1,
            'last_login': int(time.time())
        }
        self.usersmodel.update_db(change_param, tel=tel)
        self.usersmodel.clear_user_cache(login_info['uid'])
        self.usersmodel.cache_import_user_info(login_info['uid'])
        bind_layer_show = 1 if self.usersmodel.judge_show_bind_layer(
            login_info['uid']) else 0
        return token, login_info['uid'], bind_layer_show