Exemplo n.º 1
0
def wish_rebuild(id, is_worth):
    conn_db = es_db.get_mysql_connector('netx')  # 上线
    wish_body, worth_body = get_wish(id, True, conn_db)
    # deleted=1的情况
    if (wish_body == None):
        return None, None
# 处理wish
    user_id = wish_body['userId']
    # 第一步,注入用户信息
    wish_user_body = add_user_location_message(wish_body, conn_db, user_id)
    # 第二步,注入信用信息
    wish_user_sum_body = add_credit_sum(wish_user_body, conn_db)
    #第三步,注入wish_suport
    json_body = add_wish_support(wish_user_sum_body, conn_db)
    # 处理worth
    # 第一步,注入hit
    worth_body = add_hit('Wish', worth_body, conn_db)
    # 第二步,注入wish_suport
    worth_body = add_worth_wish_suport(worth_body, conn_db)
    # 第三步,注入用户信息
    user_id = json_body['userId']
    worth_body = add_user_to_worth(worth_body, conn_db, False, user_id)
    # 第四步,注入信用
    worth_body = add_credit_sum_for_worth(worth_body, conn_db, user_id)
    conn_db.close()
    return json_body, worth_body
Exemplo n.º 2
0
def meeting_rebuild(id, no_cache):
    conn_db = es_db.get_mysql_connector('netx')  # 上线
    meeting_json, worth_json = get_meeting(id, no_cache, conn_db)
    if (meeting_json == None):
        return None, None
    user_id = meeting_json['userId']
    # 构造meeting
    meeting_user_body = add_user(meeting_json, conn_db)
    meeting_user_credit_body = add_credit_sum(meeting_user_body, conn_db)
    # 构造worth_json
    # 第一步,注入用户信息
    worth_json = add_user_to_worth(worth_json, conn_db, True, user_id)
    # 第二步,注入hit
    worth_json = add_hit('Meeting', worth_json, conn_db)
    # 第三步,注入is_holdCredit
    worth_json = add_credit_sum_for_worth(worth_json, conn_db, user_id)
    return meeting_user_credit_body, worth_json
Exemplo n.º 3
0
def skill_rebuild(id, no_cache):
    conn_db = es_db.get_mysql_connector('netx')  # 上线
    skill_body, worth_json = get_skill(id, no_cache, conn_db)
    # deleted=1的情况
    if (skill_body == None):
        return None, None
#构造skill_json
    skill_user_body = add_user(skill_body, conn_db)
    json_body = add_credit_sum(skill_user_body, conn_db)
#构造worth_json
    #第一步,注入用户资料
    user_id = json_body['userId']
    worth_json = add_user_to_worth(worth_json, conn_db, True, user_id)
    #第二步,注入skill关联信息
    skill_id = json_body['id']
    worth_json = add_worth_skill(skill_id, worth_json, conn_db)
    #第三步,注入is_holdCredit
    worth_json = add_credit_sum_for_worth(worth_json, conn_db, user_id)
    #第四步,注入hit
    worth_json = add_hit('Skill', worth_json, conn_db)
    conn_db.close()
    return json_body, worth_json
Exemplo n.º 4
0
from __future__ import division
import urllib2
import sys
import datetime
import time
import json

from common import const
from utils import es_db, search_config, log, redisUtil

#设置输入流的编码格式
reload(sys)
sys.setdefaultencoding("utf-8")

conn_es = es_db.get_conn_es()
conn_db = es_db.get_mysql_connector('netx')  #上线
#conn_db = es_db.get_mysql_connector('test_netx')#测试
#conn_db = es_db.get_mysql_connector('dev_netx')#开发

create_index_body = {
    'settings': {
        # just one shard, no replicas for testing
        'number_of_shards': 1,
        'number_of_replicas': 5
    },
    'mappings': {
        'demand': {
            'properties': {
                'id': {
                    'type': 'text'
                },
Exemplo n.º 5
0
import sys
import datetime
import time
import json

from common import const
from utils import es_db, search_config, log, redisUtil

#设置输入流的编码格式
reload(sys)
sys.setdefaultencoding( "utf-8" )

conn_es = es_db.get_conn_es()
#conn_db = es_db.get_mysql_connector('netx')#上线
#conn_db = es_db.get_mysql_connector('test_netx')#测试
conn_db = es_db.get_mysql_connector('dev_netx')#开发



create_index_body = {
    'settings': {
        # just one shard, no replicas for testing
        'number_of_shards': 1,
        'number_of_replicas': 5
    },
    'mappings': {
        'match': {
            'properties': {
                'matchId': {'type': 'text'},
                'matchImageUrl': {'type': 'text'},
                'title': {'type': 'keyword'},