郑毅 3 月之前
父節點
當前提交
ab7d0849b5
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      spider_test/by_request.py

+ 7 - 7
spider_test/by_request.py

@@ -414,18 +414,18 @@ def get_loc():
 
 
 def convert_geo():
 def convert_geo():
     with session_maker() as session:
     with session_maker() as session:
-        hotels = session.query(SaaSHotel).filter((SaaSHotel.loc_type == 1 or SaaSHotel.loc_type == 3) and SaaSHotel.lon.is_not(None) and SaaSHotel.lat.is_not(None)).all()
+        hotels = session.query(Hotel).filter((Hotel.s_loc_type == 1 or Hotel.s_loc_type == 3) and Hotel.s_lon.is_not(None) and Hotel.s_lat.is_not(None)).all()
         i = 0
         i = 0
         length = len(hotels)
         length = len(hotels)
         for h in hotels:
         for h in hotels:
             i += 1
             i += 1
             try:
             try:
-                if h.loc_type == 3:
-                    h.lon, h.lat = gcj02_to_wgs84(h.lon, h.lat)
-                    h.loc_type = 2
-                elif h.loc_type == 1:
-                    h.lon, h.lat = bd09_to_wgs84(h.lon, h.lat)
-                    h.loc_type = 2
+                if h.s_loc_type == 3:
+                    h.s_lon, h.s_lat = gcj02_to_wgs84(h.s_lon, h.s_lat)
+                    h.s_loc_type = 2
+                elif h.s_loc_type == 1:
+                    h.s_lon, h.s_lat = bd09_to_wgs84(h.s_lon, h.s_lat)
+                    h.s_loc_type = 2
 
 
                 if i % commit_buff_size == 0 or i >= length:
                 if i % commit_buff_size == 0 or i >= length:
                     session.commit()
                     session.commit()