def po_recommend_new(rid, user_id, name, reply_id=None): '''新建推荐''' #判定? rec_po = Po.mc_get(rid) if not rec_po: return from po_pos import po_pos_state_buzz po_pos_state_buzz(user_id, rec_po) recommend = po_new( CID_REC, user_id, name, state=STATE_ACTIVE, rid=rid ) if recommend: recommend.feed_new() mc_po_recommend_id_by_rid_user_id.set( '%s_%s'%(rid, user_id), recommend.id ) if reply_id: rr = RecRep( id=recommend.id, reply_id=reply_id ) rr.save() return recommend
def reply_new(self, user, txt, state=STATE_ACTIVE): reply_id = super(Po, self).reply_new(user, txt, state) #print 'reply_id', reply_id if reply_id: user_id = user.id id = self.id mc_feed_tuple.delete(id) from po_pos import po_pos_state_buzz from buzz_reply import mq_buzz_po_reply_new if not po_pos_state_buzz(user_id, self): from model.po_tag import po_score_incr po_score_incr(self, user_id, 2) mq_buzz_po_reply_new(user_id, reply_id, id, self.user_id) return reply_id