|
@@ -1,12 +1,15 @@
|
|
|
import pymysql
|
|
|
|
|
|
-class mysqlSearchUtils():
|
|
|
+
|
|
|
+class MysqlSearchUtils():
|
|
|
+
|
|
|
def __init__(self):
|
|
|
try:
|
|
|
self.conn = pymysql.connect(host="139.186.27.96",port=4000,user="data",passwd="hcst@2021",db="jeecg-boot",charset="utf8mb4")
|
|
|
self.cursor = self.conn.cursor()
|
|
|
except pymysql.err as e:
|
|
|
print("error"% e)
|
|
|
+
|
|
|
def get_one(self):
|
|
|
sql = "select * from ctop_user_allocation where account_id = %s order by id desc"
|
|
|
self.cursor.execute(sql, ('9556344',))
|
|
@@ -23,11 +26,28 @@ class mysqlSearchUtils():
|
|
|
self.cursor.close()
|
|
|
return result
|
|
|
|
|
|
+ def get_all_ai_account_target_template_by_params(self,status,account_id):
|
|
|
+ sql = "select * from ctop_ai_kuaishou_auto_creative_account_info where status = %s order by id desc"
|
|
|
+ self.cursor.execute(sql, (status,))
|
|
|
+ rest = self.cursor.fetchall()
|
|
|
+ result = [dict(zip([k[0] for k in self.cursor.description], row)) for row in rest]
|
|
|
+ self.cursor.close()
|
|
|
+ return result
|
|
|
+
|
|
|
def db_close(self):
|
|
|
self.conn.close()
|
|
|
|
|
|
+ def get_kuaishou_video_list_by_params(self, accountId, startDate, endDate):
|
|
|
+ sql = "select * from ctop_kuaishou_video_get where account_id = %s and stat_date>= %s and stat_date<=%s order by id desc"
|
|
|
+ self.cursor.execute(sql, (accountId,startDate,endDate))
|
|
|
+ rest = self.cursor.fetchall()
|
|
|
+ result = [dict(zip([k[0] for k in self.cursor.description], row)) for row in rest]
|
|
|
+ self.cursor.close()
|
|
|
+ return result
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
- obj = mysqlSearchUtils()
|
|
|
+ obj = MysqlSearchUtils()
|
|
|
reslt = obj.get_all()
|
|
|
for item in reslt:
|
|
|
print(item)
|