Esempio n. 1
0
    def zan(self, id_reply):
        '''
        先在外部表中更新,然后更新内部表字段的值。
        有冗余,但是查看的时候避免了联合查询
        '''

        logger.info('zan: {0}'.format(id_reply))

        MReply2User.create_reply(self.userinfo.uid, id_reply)
        cur_count = MReply2User.get_voter_count(id_reply)
        if cur_count:
            MReply.update_vote(id_reply, cur_count)
            output = {'text_zan': cur_count}
        else:
            output = {'text_zan': 0}
        logger.info('zan dic: {0}'.format(cur_count))

        return json.dump(output, self)
Esempio n. 2
0
    def add_message(self, **kwargs):
        post_data = {
            'user_name': self.username,
            'user_pass': kwargs.get('user_pass', 'g131322'),
            'user_email': kwargs.get('user_email', '*****@*****.**'),
        }

        MUser.create_user(post_data)
        aa = MUser.get_by_name(self.username)
        self.user_id = aa.uid
        p_d = {
            'title': kwargs.get('title', 'iiiii'),
            'cnt_md': kwargs.get('cnt_md', 'grgr'),
            'time_create': kwargs.get('time_create', '1992'),
            'time_update': kwargs.get('time_update', '1996070600'),
            'user_name': kwargs.get('user_name', 'ngng'),
            'view_count': kwargs.get('view_count', 1),
            'logo': kwargs.get('logo', 'prprprprpr'),
            'memo': kwargs.get('memo', ''),
            'order': kwargs.get('order', '1'),
            'keywords': kwargs.get('keywords', ''),
            'extinfo': kwargs.get('extinfo', {}),
            'kind': kwargs.get('kind2', '1'),
            'valid': kwargs.get('valid', 1),

        }

        MPost.create_post(self.post_id, p_d)
        post_reply={
            'post_id':self.post_id,
            'user_name':self.username,
            'user_id':self.user_id,
            'cnt_reply':'daswrevwefgfgff'
        }
        self.reply_uid=MReply.create_reply(post_reply)
        MReplyid.create_replyid(self.post_id,self.reply_uid)
        aa=MReplyid.get_by_rid(self.post_id)
        for i in aa:
            if i.reply1==self.reply_uid:
                self.reply_id_uid=i.reply0
        MReply2User.create_reply(self.user_id,self.reply_uid)
Esempio n. 3
0
 def test_create_reply(self):
     MReply2User.create_reply(self.user_id, self.reply_id)
     assert True