def __init__(self): self.tab = g_Usage try: g_Usage.create_table() except: pass self.mapp2catalog = MInfor2Catalog() self.muser = MUser()
def run_update_count(): mapp2cat = MInfor2Catalog() mappcat = MCategory() for rec in mappcat.query_all( kind = constant['cate_info'] ): uid= rec.uid print(rec.name) # uuvv = mapp.query_extinfo_by_cat(uid) uuvv = mapp2cat.query_by_catid(rec.uid) print(uid, uuvv.count()) mappcat.update_count(uid, uuvv.count())
def initialize(self, hinfo=''): self.init() self.mevaluation = MEvaluation() self.mapp2catalog = MInfor2Catalog() self.mapp2tag = MInfor2Label() self.minfo = MInfor() self.musage = MUsage() self.mcat = MCategory() self.mrel = MInforRel() # self.mreply = MInfor2Reply() self.kind = '2'
def initialize(self, hinfo=''): self.init() self.mevaluation = MEvaluation() self.mpost2label = MInfor2Label() self.mpost2catalog = MInfor2Catalog() self.mpost = MInfor() self.musage = MUsage() self.mcat = MCategory() self.mrel = MInforRel() self.mreply = MReply() self.mpost_hist = MInfoHist()
def run_update_count(): mapp2cat = MInfor2Catalog() mappcat = MCategory() for kd in router_post.keys(): for rec in mappcat.query_all(kind=kd): uid = rec.uid print(rec.name) # uuvv = mapp.query_extinfo_by_cat(uid) uuvv = mapp2cat.query_by_catid(rec.uid) print(uid, uuvv.count()) mappcat.update_count(uid, uuvv.count())
def initialize(self): self.init() self.mpost = MInfor() self.mcat = MCategory() self.cats = self.mcat.query_all() self.mpost_hist = MInfoHist() self.mpost2catalog = MInfor2Catalog() self.mpost2reply = MInfor2Reply() self.mpost2label = MInfor2Label() self.mrel = MInforRel() self.musage = MUsage() self.mevaluation = MEvaluation() self.kind = '2'
def do_tabapp(): print('==============================') print('For Infor ... ') from torcms.model.post_model import MPost from torcms.model.infor2catalog_model import MInfor2Catalog mpost = MPost() mpost2tag = MInfor2Catalog() from model_ent.infor_model import MInfor minfor = MInfor() info_recs = minfor.query_all(20000) for info_rec in info_recs: # print(info_rec.uid) # info_tag = mpost2tag.get_entry_catalog(info_rec.uid).uid extinfo = info_rec.extinfo if 'def_cat_uid' in extinfo: old_cat_id = extinfo['def_cat_uid'] extinfo['def_cat_uid'] = retag(old_cat_id) extinfo['def_cat_pid'] = retag(old_cat_id)[:2] + '00' # print(extinfo['def_cat_uid']) post_data = { 'title': info_rec.title, 'user_name': info_rec.user_name, 'logo': info_rec.logo, 'cnt_md': unescape(info_rec.cnt_md), 'keywords': info_rec.keywords, 'kind': '2', 'extinfo': extinfo, # 'time_create': info_rec.time_create, 'time_update': info_rec.time_update, } # mpost.insert_data('m' + info_rec.uid, post_data) # print(info_rec.uid) mpost.add_or_update(info_rec.uid, post_data) if 'def_cat_uid' in extinfo: try: mpost2tag.add_record(info_rec.uid, extinfo['def_cat_uid'], 1) except: print(info_rec.title)
def do_app2catalog(): print('==============================') print('For App tags ... ') from torcms.model.post2catalog_model import MPost2Catalog as MPost2Tag mpost2tag = MPost2Tag() from model_ent.post2catalog_model import MPost2Catalog mpost2cat = MPost2Catalog() raw_recs = mpost2cat.query_all(limit_num=200000) for raw_rec in raw_recs: if raw_rec.post.uid.startswith('m') or raw_rec.post.uid.startswith( 'g'): continue mpost2tag.add_record(buqi_postid(raw_rec.post.uid), raw_rec.catalog.uid, raw_rec.order) from model_ent.infor2catalog_model import MInfor2Catalog minfo2cat = MInfor2Catalog() raw_recs = minfo2cat.query_all(2000000) for raw_rec in raw_recs: mpost2tag.add_record(raw_rec.post.uid, retag(raw_rec.catalog.uid), raw_rec.order)
def initialize(self): self.init() self.kind = constant['cate_info'] self.mequa = MInfor() self.mcat = MCategory() self.mapp2tag = MInfor2Catalog()
def __init__(self): self.tab_relation = g_Rel self.tab_post = g_Post self.tab_post2tag = g_Post2Tag self.minfo2tag = MInfor2Catalog()
def Test(): assert MInfor2Catalog()
def initialize(self): self.init() self.kind = 'm' self.mequa = MInfor() self.mcat = MCategory() self.mapp2tag = MInfor2Catalog()
import config from whoosh.index import create_in, open_dir from whoosh.fields import * from whoosh.qparser import QueryParser from jieba.analyse import ChineseAnalyzer from torcms.model.post_model import MPost from torcms.model.info_model import MInfor as MApp from torcms.model.category_model import MCategory as MInforCatalog from torcms.model.infor2catalog_model import MInfor2Catalog from config import router_post mappcat = MInforCatalog() minfo2tag = MInfor2Catalog() from torcms.model.wiki_model import MWiki from torcms.model.page_model import MPage def do_for_app(writer, rand=True, kind='', doc_type=''): mpost = MApp() if rand: recs = mpost.query_random(50, kind=kind) else: recs = mpost.query_recent(50, kind=kind) print(recs.count()) for rec in recs: # # sleep(0.1)