def event_feedback_id_get(user_id, event_id): c = Po.raw_sql( 'select id from po where rid=%s and cid=%s and user_id=%s and state>%s', event_id, CID_EVENT_FEEDBACK, user_id, STATE_RM) r = c.fetchone() if r: return r[0] return 0
def event_feedback_id_get(user_id, event_id): c = Po.raw_sql( 'select id from po where rid=%s and cid=%s and user_id=%s and state>%s', event_id, CID_EVENT_FEEDBACK, user_id, STATE_RM ) r = c.fetchone() if r: return r[0] return 0
def po_review_id_get(zsite_id, user_id): c = Po.raw_sql( 'select id from po where zsite_id=%s and user_id=%s and cid=%s', zsite_id, user_id, CID_REVIEW) r = c.fetchone() if r: return r[0] return 0
def po_review_id_get(zsite_id, user_id): c = Po.raw_sql( 'select id from po where zsite_id=%s and user_id=%s and cid=%s', zsite_id, user_id, CID_REVIEW ) r = c.fetchone() if r: return r[0] return 0
def po_recommend_id_by_rid_user_id(rid, user_id): c = Po.raw_sql( 'select id from po where rid=%s and user_id=%s and cid=%s and state = %s', rid, user_id, CID_REC, STATE_ACTIVE ) r = c.fetchone() if r: return r[0] return 0
def log_num_po_zsite(): num = Po.raw_sql('select count(1) from po where zsite_id != user_id').fetchone()[0] log_history_new(Po, LOG_HISTORY_CID_PO_ZSITE, num )
def log_num_po(): num = Po.raw_sql('select count(1) from po where zsite_id = 0').fetchone()[0] log_history_new(Po, LOG_HISTORY_CID_PO, num)
def log_num_po_zsite(): num = Po.raw_sql( 'select count(1) from po where zsite_id != user_id').fetchone()[0] log_history_new(Po, LOG_HISTORY_CID_PO_ZSITE, num)
def log_num_po(): num = Po.raw_sql( 'select count(1) from po where zsite_id = 0').fetchone()[0] log_history_new(Po, LOG_HISTORY_CID_PO, num)