|
@@ -580,6 +580,102 @@ class TongCe:
|
|
|
print()
|
|
|
|
|
|
|
|
|
+ sql_17 = '''
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ uuid,
|
|
|
+ created,
|
|
|
+ `status`,
|
|
|
+ sub_question_id,
|
|
|
+ testcase_id,
|
|
|
+ title,
|
|
|
+ score,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ district
|
|
|
+ FROM
|
|
|
+ f_t_daren_score_2
|
|
|
+ WHERE
|
|
|
+ testcase_id IN (84, 85, 86, 87)
|
|
|
+ AND sub_question_id = 377
|
|
|
+ AND score = 2917
|
|
|
+ AND (
|
|
|
+ city IN (
|
|
|
+ '昆明市',
|
|
|
+ '西安市',
|
|
|
+ '咸阳市',
|
|
|
+ '郑州市',
|
|
|
+ '洛阳市',
|
|
|
+ '武汉市',
|
|
|
+ '襄阳市',
|
|
|
+ '重庆市',
|
|
|
+ '璧山'
|
|
|
+ )
|
|
|
+ OR province IN (
|
|
|
+ '昆明市',
|
|
|
+ '西安市',
|
|
|
+ '咸阳市',
|
|
|
+ '郑州市',
|
|
|
+ '洛阳市',
|
|
|
+ '武汉市',
|
|
|
+ '襄阳市',
|
|
|
+ '重庆市',
|
|
|
+ '璧山'
|
|
|
+ )
|
|
|
+ OR district IN (
|
|
|
+ '昆明市',
|
|
|
+ '西安市',
|
|
|
+ '咸阳市',
|
|
|
+ '郑州市',
|
|
|
+ '洛阳市',
|
|
|
+ '武汉市',
|
|
|
+ '襄阳市',
|
|
|
+ '重庆市',
|
|
|
+ '璧山区'
|
|
|
+ )
|
|
|
+ )
|
|
|
+ '''
|
|
|
+
|
|
|
+ sql_18 = '''
|
|
|
+ update f_t_daren_score_2 set score = %s where id = %s
|
|
|
+ '''
|
|
|
+
|
|
|
+ city_info = {
|
|
|
+ '昆明市': 2918,
|
|
|
+ '西安市': 2919,
|
|
|
+ '咸阳市': 2920,
|
|
|
+ '郑州市': 2921,
|
|
|
+ '洛阳市': 2922,
|
|
|
+ '武汉市': 2923,
|
|
|
+ '襄阳市': 2924,
|
|
|
+ '重庆市': 2925,
|
|
|
+ '璧山市': 2926
|
|
|
+ }
|
|
|
+
|
|
|
+ def other_city_clean(self):
|
|
|
+ update_data = []
|
|
|
+ need_update_data = self.marketing_db.select(self.sql_17)
|
|
|
+ for nd in need_update_data:
|
|
|
+ id = nd[0]
|
|
|
+ province = nd[8]
|
|
|
+ city = nd[9]
|
|
|
+ district = nd[10]
|
|
|
+ bishan = self.city_info.get(district)
|
|
|
+ if bishan:
|
|
|
+ update_data.append([bishan, id])
|
|
|
+ else:
|
|
|
+ city_id = self.city_info.get(city)
|
|
|
+ if city_id:
|
|
|
+ update_data.append([city_id, id])
|
|
|
+ else:
|
|
|
+ province_id = self.city_info.get(province)
|
|
|
+ if province_id:
|
|
|
+ update_data.append([province_id, id])
|
|
|
+ self.marketing_db.add_some(self.sql_18, update_data)
|
|
|
+
|
|
|
+ return len(update_data)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
tongce = TongCe()
|
|
|
tongce.insert_into_rule()
|