def addapp(msg): redisdb = ensure_redis() task = json.loads(msg) print(task) if "esttime" in task.keys(): esttime = task["esttime"] if "taskid" in task.keys(): task_id = task["taskid"] if "campaignid" in task.keys(): campaignid = task["campaignid"] redisdb.hmset( "sendapp:" + str(task_id), { "_id": task_id, "task": "sendapp", "arguments": _decode_dict(task), "campaignid": campaignid, "esttime": esttime, "creat_time": utc_now(), "isenable": 1, # 1可用 0不可用 "prepare": 0, # 1数据已准备 0数据未准备 "status": "STARTED", }, ) redisdb.rpush("sendapp", "sendapp:" + str(task_id))
def addreward(reward): redisdb = ensure_redis() task = json.loads(reward) if "esttime" in task.keys(): esttime = task["esttime"] if "pointnum" in task.keys(): pointnum = task["pointnum"] if "sendtype" in task.keys(): sendtype = task["sendtype"] if "couponid" in task.keys(): couponid = task["couponid"] if "pointexdate" in task.keys(): pointexdate = task["pointexdate"] if "taskid" in task.keys(): task_id = task["taskid"] if "campaignid" in task.keys(): campaignid = task["campaignid"] redisdb.hmset("reward:"+str(task_id),{ "_id": task_id, "task": "reward", "arguments": _decode_dict(task), "campaignid":campaignid, "esttime":esttime, "creat_time": utc_now(), "isenable":1,#1可用 0不可用 "prepare":0,#1数据已准备 0数据未准备 "status": "STARTED" }) redisdb.rpush("reward","reward:"+str(task_id))