예제 #1
0
파일: event.py 프로젝트: leonsim/me
 def new(cls, photo_id, user_id, author_id, left, top, width, height):
     store.execute("insert into me_photo_tag(photo_id,user_id,author_id,`left`,top,width,height)"
             " values(%s,%s,%s,%s,%s,%s,%s)", (photo_id, user_id, author_id, left, top, width, height))
     store.commit()
     id = store.get_cursor(table="me_photo_tag").lastrowid
     Notify.new(user_id, author_id, Notify.TYPE_PHOTO_TAG, extra={"photo_id":photo_id, "card_id":user_id})
     return id
예제 #2
0
파일: event.py 프로젝트: leonsim/me
 def comment(self, author_id, content):
     store.execute("insert into me_photo_comment(`photo_id`,`author_id`,`content`)"
         " values(%s,%s,%s)", (self.id, author_id, content));
     store.commit()
     cid = store.get_cursor(table="me_photo_comment").lastrowid
     Notify.new(self.author.id, author_id, Notify.TYPE_PHOTO_COMMENT, extra={"comment_id":cid, "photo_id":self.id})
     if '@' in content:
         from webapp.models.utils import mention_text
         ret = mention_text(content)
         for b, e, card_id, kind in ret['postions']:
             Notify.new(card_id, author_id, Notify.TYPE_PHOTO_COMMENT_MENTION,
                 extra={"card_id":self.author_id, "comment_id":cid, "photo_id":self.id})
예제 #3
0
파일: __init__.py 프로젝트: fordream/me
def request_change_photo(req):
    r = {
        'err':'invalid'
    }
    if req.get_method() == "POST":
        card_id = req.get_form_var('cid', '')
        card = Card.get(card_id)
        if card and req.user:
            Notify.new(card.id, req.user.id, Notify.TYPE_REQUEST_CHANGE_PHOTO)
            r = {
                'err':'ok',
            }
    return json.dumps(r)
예제 #4
0
파일: __init__.py 프로젝트: fordream/me
def read_notify(req):
    r = {
        'err':'ok'
    }
    if req.get_method() == "POST":
        if req.user:
            blog_id = req.get_form_var('bid', None)
            if blog_id:
                Notify.read_by_blog(req.user.id, blog_id)
            else:
                Notify.read_by_card(req.user.id)
            card = Card.get(req.user.id)
            r['num'] = card and card.notify_num or 0
    return json.dumps(r)
예제 #5
0
파일: event.py 프로젝트: leonsim/me
 def like(self, liker_id):
     store.execute("replace into me_photo_like(photo_id, liker_id) values(%s,%s)", (self.id, liker_id))
     store.commit()
     Notify.new(self.author.id, liker_id, Notify.TYPE_PHOTO_LIKE, extra={"photo_id":self.id})