|
@@ -34,7 +34,12 @@ class MysqlDB:
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
+ """
|
|
|
+ 1:修改下列配置信息
|
|
|
+ 2:执行命令 python material_label.py
|
|
|
+ """
|
|
|
import time
|
|
|
+
|
|
|
# 配置集团id
|
|
|
brand_id = 1
|
|
|
# 配置数据库连接信息
|
|
@@ -43,17 +48,26 @@ if __name__ == '__main__':
|
|
|
url = "https://api-uat3.elaber.cn/elab-marketing-content/materialLabel/markingForMaterial"
|
|
|
# 需要打标物料的id
|
|
|
sql_dict = {
|
|
|
- 1: 'select a.id from house a LEFT JOIN brand_house_rlat b on a.id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = {}'.format(brand_id),
|
|
|
- 2: 'select a.id from content_moment a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = {}'.format(brand_id),
|
|
|
- 3: 'select a.id from t_content_album a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = 1'.format(brand_id),
|
|
|
- 4: 'select a.id from content_layout a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = 1'.format(brand_id)
|
|
|
+ 1: 'select a.id from house a LEFT JOIN brand_house_rlat b on a.id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = {}'.format(
|
|
|
+ brand_id),
|
|
|
+ 2: 'select a.id from content_moment a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = {}'.format(
|
|
|
+ brand_id),
|
|
|
+ 3: 'select a.id from t_content_album a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = 1'.format(
|
|
|
+ brand_id),
|
|
|
+ 4: 'select a.id from content_layout a LEFT JOIN brand_house_rlat b on a.house_id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = 1'.format(
|
|
|
+ brand_id)
|
|
|
+ }
|
|
|
+ material_dict = {
|
|
|
+ 1: '项目',
|
|
|
+ 2: '视频',
|
|
|
+ 3: '图集',
|
|
|
+ 4: '户型'
|
|
|
}
|
|
|
# 批量打标
|
|
|
for index in sql_dict.keys():
|
|
|
house = mysql.select(sql_dict.get(index))
|
|
|
count = 0
|
|
|
for x in house:
|
|
|
- print(x[0])
|
|
|
params = {
|
|
|
"deleteStatus": 2,
|
|
|
"materialId": x[0],
|
|
@@ -62,6 +76,6 @@ if __name__ == '__main__':
|
|
|
"user": "batch20201230"
|
|
|
}
|
|
|
response = requests.post(url, json=params, headers=headers_1)
|
|
|
- print(response.text)
|
|
|
+ print(material_dict.get(index), str(x[0]), '打标结果:', response.text)
|
|
|
# 每次请求后暂停下
|
|
|
time.sleep(0.5)
|