|
@@ -34,34 +34,39 @@ def run(dt):
|
|
|
for i in data:
|
|
|
# print(i)
|
|
|
li.extend(i[-1].split(','))
|
|
|
- # print(li)
|
|
|
#TODO:之后如果一天产生的图片过多,可能超过sql的字符限制
|
|
|
|
|
|
- sql3 = f"select image_id,preview_url,signature from image_info where image_id in ({str(set(li))[1:-1]})"
|
|
|
+ sql3 = f"select image_id,preview_url,signature,width,height from image_info where image_id in ({str(set(li))[1:-1]})"
|
|
|
|
|
|
image_di = {}
|
|
|
image_data = db.quchen_text.getData(sql3)
|
|
|
for x in image_data:
|
|
|
- image_di[x[0]] = (x[1],x[2])
|
|
|
+ image_di[x[0]] = (x[1],x[2],x[3],x[4])
|
|
|
|
|
|
# print(image_di)
|
|
|
|
|
|
for i in data:
|
|
|
y = ''
|
|
|
z = ''
|
|
|
+ width = ''
|
|
|
+ height = ''
|
|
|
for j in i[-1].split(','):
|
|
|
if image_di.get(j):
|
|
|
y = y + ',' + image_di.get(j)[0]
|
|
|
z = z + ',' + image_di.get(j)[1]
|
|
|
+ width = width + ',' + str(image_di.get(j)[2])
|
|
|
+ height = height + ',' + str(image_di.get(j)[3])
|
|
|
i.append(y[1:])
|
|
|
i.append(z[1:])
|
|
|
i.append(0)
|
|
|
+ i.append(width[1:])
|
|
|
+ i.append(height[1:])
|
|
|
|
|
|
- # print(data)
|
|
|
# print(data)
|
|
|
# exit(0)
|
|
|
sql_video = f"""SELECT a.dt,b.type,sum(a.cost),sum(view_count),sum(click_count),sum(follow_count),sum(order_count),sum(order_amount),
|
|
|
- title,description,book,platform,stage,e.channel,pitcher,ifnull(image_id,''),g.preview_url,g.signature,1
|
|
|
+ title,description,book,platform,stage,e.channel,pitcher,ifnull(image_id,''),g.preview_url,g.signature,1,
|
|
|
+ g.width,g.height
|
|
|
from
|
|
|
ad_cost_day a
|
|
|
left join ad_info b on a.ad_id=b.ad_id
|
|
@@ -76,13 +81,9 @@ def run(dt):
|
|
|
data_video = db.quchen_text.get_data_list(sql_video)
|
|
|
data.extend(data_video)
|
|
|
|
|
|
-
|
|
|
- # print(data)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ #进行数据存储
|
|
|
db.dm.execute(f'delete from dw_image_cost_day where dt="{dt}"')
|
|
|
- db.dm.executeMany("replace into dw_image_cost_day values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",data)
|
|
|
+ db.dm.executeMany("replace into dw_image_cost_day values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",data)
|
|
|
|
|
|
|
|
|
|