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


Python models.DeviceInfo类代码示例

本文整理汇总了Python中ppmessage.db.models.DeviceInfo的典型用法代码示例。如果您正苦于以下问题:Python DeviceInfo类的具体用法?Python DeviceInfo怎么用?Python DeviceInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _create_device

    def _create_device(self):

        _osmodel = self.input_data.get("osmodel")
        _osversion = self.input_data.get("osversion")
        _device_fullname = self.input_data.get("device_fullname")
        
        _is_development = bool(self.input_data.get("ios_app_development"))

        _device_ios_token = self.input_data.get("device_ios_token")
        _device_android_gcmtoken = self.input_data.get("device_android_gcmtoken")
        _device_android_jpush_registrationid = self.input_data.get("device_android_jpush_registrationid")
        
        _device_uuid = str(uuid.uuid1())
        _values = {
            "uuid": _device_uuid,
            "terminal_uuid": self._terminal_uuid,
            "user_uuid": self.user.get("uuid"),
            "device_ostype": self._ostype,
            "device_ios_model": _osmodel,
            "device_osversion": _osversion,
            "device_fullname": _device_fullname,

            "is_development": _is_development,
            
            "device_ios_token": _device_ios_token,
            "device_android_gcmtoken": _device_android_gcmtoken,
            "device_android_jpush_registrationid": _device_android_jpush_registrationid,

        }

        _row = DeviceInfo(**_values)
        _row.create_redis_keys(self.application.redis)
        _row.async_add(self.application.redis)
        return _values
开发者ID:Bossuo,项目名称:ppmessage,代码行数:34,代码来源:ppkefuloginhandler.py

示例2: _update_device_online

 def _update_device_online(self):
     _values = {
         "uuid": self.device.get("uuid"),
         "device_is_online": True
     }
     _row = DeviceInfo(**_values)
     _row.update_redis_keys(self.application.redis)
     _row.async_update()
     return
开发者ID:1733604733,项目名称:ppmessage,代码行数:9,代码来源:ppkefuloginhandler.py

示例3: _update_device_with_is_development

 def _update_device_with_is_development(self, _device_uuid, _is_development):
     _values = {
         "uuid": _device_uuid,
         "is_development": _is_development,
     }
     _row = DeviceInfo(**_values)
     _row.update_redis_keys(self.application.redis)
     _row.async_update()
     return
开发者ID:1733604733,项目名称:ppmessage,代码行数:9,代码来源:ppkefuloginhandler.py

示例4: _update_device_with_user

 def _update_device_with_user(self, _device_uuid, _user_uuid):
     _values = {
         "uuid": _device_uuid,
         "user_uuid": _user_uuid,
     }
     _row = DeviceInfo(**_values)
     _row.update_redis_keys(self.application.redis)
     _row.async_update()
     return
开发者ID:1733604733,项目名称:ppmessage,代码行数:9,代码来源:ppkefuloginhandler.py

示例5: _update_device

 def _update_device(self):        
     _values = {
         "uuid": self.device_uuid,
         "device_is_online": False
     }        
     _row = DeviceInfo(**_values)
     _row.update_redis_keys(self.application.redis)
     _row.async_update(self.application.redis)
     return
开发者ID:codelulu,项目名称:ppmessage,代码行数:9,代码来源:ppkefulogouthandler.py

示例6: _post

    def _post(self, _request):
        _device_uuid = _request.get("device_uuid")

        if _device_uuid == None:
            self.setErrorCode(API_ERR.ERR_PARAM)
            return

        _redis = self.application.redis
        _device = redis_hash_to_dict(_redis, DeviceInfo, _device_uuid)

        if _device is None:
            logging.error("Error NO DEVICE for key [%s] ." % (_key))
            self.setErrorCode(API_ERR.NO_DEVICE)
            return

        _values = {
            "uuid": _device_uuid
        }
        
        if "fullname" in _request:
            _values["device_fullname"]= _request["fullname"]

        if "ostype" in _request:
            _values["device_ostype"] = _request["ostype"].upper()
                
        if "osversion" in _request:
            _values["device_osversion"] = _request["osversion"]

        # apilevel for android
        if "apilevel" in _request:
            _values["device_android_apilevel"] = _request["apilevel"]
            
        # phone number for phone
        if "phone" in _request:
            _values["device_phonenumber"] = _request["phone"]

        if "iosmodel" in _request:
            _values["device_ios_model"] = _request["iosmodel"]

        if "iostoken" in _request:
            _values["device_ios_token"] = _request["iostoken"]
            self.application.redis.srem(INVALID_IOS_TOKEN, _request["iostoken"])

        if "device_android_gcmtoken" in _request:
            _values["device_android_gcmtoken"] = _request["device_android_gcmtoken"]

        if "device_android_gcmpush" in _request:
            _values["device_android_gcmpush"] = _request["device_android_gcmpush"]

        _row = DeviceInfo(**_values)
        _row.update_redis_keys(_redis)
        _row.async_update()        
        return
开发者ID:1733604733,项目名称:ppmessage,代码行数:53,代码来源:setdeviceinfohandler.py

示例7: _update_device

    def _update_device(self):
        _values = {
            "uuid": self.device_uuid,
            "device_is_online": False
        }        
        _row = DeviceInfo(**_values)
        _row.update_redis_keys(self.application.redis)
        _row.async_update()

        _d = redis_hash_to_dict(self.application.redis, DeviceInfo, self.device_uuid)
        logging.info(_d)
        return
开发者ID:caomike,项目名称:ppmessage,代码行数:12,代码来源:ppkefulogouthandler.py

示例8: _update_device_with_token

 def _update_device_with_token(self, _device_uuid):
     _device_android_jpush_registrationid = self.input_data.get("device_android_jpush_registrationid")
     _device_android_gcmtoken = self.input_data.get("device_android_gcmtoken")
     _device_ios_token = self.input_data.get("device_ios_token")
     _values = {
         "uuid": _device_uuid,
         "device_ios_token": _ios_token,
         "device_android_gcmtoken": _device_android_gcmtoken,
         "device_android_jpush_registrationid": _device_android_jpush_registrationid
     }
     _row = DeviceInfo(**_values)
     _row.update_redis_keys(self.application.redis)
     _row.async_update(self.application.redis)
     return
开发者ID:Bossuo,项目名称:ppmessage,代码行数:14,代码来源:ppkefuloginhandler.py

示例9: _create_device

 def _create_device(self):
     _osmodel = self.input_data.get("osmodel")
     _osversion = self.input_data.get("osversion")
     _device_fullname = self.input_data.get("device_fullname")
     _device_uuid = str(uuid.uuid1())
     _values = {
         "uuid": _device_uuid,
         "terminal_uuid": self._terminal_uuid,
         "user_uuid": self.user.get("uuid"),
         "device_ostype": self._ostype,
         "device_ios_model": _osmodel,
         "device_osversion": _osversion,
         "device_fullname": _device_fullname        
     }
     _row = DeviceInfo(**_values)
     _row.create_redis_keys(self.application.redis)
     _row.async_add(self.application.redis)
     return _values
开发者ID:anxiaoyi,项目名称:ppmessage,代码行数:18,代码来源:ppkefuloginhandler.py

示例10: _create

    def _create(self):
        _redis = self.application.redis
        _device_uuid = None
        _terminal_uuid = self._device_id

        _key = DeviceInfo.__tablename__ + ".terminal_uuid." + _terminal_uuid
        if _redis.exists(_key):
            self._existed(_redis.get(_key))
            return

        _device_uuid = str(uuid.uuid1())
        _row = DeviceInfo(uuid=_device_uuid, app_uuid=self._app_uuid, user_uuid=self._user_uuid, is_ppcom_device=True,
                          device_ostype=self._device_ostype, terminal_uuid=_terminal_uuid)
        _row.async_add(self.application.redis)
        _row.create_redis_keys(self.application.redis)

        self._user(_device_uuid)
        _rdata = self.getReturnData()
        _rdata["device_uuid"] = _device_uuid
        return
开发者ID:Bossuo,项目名称:ppmessage,代码行数:20,代码来源:ppcreatedevicehandler.py

示例11: _update_device_with_token

    def _update_device_with_token(self, _device_uuid, _token):
        _ios_token = None
        _gcm_token = None
        _gcm_push = False
        if self._ostype == OS.IOS:
            _ios_token = _token
        if self._ostype == OS.AND:
            _gcm_token = _token
        if _gcm_token != None:
            _gcm_push = True

        _values = {
            "uuid": _device_uuid,
            "device_ios_token": _ios_token,
            "device_android_gcmtoken": _gcm_token,
            "device_android_gcmpush": _gcm_push,
        }
        _row = DeviceInfo(**_values)
        _row.update_redis_keys(self.application.redis)
        _row.async_update()
        return
开发者ID:1733604733,项目名称:ppmessage,代码行数:21,代码来源:ppkefuloginhandler.py

示例12: _online

    def _online(self, _user_uuid, _device_uuid, _app_uuid):
        _redis = self.application.redis
        _user = redis_hash_to_dict(_redis, DeviceUser, _user_uuid)
        if _user == None:
            self.setErrorCode(API_ERR.NO_USER)
            return
        
        if _user["ppcom_mobile_device_uuid"] != _device_uuid \
           and _user["ppcom_browser_device_uuid"] != _device_uuid:
            self.setErrorCode(API_ERR.NO_DEVICE)
            return

        _device = redis_hash_to_dict(_redis, DeviceInfo, _device_uuid)
        if _device == None:
            self.setErrorCode(API_ERR.NO_DEVICE)
            return

        _row = DeviceInfo(uuid=_device_uuid, device_is_online=True)
        _row.async_update()
        _row.update_redis_keys(self.application.redis)

        self._user_online_status(_user_uuid, _device_uuid, _app_uuid)
        return
开发者ID:caomike,项目名称:ppmessage,代码行数:23,代码来源:pponlinehandler.py

示例13: _create_device

    def _create_device(self):
        _token = self.input_data.get("token")
        _osmodel = self.input_data.get("osmodel")
        _osversion = self.input_data.get("osversion")
        _device_fullname = self.input_data.get("device_fullname")
        _is_development = bool(self.input_data.get("ios_app_development"))

        _ios_token = None
        _gcm_token = None
        _gcm_push = False
        if self._ostype == OS.IOS:
            _ios_token = _token
        if self._ostype == OS.AND:
            _gcm_token = _token
        if _gcm_token != None:
            _gcm_push = True
            
        _device_uuid = str(uuid.uuid1())
        _values = {
            "uuid": _device_uuid,
            "terminal_uuid": self._terminal_uuid,
            "user_uuid": self.user.get("uuid"),
            "device_ostype": self._ostype,
            "device_ios_token": _ios_token,
            "device_ios_model": _osmodel,
            "device_osversion": _osversion,
            "device_fullname": _device_fullname,
            "is_development": _is_development,
            "device_android_gcmtoken": _gcm_token,
            "device_android_gcmpush": _gcm_push
        }

        _row = DeviceInfo(**_values)
        _row.create_redis_keys(self.application.redis)
        _row.async_add()
        return _values
开发者ID:1733604733,项目名称:ppmessage,代码行数:36,代码来源:ppkefuloginhandler.py

示例14: _offline_device

 def _offline_device(self, _device_uuid):
     _row = DeviceInfo(**{"uuid": _device_uuid, "device_is_online": False})
     _row.async_update()
     _row.update_redis_keys(self.application.redis)
     return
开发者ID:1733604733,项目名称:ppmessage,代码行数:5,代码来源:ppkefuloginhandler.py

示例15: device_online

 def device_online(self, _device_uuid, _is_online=True):
     _row = DeviceInfo(uuid=_device_uuid, device_is_online=_is_online)
     _row.async_update(self.redis)
     _row.update_redis_keys(self.redis)
     return
开发者ID:Michael-Z,项目名称:ppmessage,代码行数:5,代码来源:pcsocketapp.py


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