def post(self): OHHOLog.print_log("start register") the_post = Post() OHHOLog.print_log("set the post") self.set_format(the_post.get_format(self)) username = the_post.get_username(self) OHHOLog.print_log("get username") password = the_post.get_password(self) code = the_post.get_code(self) cellphone = the_post.get_cellphone_number(self) country_code = the_post.get_cellphone_country_code(self) if not country_code: country_code = "+86" identity_id = the_post.get_device_identity_id(self) mac_address = the_post.get_device_mac_address(self) imei = the_post.get_imei(self) base_url = the_post.get_base_url(self) register_dict = dict() OHHOLog.print_log("get all parameters") register_dict["username"] = username register_dict["password"] = password register_dict["code"] = code register_dict["identity_id"] = identity_id register_dict["mac_address"] = mac_address register_dict["imei"] = imei register_dict["cellphone"] = cellphone register_dict["country_code"] = country_code cellphone_dict = the_post.get_cellphone(self) instance = LogicRegister(register_dict, cellphone_dict) result = instance.register(base_url) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) identity_id = the_post.get_device_identity_id(self) setting = LogicGetDeviceSetting() result = setting.get_device_setting(identity_id) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) user_id = the_post.get_user_id(self) identity_id = the_post.get_device_identity_id(self) cancel_lost = LogicCancelLost() result = cancel_lost.cancel_lost(user_id, identity_id) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) identity_id = the_post.get_device_identity_id(self) mac_address = the_post.get_device_mac_address(self) instance = LogicIsDeviceValid() result = instance.is_device_valid(identity_id, mac_address) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) user_id = the_post.get_user_id(self) identity_id = the_post.get_device_identity_id(self) mac_address = the_post.get_device_mac_address(self) instance = LogicUnbindDevice() result = instance.unbind_device(user_id, identity_id, mac_address) return self.response(result)
def post(self): the_get = Post() self.set_format(the_get.get_format(self)) user_id = the_get.get_user_id(self) identity_id = the_get.get_device_identity_id(self) base_url = the_get.get_base_url(self) instance = LogicMatch() result = instance.match_version3(user_id, base_url, identity_id) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) identity_id = the_post.get_device_identity_id(self) password = the_post.get_password(self) name = the_post.get_name(self) power = the_post.get_power(self) instance = LogicUpdateDeviceSetting() result = instance.update_device_setting(identity_id, password, name, power) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) country_code = the_post.get_cellphone_country_code(self) cellphone_number = the_post.get_cellphone_number(self) code = the_post.get_code(self) identity_id = the_post.get_device_identity_id(self) mac_address = the_post.get_device_mac_address(self) unbind_device = LogicCellphoneUnbindDevice() result = unbind_device.unbind_device(cellphone_number, code, identity_id, mac_address, country_code) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) application_id = the_post.get_device_application_id(self) identity_id = the_post.get_device_identity_id(self) mac_address = the_post.get_device_mac_address(self) tx_power = the_post.get_device_tx_power(self) device = LogicAddDevice() result = device.add_device(application_id, identity_id, mac_address, tx_power) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) identity_id = the_post.get_device_identity_id(self) password = the_post.get_password(self) name = the_post.get_name(self) power = the_post.get_power(self) periods = the_post.get_periods(self) setting = LogicAddDeviceSetting() result = setting.add_device_setting(identity_id, password, name, power, periods) return self.response(result)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) user_id = the_post.get_user_id(self) apply_id = the_post.get_apply_id(self) identity_id = the_post.get_device_identity_id(self) rssi = the_post.get_device_rssi(self) distance = the_post.get_device_distance(self) base_url = the_post.get_base_url(self) instance = LogicBluetoothPosition() result = instance.bluetooth_position(user_id, identity_id, rssi, distance, apply_id, base_url) return self.response(result)
def post(self): the_post = Post() name = the_post.get_name(self) user_id = the_post.get_user_id(self) rssi = the_post.get_device_rssi(self) identity_id = the_post.get_device_identity_id(self) data = dict() data["name"] = name data["user_id"] = user_id data["rssi"] = rssi data["identity_id"] = identity_id db = DBTestDevice() if user_id: db.add(data) result = Result.result_success() self.write(OHHOOperation.dict2json(result))
def post(self): the_post = Post() username = the_post.get_username(self) identity_id = the_post.get_device_identity_id(self) user_instance = DBOHHOUser() device_instance = DBOHHODevice() relation_instance = DBOHHOUserAndDeviceRelation() user = user_instance.get_by_username(username) device_instance.set_identity(identity_id) device = device_instance.get_by_identity() if user and device: data = dict() data["user_id"] = user.id data["device_id"] = device.id success = relation_instance.add(data) if success: return self.redirect(USER_AND_DEVICE_LIST_URL) return self.redirect(USER_AND_DEVICE_ADD_URL)
def post(self): the_post = Post() self.set_format(the_post.get_format(self)) user_id = the_post.get_user_id(self) identity_id = the_post.get_device_identity_id(self) type = the_post.get_device_type(self) name = the_post.get_name(self) data = dict() if type is not None: data["type"] = type if name is not None: data["name"] = name lost = LogicSetDeviceUse() result = lost.set_device_use(user_id, identity_id, data) return self.response(result)
def post(self): the_post = Post() username = the_post.get_username(self) identity_id = the_post.get_device_identity_id(self) user_instance = DBOHHOUser() device_instance = DBOHHODevice() relation_instance = DBOHHOUserAndDeviceRelation() user = user_instance.get_by_username(username) device_instance.set_identity(identity_id) device = device_instance.get_by_identity() delete_or_restore = the_post.get_delete_or_restore(self) if delete_or_restore: if device: relation = relation_instance.get_by_device(device.id) if relation: if relation.state: # print("execute delete") relation_instance.delete(relation) else: # print("execute restore") relation_instance.restore(relation) return self.redirect(USER_AND_DEVICE_LIST_URL)
def post(self): the_post = Post() username = the_post.get_username(self) identity_id = the_post.get_device_identity_id(self) user_instance = DBOHHOUser() device_instance = DBOHHODevice() relation_instance = DBOHHOUserAndDeviceRelation() user = user_instance.get_by_username(username) device_instance.set_identity(identity_id) device = device_instance.get_by_identity() submit = the_post.get_submit(self) # delete_or_restore = the_post.get_delete_or_restore(self) if submit: if device: relation = relation_instance.get_by_device(device.id) if relation: if user: data = dict() data["user_id"] = user.id if relation: relation_instance.update(relation, data) # if delete_or_restore: # if device: # relation = relation_instance.get_by_device(device.id) # if relation: # if relation.state: # # print("execute delete") # relation_instance.delete(relation) # else: # # print("execute restore") # relation_instance.restore(relation) return self.redirect(USER_AND_DEVICE_LIST_URL)