|
@@ -0,0 +1,38 @@
|
|
|
+
|
|
|
+import time
|
|
|
+from model.DateUtils import DateUtils
|
|
|
+from model.DataBaseUtils import MysqlUtils,CkUtils
|
|
|
+du = DateUtils()
|
|
|
+db= MysqlUtils()
|
|
|
+ck = CkUtils()
|
|
|
+
|
|
|
+def src_book_info():
|
|
|
+ sql="""SELECT date_format(a.effect_day,'%Y-%m-%d'),a.type,b.book_name,c.platform_name,a.node_price from t_platform_book_ratio a
|
|
|
+ left join t_platform_book b on a.platform_book_id=b.id
|
|
|
+ left join t_platform_novel c on b.platform_id=c.id """
|
|
|
+
|
|
|
+ data =db.zx.getData(sql)
|
|
|
+
|
|
|
+ di={}
|
|
|
+ for i in data:
|
|
|
+ thedate = i[0]
|
|
|
+ while True:
|
|
|
+ if thedate>du.get_n_days(0):
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ di[thedate+','+i[1]+','+i[2]+','+i[3]]=i[4]
|
|
|
+ thedate=du.add_days(thedate,1)
|
|
|
+
|
|
|
+ li=[]
|
|
|
+ for i,j in di.items():
|
|
|
+ li.append(i.split(',')+[j])
|
|
|
+ db.dm.execute("truncate table src_book_info")
|
|
|
+ db.dm.executeMany("insert into src_book_info values (%s,%s,%s,%s,%s)",li)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+
|
|
|
+ src_book_info()
|
|
|
+
|
|
|
+
|