# coding: utf-8 """ @Author: Well @Date: 2016 - 04 - 20 """ from app.util.well_fun_redis_conn import REDIS r = REDIS(host='10.1.249.139', port=6379, db=0) a = r.zrange_byscore_withscores("hhub:RoomPrice:3115", 16090002, 161201002) for i in a: if '520574391055' in i[0] and '2016-04-21' in i[0]: print i[1] json_ = i[0] print json_ json_2 = """{"LocatorID":"520574531144","BizDay":"2016-04-21T00:00:00","IsRoom":true,"RatePlanCode":"COGHZ2","InvTypeCode":"QEC","BaseByGuestAmtList":[{"AmountAfterTax":172.01,"AmountBeforeTax":150.01,"CurrencyCode":"CNY","NumberOfGuests":"1"},{"AmountAfterTax":0.0,"AmountBeforeTax":0.0,"CurrencyCode":"CNY","NumberOfGuests":"2"},{"AmountAfterTax":0.0,"AmountBeforeTax":0.0,"CurrencyCode":"CNY","NumberOfGuests":"3"}],"PushDate":"2016-03-14T17:56:45.882+08:00","MealPlanCodes":["14"]} """ # # # r.zset_rem("hhub:RoomPrice:3115",json_) r.zset_add("hhub:RoomPrice:3115",*(161121002,json_2))