This commit is contained in:
pengtao 2019-09-30 13:36:12 +08:00
parent 9aa503125f
commit c5afe12db7

View File

@ -8,7 +8,7 @@ from ops.mmysql import MysqlBase
import random import random
import requests import requests
import pdb import pdb
define_logger("/data/logs/init_first_ad_channel.log") define_logger("/data/logs/get_news.log")
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
TimeDelay = 60*60 TimeDelay = 60*60
@ -116,8 +116,8 @@ class InitFirstAD():
if data: if data:
line = len(data) line = len(data)
nums = int(line * ratio / 100) nums = int(line * ratio / 100)
if ratio != 100: if int(ratio) != int(100):
print(f"all={line} nums={nums}") print(f"all={line} nums={nums} ratio={ratio}")
if nums: if nums:
return random.sample(data, nums) return random.sample(data, nums)
else: else: