def deleteType(): data = json.loads(request.get_data().decode('utf-8')) idList = data.get('idList') redisDB.deleteType(data.get('name'), data.get('value')) redisDB.setString('updateTime', data.get('updateTime')) for item in idList: redisDB.deleteData(item) redisDB.deleteType('idList', item) return '删除结束'
def rewrite(): redisDB.clearAll() data = json.loads(request.get_data().decode('utf-8')) updateTime = data.get('updatetime') members = data.get('members') types = data.get('types') incomes = data.get('incomes') loglist = data.get('loglist') redisDB.setString('updateTime', updateTime) redisDB.addType('members', *members) redisDB.addType('types', *types) redisDB.addType('incomes', *incomes) for item in loglist: redisDB.addType('idList', item['id']) redisDB.addNewLog(item['id'], item) return ''
def editLog(): data = json.loads(request.get_data().decode('utf-8')) redisDB.setString('updateTime', data.get('updateTime')) redisDB.addNewLog(data.get('id'), data.get('log')) return '编辑完成'
def addNewLog(): data = json.loads(request.get_data().decode('utf-8')) redisDB.setString('updateTime', data.get('id')) redisDB.addType('idList', data.get('id')) redisDB.addNewLog(data.get('id'), data.get('log')) return '新纪录添加成功'
def deleteLog(): data = json.loads(request.get_data().decode('utf-8')) redisDB.setString('updateTime', data.get('updateTime')) redisDB.deleteData(data.get('id')) redisDB.deleteType('idList', data.get('id')) return '删除成功'
def addType(): data = json.loads(request.get_data().decode('utf-8')) redisDB.setString('updateTime', data.get('updatetime')) redisDB.addType(data.get('name'), *data.get('data')) return data.get('name') + '添加成功'