Exemplo n.º 1
0
def submit_question(obj,user,**kwargs):
    """ 发布问题后向好友分发,同事插入solr """
    try:
      task_id=insert_activity.delay(0,obj.id,user.id)
      task_id=insert_solr.delay('question',id=obj.id,title=remove_htmltag(obj.title),user_id=user.id)
      return task_id
    except Exception,e:
        print e
Exemplo n.º 2
0
def submit_answer(obj,user,**kwarg):
    """ 回答问题后向好友分发,同事插入solr """
    try:
        task_id=insert_activity.delay(1,obj.id,user.id)
        #import pdb;pdb.set_trace()
        #task_id=insert_solr.delay('answer',{'id':obj.id,'content':obj.content,'question_id':obj.question_id,'user_id':obj.user_id})
        #task_id=insert_solr.delay('answer',obj.id,obj.content,obj.question_id,obj.user_id)
        task_id=insert_solr.delay('answer',id=obj.id,content=remove_htmltag(obj.content),question_id=obj.question_id,\
                user_id=obj.user_id)
        return task_id
    except Exception,e:
        print e
Exemplo n.º 3
0
def submit_answer(obj,user,**kwarg):
    """ 回答问题后向好友分发,同时插入solr """
    try:
        question=kwarg.get("question")
        content_dict={"question_id":question.id,"question_title":question.title,"question_user_id":question.user.id,"user_id":user.id,\
                "user_name":user.surname+user.name}
        task_id=insert_message(1,obj.id,user.id,None,content_dict)
        task_id=insert_activity.delay(1,obj.id,user.id)
        #import pdb;pdb.set_trace()
        #task_id=insert_solr.delay('answer',{'id':obj.id,'content':obj.content,'question_id':obj.question_id,'user_id':obj.user_id})
        #task_id=insert_solr.delay('answer',obj.id,obj.content,obj.question_id,obj.user_id)
        task_id=insert_solr.delay('answer',id=obj.id,content=remove_htmltag(obj.content),question_id=obj.question_id,\
                user_id=obj.user_id)
        return task_id
    except Exception,e:
        print e
Exemplo n.º 4
0
def register_user(instance,**kwargs):
    """新用户注册 插入solr """
    task_id=insert_solr.delay('user',id=instance.id,name=instance.name,surname=instance.surname)