rabin vor 7 Jahren
Ursprung
Commit
97977f2d0f
1 geänderte Dateien mit 14 neuen und 5 gelöschten Zeilen
  1. 14 5
      service/ssgdfs.py

+ 14 - 5
service/ssgdfs.py

@@ -13,10 +13,8 @@ class Ssgdfs(object):
 	def start(self):
 		if 'product' in self.config and self.config['product']:
 			try:
-				# 打开浏览器
-				self.open()
-				# 登录
-				self.login()
+				# 启动
+				self.restart()
 				# 开始进入抢购下单核心程序
 				self.core()
 				# 关闭
@@ -25,6 +23,12 @@ class Ssgdfs(object):
 				print e
 				self.start()
 
+	def restart(self):
+		# 打开浏览器
+		self.open()
+		# 登录
+		self.login()
+
 	def core(self):
 		# 开启多任务
 		'''
@@ -61,7 +65,12 @@ class Ssgdfs(object):
 					product.status(config['id'], 2)
 					continue
 			else:
-				time.sleep(30)
+				if self.num == 100:
+					print 'restart'
+					self.restart()
+					break
+				else:
+					time.sleep(30)
 				'''
 				self.num = self.num + 1
 				#self.close()