Esempio n. 1
0
 def cronOrder(self, merchantid, first=False):
     mer = Merchant.objects.filter(id = merchantid)[0]
     try:
         if not first:
             nowt = datetime.datetime.now()
             if isactive(mer.netspider_time.replace(tzinfo=None), det=19):
                 return True
         mer.netspider_time = datetime.datetime.now()
         meires = None
         print('%s is online' % mer.name)
         CatcheData.objects.get_or_create(merchant=mer)
         if mer.ele_account != '' and mer.ele_status is True:
             elecat = Ele(merchantid, self.__use_proxy)
             eleres = elecat.catcheorder(mer)
         if mer.mei_account != '' and mer.mei_status is True:
             print 'mei excet'
             meicat = Mei(merchantid, self.__use_proxy)
             meires = meicat.getOrder(mer)
         if mer.tao_account != '' and mer.tao_status is True:
             tddcat = Tao()
             tddres = tddcat.getpaddingorder(mer)
         mer.save()
         return meires
     except Exception, e:
         mer.save()
         print 'ALO ERROR'
         except_handle(e)
Esempio n. 2
0
def netSpiderStatus(req):
    merchant0 = request.session.get('username')
    merchant = Merchant.objects.get(alin_account=merchant0)
    mystatus = merchant.netspider_time.replace(tzinfo = None)
    return isactive(mystatus, 30)
Esempio n. 3
0
def netSpiderStatus(req):
    merchant0 = request.session.get('username')
    merchant = Merchant.objects.get(alin_account=merchant0)
    mystatus = merchant.netspider_time.replace(tzinfo=None)
    return isactive(mystatus, 30)