Exemplo n.º 1
0
def scan_article(weixin_info_id=None, weixin_nos=None, look_back=True):
    from gather import script
    if weixin_info_id is not None:
        print "task: scan_article start. weixin_info_id="+str(weixin_info_id)
        script.scan_article(weixin_info_id=weixin_info_id)
    elif weixin_nos is not None:
        weixin_no_list = weixin_nos.split(",")
        for weixin_no in weixin_no_list:
            if weixin_no.strip()!="":
                from gather.models import WeixinInfo
                weixinInfo = WeixinInfo.objects.get(weixin_no=weixin_no.strip())
                if weixinInfo and weixinInfo.weixin_name:
                    if len(weixinInfo.openid)==0:
                        weixin_infos = script.search_weixin_info(weixinInfo.weixin_name, is_all=True)
                        for weixin_info in weixin_infos:
                            if weixin_info[1]==weixinInfo.weixin_no:
                                weixinInfo.weixin_name=weixin_info[0]
                                weixinInfo.weixin_no=weixin_info[1]
                                weixinInfo.openid=weixin_info[2]
                                weixinInfo.save()
                                break
                    script.scan_article(weixin_info_id=weixinInfo.id, look_back=look_back)
                else:
                    print "scan_article: can not find weixin_no="+weixin_no
    else:
        print "scan_article: need params(weixin_info_id or weixin_nos)"
Exemplo n.º 2
0
def scan_article(weixin_info_id=None, weixin_nos=None, look_back=True):
    from gather import script
    if weixin_info_id is not None:
        print "task: scan_article start. weixin_info_id=" + str(weixin_info_id)
        script.scan_article(weixin_info_id=weixin_info_id)
    elif weixin_nos is not None:
        weixin_no_list = weixin_nos.split(",")
        for weixin_no in weixin_no_list:
            if weixin_no.strip() != "":
                from gather.models import WeixinInfo
                weixinInfo = WeixinInfo.objects.get(
                    weixin_no=weixin_no.strip())
                if weixinInfo and weixinInfo.weixin_name:
                    if len(weixinInfo.openid) == 0:
                        weixin_infos = script.search_weixin_info(
                            weixinInfo.weixin_name, is_all=True)
                        for weixin_info in weixin_infos:
                            if weixin_info[1] == weixinInfo.weixin_no:
                                weixinInfo.weixin_name = weixin_info[0]
                                weixinInfo.weixin_no = weixin_info[1]
                                weixinInfo.openid = weixin_info[2]
                                weixinInfo.save()
                                break
                    script.scan_article(weixin_info_id=weixinInfo.id,
                                        look_back=look_back)
                else:
                    print "scan_article: can not find weixin_no=" + weixin_no
    else:
        print "scan_article: need params(weixin_info_id or weixin_nos)"
Exemplo n.º 3
0
def scan_article(request, weixin_info_id):
    message = script.scan_article(weixin_info_id=weixin_info_id)
    html = "<html><body>扫描结束. %s</body></html>" % message
    return HttpResponse(html)
Exemplo n.º 4
0
def scan_all_article():
    weixinInfoList = dbutils.getWeixinInfoList()
    for weixinInfo in weixinInfoList:
        scan_article(weixin_info_id=weixinInfo.id)
Exemplo n.º 5
0
def scan_all_article():
    weixinInfoList = dbutils.getWeixinInfoList()
    for weixinInfo in weixinInfoList:
        scan_article(weixin_info_id=weixinInfo.id)
Exemplo n.º 6
0
def scan_article(request, weixin_info_id):
    message = script.scan_article(weixin_info_id=weixin_info_id)
    html = "<html><body>扫描结束. %s</body></html>" % message
    return HttpResponse(html)