def get_save_step_three_2(task_detail): task_id = task_detail['task_id'] # nick_name = task_detail['nick_name'] try: item_fans_followers = dict() followers_uids = list(set(task_detail['followers_uids'].split(','))) # item_fans_followers['followers_list'] = followers_uids item_fans_followers['fans_list'] = followers_uids item_fans_followers['xnr_user_no'] = task_id print es.index(index=fb_xnr_fans_followers_index_name, doc_type=fb_xnr_fans_followers_index_type, id=task_id, body=item_fans_followers) #把关注任务加到redis队列中 for followers_uid in followers_uids: queue_dict = { 'channel': 'facebook', 'operate_type': 'add', 'content': { 'xnr_user_no': task_id, 'uid': followers_uid } } if not add_operate2redis(queue_dict): mark = False return mark mark = True except: mark = False return mark
def ajax_like_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['r_tid'] = request.args.get('tid','') # 被转发帖子 #task_detail['r_uid'] = request.args.get('uid','') # 被转发帖子的用户 task_detail['r_uid'] = request.args.get('uid','') # 被转发帖子的用户 print '==================-------------------------====================' print task_detail['r_tid'], task_detail['r_uid'] task_detail['timestamp'] = int(request.args.get('timestamp','')) mark_s = save_oprate_like(task_detail) # mark = get_like_operate(task_detail) queue_dict = {} queue_dict['channel'] = 'twitter' queue_dict['operate_type'] = 'like' queue_dict['content'] = task_detail mark_a = add_operate2redis(queue_dict) # print mark_a mark = mark_a and mark_s return json.dumps(mark)
def ajax_submit_daily_tweet(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type', '') # 日常发帖、热点跟随、业务发帖 task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['text'] = request.args.get('text', '').encode('utf-8') #task_detail['operate_type'] = request.args.get('operate_type','') # 原创、转发、评论 task_detail['p_url'] = json.loads( json.dumps(request.args.get('p_url', '').encode('utf-8'))) task_detail['rank'] = request.args.get('rank', '') task_detail['rankid'] = request.args.get('rankid', '') #mark = get_submit_tweet(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'publish' queue_dict['content'] = task_detail while 1: try: mark = add_operate2redis(queue_dict) print mark break except Exception, e: print 'weibo_xnr_operate/views.py!!!!' print e traceback.print_exc(e) continue
def ajax_unfollow_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['uid'] = request.args.get('uid', '') #mark = get_reply_unfollow(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'unfollow' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_follow_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['uid'] = request.args.get('uid','') task_detail['trace_type'] = request.args.get('trace_type','') # 跟随关注 -trace_follow,普通关注-ordinary_follow # mark = get_follow_operate(task_detail) queue_dict = {} queue_dict['channel'] = 'facebook' queue_dict['operate_type'] = 'follow' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict)
def ajax_delete_friend(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['uid'] = request.args.get('uid', '') queue_dict = {} queue_dict['channel'] = 'facebook' queue_dict['operate_type'] = 'delete' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) # mark = get_delete_friend(task_detail) return json.dumps(mark)
def ajax_like_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['r_fid'] = request.args.get('fid','') # 被转发帖子 task_detail['r_uid'] = request.args.get('uid','') # 被转发帖子的用户 queue_dict = {} queue_dict['channel'] = 'facebook' queue_dict['operate_type'] = 'like' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) # mark = get_like_operate_fb(task_detail) return json.dumps(mark)
def ajax_at_operate(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type','') task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['text'] = request.args.get('text','').encode('utf-8') task_detail['nick_name'] = request.args.get('nick_name','') # mark = get_at_operate(task_detail) queue_dict = {} queue_dict['channel'] = 'twitter' queue_dict['operate_type'] = 'at' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_reply_retweet(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type', '') task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['text'] = request.args.get('text', '').encode('utf-8') task_detail['r_mid'] = request.args.get('mid', '') #mark = get_reply_retweet(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'retweet' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_private_operate(): task_detail= dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['uid'] = request.args.get('uid','') task_detail['text'] = request.args.get('text','') # mark = get_private_operate(task_detail) queue_dict = {} queue_dict['channel'] = 'twitter' queue_dict['operate_type'] = 'private' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_reply_follow(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['uid'] = request.args.get('uid', '') task_detail['trace_type'] = request.args.get( 'trace_type', '') # 跟随关注 -trace_follow,普通关注-ordinary_follow #mark = get_reply_follow(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'follow' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_retweet_operate(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type', '') task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['text'] = request.args.get('text', '').decode('utf-8') task_detail['r_fid'] = request.args.get('fid', '') # 被转发帖子 task_detail['r_uid'] = request.args.get('uid', '') # 被转发帖子的用户 queue_dict = {} queue_dict['channel'] = 'facebook' queue_dict['operate_type'] = 'retweet' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) # mark = get_retweet_operate(task_detail) return json.dumps(mark)
def ajax_unfollow_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['uid'] = request.args.get('uid','') #task_detail['nick_name'] = request.args.get('nick_name','') task_detail['trace_type'] = request.args.get('ordinary_follow','') # 跟随关注 -trace_follow,普通关注-ordinary_follow # mark = get_unfollow_operate(task_detail) queue_dict = {} queue_dict['channel'] = 'twitter' queue_dict['operate_type'] = 'unfollow' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_submit_daily_tweet(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type','') # 参数传对应英文 (以下所有url一样) #u'日常发帖':'daily_post',u'热门发帖':'hot_post',u'业务发帖':'business_post',\ #u'跟随转发':'trace_post',u'智能发帖':'intel_post' task_detail['xnr_user_no'] = request.args.get('xnr_user_no','') task_detail['text'] = request.args.get('text','').encode('utf-8') # mark = get_submit_tweet_tw(task_detail) queue_dict = {} queue_dict['channel'] = 'twitter' queue_dict['operate_type'] = 'publish' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_like_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['r_fid'] = request.args.get('fid', '') # 被转发帖子 task_detail['r_uid'] = request.args.get('uid', '') # 被转发帖子的用户 task_detail['timestamp'] = int(request.args.get('timestamp', '')) mark_s = save_oprate_like(task_detail) queue_dict = {} queue_dict['channel'] = 'facebook' queue_dict['operate_type'] = 'like' queue_dict['content'] = task_detail mark_a = add_operate2redis(queue_dict) mark = mark_a and mark_s # mark = get_like_operate_fb(task_detail) return json.dumps(mark)
def ajax_like_operate(): task_detail = dict() task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['mid'] = request.args.get('mid', '') #mark = get_like_operate(task_detail) task_detail['timestamp'] = int(request.args.get('timestamp', '')) mark_s = save_oprate_like(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'like' queue_dict['content'] = task_detail mark_a = add_operate2redis(queue_dict) mark = mark_a and mark_s return json.dumps(mark)
def ajax_submit_daily_tweet(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type', '') # 日常发帖、热点跟随、业务发帖 task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['text'] = request.args.get('text', '').encode('utf-8') #task_detail['operate_type'] = request.args.get('operate_type','') # 原创、转发、评论 task_detail['p_url'] = json.loads( json.dumps(request.args.get('p_url', '').encode('utf-8'))) task_detail['rank'] = request.args.get('rank', '') task_detail['rankid'] = request.args.get('rankid', '') #mark = get_submit_tweet(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'publish' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)
def ajax_reply_total(): task_detail = dict() task_detail['tweet_type'] = request.args.get('tweet_type', '') task_detail['xnr_user_no'] = request.args.get('xnr_user_no', '') task_detail['text'] = request.args.get('text', '').encode('utf-8') task_detail['r_mid'] = request.args.get('r_mid', '') task_detail['mid'] = request.args.get('mid', '') task_detail['uid'] = request.args.get('uid', '') # 收到的评论人的uid task_detail['retweet_option'] = request.args.get('retweet_option', '') # true-同时转发,false-不转发 #mark = get_reply_total(task_detail) queue_dict = {} queue_dict['channel'] = 'weibo' queue_dict['operate_type'] = 'receive' queue_dict['content'] = task_detail mark = add_operate2redis(queue_dict) return json.dumps(mark)