def detect_daily_record_count(msg, msg_dict): if not (msg_dict["MsgType"] == "text" and msg_dict.has_key("MsgId")): return True username = "" service_name = msg_dict["ToUserName"] index_key = "%s_record_count" % (util.seconds_to_date(msg_dict["CreateTime"])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_daily_record_count(msg, msg_dict): if not (msg_dict['MsgType'] == 'text' and msg_dict.has_key('MsgId')): return True username = "" service_name = msg_dict['ToUserName'] index_key = "%s_record_count" % (util.seconds_to_date(msg_dict['CreateTime'])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_daily_unsubscribe_count(msg, msg_dict): if not (msg_dict['MsgType'] == 'event' and msg_dict['Event'] == 'unsubscribe'): return True username = "" service_name = msg_dict['ToUserName'] index_key = "%s_unsubscribe_count" % (util.seconds_to_date(msg_dict['CreateTime'])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_daily_unsubscribe_count(msg, msg_dict): if not (msg_dict["MsgType"] == "event" and msg_dict["Event"] == "unsubscribe"): return True username = "" service_name = msg_dict["ToUserName"] index_key = "%s_unsubscribe_count" % (util.seconds_to_date(msg_dict["CreateTime"])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_user_count(msg, msg_dict): if not (msg_dict['MsgType'] == 'event'): return True username = "" service_name = msg_dict['ToUserName'] index_key = "user_count" index_value = util.get_serviceprofile(service_name, index_key, 0) if (msg_dict['Event'] == "subscribe"): index_value = int(index_value) + 1 if (msg_dict['Event'] == "unsubscribe"): index_value = int(index_value) - 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_user_count(msg, msg_dict): if not (msg_dict["MsgType"] == "event"): return True username = "" service_name = msg_dict["ToUserName"] index_key = "user_count" index_value = util.get_serviceprofile(service_name, index_key, 0) if msg_dict["Event"] == "subscribe": index_value = int(index_value) + 1 if msg_dict["Event"] == "unsubscribe": index_value = int(index_value) - 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_daily_valid_record_count(msg, msg_dict): if not (msg_dict['MsgType'] == 'text' and msg_dict.has_key('MsgId') is False): return True content = msg_dict['Content'] if content.find("记好了") == -1: return True print "======= here ====" username = "" service_name = msg_dict['FromUserName'] index_key = "%s_valid_record_count" % (util.seconds_to_date(msg_dict['CreateTime'])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)
def detect_daily_valid_record_count(msg, msg_dict): if not (msg_dict["MsgType"] == "text" and msg_dict.has_key("MsgId") is False): return True content = msg_dict["Content"] if content.find("记好了") == -1: return True print "======= here ====" username = "" service_name = msg_dict["FromUserName"] index_key = "%s_valid_record_count" % (util.seconds_to_date(msg_dict["CreateTime"])) index_value = util.get_serviceprofile(service_name, index_key, 0) index_value = int(index_value) + 1 util.update_serviceprofile(service_name, index_key, index_value)