当前位置: 首页>>代码示例>>Python>>正文


Python User.check_user_exist方法代码示例

本文整理汇总了Python中model.User.User.check_user_exist方法的典型用法代码示例。如果您正苦于以下问题:Python User.check_user_exist方法的具体用法?Python User.check_user_exist怎么用?Python User.check_user_exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.User.User的用法示例。


在下文中一共展示了User.check_user_exist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: UserHandler

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import check_user_exist [as 别名]
class UserHandler(tornado.web.RequestHandler):
    def initialize(self, mysql_handler, redis_handler, LOG):
        self.mysql_handler = mysql_handler
        self.redis_handler = redis_handler
        self.LOG = LOG
        self.user = User(mysql_handler, LOG)
        self.picture = Picture(mysql_handler, LOG)
        return
    def get_self_info(self, user_phone):
        user_info = self.user.check_user_exist(user_phone)
        if user_info:
            image_info = self.picture.get_image_by_phone(user_phone, 'user')
            try:
                image_big_mame = image_info['pic_big_name']
                image_sml_mame = image_info['pic_sml_name']
            except:
                image_big_mame = None
                image_sml_mame = None
            
            user_info['pic_big_name'] = image_big_mame
            user_info['pic_sml_name'] = image_sml_mame
            #del user_info['login_status']

            image_info = self.picture.get_image_by_phone(user_phone, 'license')
            try:
                image_big_mame = image_info['pic_big_name']
                image_sml_mame = image_info['pic_sml_name']
            except:
                image_big_mame = None
                image_sml_mame = None
            user_info['license_big_name'] = image_big_mame
            user_info['license_sml_name'] = image_sml_mame
        return user_info
开发者ID:yufajieluo,项目名称:cloud_factory,代码行数:35,代码来源:userHandler.py

示例2: AddHandler

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import check_user_exist [as 别名]
class AddHandler(tornado.web.RequestHandler):
    def initialize(self, mysql_handler, LOG):
        self.mysql_handler = mysql_handler
        self.LOG = LOG
        self.user = User(mysql_handler, LOG)
        self.device = Device(mysql_handler, LOG)
        self.favorite = Favorite(mysql_handler, LOG)
        self.rsp_handler = CommResponse()
        return

    def post(self):
        self.LOG.debug('this is %s' % self.__class__.__name__)
        try:
            request_json = json.loads(self.request.body)
            user_phone = request_json['user_phone']
            user_login_mobile_uuid = request_json['user_login_mobile_uuid']
            collection_type = request_json['collection_type']
            collection_name = request_json['collection_name']
        except Exception as e:
            self.LOG.error('parameters error.')
            self.rsp_msg = self.rsp_handler.generate_rsp_msg('21001', None)
            self.write(self.rsp_msg)
            return

        if not self.user.check_login_status(user_phone, user_login_mobile_uuid):
            self.LOG.error('user [%s] not login.' % user_phone)
            self.mysql_handler.rollback_db()
            self.rsp_msg = self.rsp_handler.generate_rsp_msg('21006', None)
            self.write(self.rsp_msg)
            return

        if collection_type == 'device':
            collection_info = self.device.get_device_by_number(collection_name)
        elif collection_type == 'user':
            collection_info = self.user.check_user_exist(collection_name)

        if not collection_info:
            self.LOG.error('collection [%s] is not exist.' % collection_name)
            self.rsp_msg = self.rsp_handler.generate_rsp_msg('21012', None)
            self.mysql_handler.rollback_db()
            self.write(self.rsp_msg)
            return

        (ret, num, id) = self.favorite.add_collection(user_phone, collection_name, collection_type)  
        if not ret and num != 1062:
            self.LOG.error('insert collection into mysql failed.')
            self.rsp_msg = self.rsp_handler.generate_rsp_msg('21999', None)
            self.mysql_handler.rollback_db()
            self.write(self.rsp_msg)
            return
      
        if num != 1062:
            modify_info = {
                'collected': 'collected + 1'
            }
            if collection_type == 'user':
                self.user.modify_user(collection_name, modify_info)
            elif collection_type == 'device':
                self.device.modify_device(collection_name, modify_info)

        self.rsp_msg = self.rsp_handler.generate_rsp_msg('200', None)
        self.mysql_handler.commit_db()
        self.write(self.rsp_msg)
        return
开发者ID:yufajieluo,项目名称:cloud_factory,代码行数:66,代码来源:favoriteHandler.py


注:本文中的model.User.User.check_user_exist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。