|
|
@@ -16,15 +16,15 @@ class Roll_Lanqiupipeline(object):
|
|
|
self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
|
|
|
self.db = self.mongo[M_DB]
|
|
|
|
|
|
- @defer.inlineCallbacks
|
|
|
- def process_item(self, item, spider):
|
|
|
- out = defer.Deferred()
|
|
|
- reactor.callInThread(self._do_calculation, item, out)
|
|
|
- yield out
|
|
|
- defer.returnValue(item)
|
|
|
-
|
|
|
+ # @defer.inlineCallbacks
|
|
|
# def process_item(self, item, spider):
|
|
|
- def _do_calculation(self, item, out):
|
|
|
+ # out = defer.Deferred()
|
|
|
+ # reactor.callInThread(self._do_calculation, item, out)
|
|
|
+ # yield out
|
|
|
+ # defer.returnValue(item)
|
|
|
+
|
|
|
+ def process_item(self, item, spider):
|
|
|
+ # def _do_calculation(self, item, out):
|
|
|
# 使用twisted将mysql插入变成异步执行
|
|
|
logger = logging.getLogger(__name__)
|
|
|
# 联赛id
|
|
|
@@ -186,11 +186,11 @@ class Roll_Lanqiupipeline(object):
|
|
|
odd_evens_data = dict(zip(odd_evens_key, odd_evens_value))
|
|
|
data_list.append(odd_evens_data)
|
|
|
|
|
|
- lastnumber_dict = {'0或5': 'lnh0', '1或6': 'lnh1', '2或7': 'lnh2', '3或8': 'lnh3', '4或9': 'lnh4'}
|
|
|
+ lasthome_dict = {'0或5': 'lnh0', '1或6': 'lnh1', '2或7': 'lnh2', '3或8': 'lnh3', '4或9': 'lnh4'}
|
|
|
last_home = last_numbers_dict['last_home']
|
|
|
if last_home:
|
|
|
for key, value in last_home.items():
|
|
|
- odds_code =lastnumber_dict[key]
|
|
|
+ odds_code =lasthome_dict[key]
|
|
|
hash_str = "LN" + odds_code + '0' + str(key) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = "LN" + str(key) + '0' + str(match_id) + "hg3535"
|
|
|
@@ -204,9 +204,10 @@ class Roll_Lanqiupipeline(object):
|
|
|
data_list.append(last_home_data)
|
|
|
|
|
|
last_guest = last_numbers_dict['last_guest']
|
|
|
+ lastguest_dict = {'0或5': 'lng0', '1或6': 'lng1', '2或7': 'lng2', '3或8': 'lng3', '4或9': 'lng4'}
|
|
|
if last_guest:
|
|
|
for key, value in last_guest.items():
|
|
|
- odds_code = lastnumber_dict[key]
|
|
|
+ odds_code = lastguest_dict[key]
|
|
|
# condition = lastnumber_dict[key]
|
|
|
hash_str = "LN" + odds_code + '0' + str(key) + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = "LN" + str(key) + '0' + str(match_id) + "hg3535"
|
|
|
@@ -314,4 +315,4 @@ class Roll_Lanqiupipeline(object):
|
|
|
# else:
|
|
|
# logger.warning('{},赛事结果状态接口异常提交失败, {}'.format('lq', res))
|
|
|
# logger.warning(status_dict)
|
|
|
- reactor.callFromThread(out.callback, item)
|
|
|
+ # reactor.callFromThread(out.callback, item)
|