コード例 #1
0
    def push(self, oid=51):

        global logger_push
        # users = {uid: dbutil.get_user_profile(self.db, uid)
        #          for uid in dbutil.get_organization_watcher_users(self.db, oid, 'coldcall')}
        users = {
            uid: dict.fromkeys(dbutil.get_user_sectors(self.db, uid, True), 5)
            for uid in dbutil.get_organization_watcher_users(
                self.db, oid, 'coldcall')
        }
        custom_candidates = chain(*[
            self.custom_candidates.get(module, [])
            for module in dbutil.get_organization_sourcing_modules(
                self.db, oid)
        ])
        if oid in {139}:
            org_candidates = set(custom_candidates)
        else:
            org_candidates = set(self.candidates) | set(custom_candidates)
        for cid in org_candidates:
            candidates = sorted(
                [(uid, self.scorer.score(cid, utags))
                 for uid, utags in users.items()
                 if self.scorer.score(cid, utags) > self.user_company_threshold
                 and dbutil.could_recommend(self.db, uid, cid)],
                key=lambda x: x[1],
                reverse=True)
            gs = 'Y' if dbutil.exist_extract_source(self.db, cid) else 'N'
            if not candidates:
                uid = choice(users.keys())
                dbutil.update_sourcing_user(self.db, cid, uid, gongshang=gs)
                logger_push.info('Random push %s for %s' % (cid, uid))
            for uid, _ in candidates:
                dbutil.update_sourcing_user(self.db, cid, uid, gongshang=gs)
                logger_push.info('Push %s for %s' % (cid, uid))
コード例 #2
0
    def assign(self, ccid):

        oid = dbutil.get_coldcall_infos(self.db, ccid).organizationId
        uids = dbutil.get_organization_watcher_users(self.db,
                                                     oid,
                                                     purpose='coldcall')
        if not uids:
            return

        uid = choice(uids)
        dbutil.update_coldcall_user(self.db, ccid, uid, 21020)
コード例 #3
0
ファイル: mail_deliver.py プロジェクト: yujiye/Codes
def deliver_push():

    receivers = ['*****@*****.**']
    subject = u'推送情况总结 %s年%s月%s日' % (time.localtime()[:3])

    db = dbcon.connect_torndb()
    results = []
    for oid in dbutil.get_all_organizations(db):
        volumn, zero, assigned, scored, cared = 0, 0, 0, 0, 0
        for uid in dbutil.get_organization_watcher_users(db, oid):
            uvol = dbutil.get_user_task_volumn(db, uid)
            zero += 1 if uvol == 0 else 0
            volumn += uvol
            dids = [x.dealId for x in db.query('select dealId from deal_user_rel where userId=%s and type=23030 and '
                                               'createTime>date_add(curdate(), interval -7 day);')]
            assigned += len(dids)

    db.close()
コード例 #4
0
    def __init__(self):

        global logger_tcg
        self.db = dbcon.connect_torndb()
        self.mongo = dbcon.connect_mongo()
        self.logger = logger_tcg

        self.xiniu_users = dbutil.get_organization_watcher_users(self.db, 51)
        self.no_share_sources = [
            'company_big', 'track_gongshang', 'company_newcover',
            'company_create', 'gongshang_verified_online',
            'gongshang_verified_tbc', 'gongshang_verified_offline',
            'gongshang_unverified_online', 'gongshang_unverified_offline',
            'gongshang_create_online'
        ]
        self.no_clear_sources = [
            'gongshang_verified_online', 'gongshang_verified_tbc',
            'gongshang_verified_offline', 'gongshang_unverified_online',
            'gongshang_unverified_offline', 'gongshang_create_online',
            'news_funding'
        ]
コード例 #5
0
    print org_candidates


if __name__ == '__main__':

    print __file__

    if sys.argv[1] == 'push':
        db = dbconn.connect_torndb()
        push_all(db)
        db.close()
    elif sys.argv[1] == 'pushorg':
        db = dbconn.connect_torndb()
        # dbutil.mark_read_recommendations(db)
        # 烯牛资本 51
        push_people(*dbutil.get_organization_watcher_users(db, sys.argv[2]))
        db.close()
    elif sys.argv[1] == 'pushsb':
        db = dbconn.connect_torndb()
        dbutil.mark_read_recommendations(db, sys.argv[2])
        # 我自己烯牛 215
        push_people(sys.argv[2])
        db.close()
    elif sys.argv[1] == 'pushpart':
        push_someone(sys.argv[2])
    elif sys.argv[1] == 'pool':
        update_pool()
    elif sys.argv[1] == 'fellowplus':
        fellowplus()
    elif sys.argv[1] == 'debug':
        debug()