엑셀파일 저장 시 카피맨,소싱맨은 해당가격을,
키워드소싱은 평균가격을 플로스피로 입력. 배송비는 0원처리.
This commit is contained in:
parent
af186266b3
commit
e5e153777e
|
|
@ -82,6 +82,7 @@ def create_db(db_name):
|
|||
tao_imageUrl TEXT,
|
||||
tao_itemID INTEGER,
|
||||
tao_localimage TEXT,
|
||||
merged_price INTEGER,
|
||||
unique_id TEXT,
|
||||
date_created TEXT DEFAULT (DATE('now', 'localtime')),
|
||||
time_created TEXT DEFAULT (TIME('now', 'localtime')),
|
||||
|
|
|
|||
|
|
@ -151,8 +151,18 @@ def parse_naver_shopping(keyword_id, keyword, isBranch, branchCount, json_data,
|
|||
final_top_5_products = top5_products[:5]
|
||||
logger.debug(f"RANK 정렬상품 중 마지막으로 상위 제품 [{len(final_top_5_products)}]개 선택")
|
||||
|
||||
|
||||
merged_price = 0
|
||||
|
||||
for index, product in enumerate(final_top_5_products):
|
||||
price = product.get("item", {}).get("price")
|
||||
merged_price += price # 평균 가격 계산을 위해
|
||||
|
||||
merged_price = merged_price / len(final_top_5_products)
|
||||
|
||||
c = conn.cursor()
|
||||
|
||||
|
||||
# original relatedTags 리스트 가져오기
|
||||
related_tags_ori = next_data_json["props"]["pageProps"]["relatedTags"]
|
||||
|
||||
|
|
@ -245,8 +255,8 @@ def parse_naver_shopping(keyword_id, keyword, isBranch, branchCount, json_data,
|
|||
|
||||
if count == 0:
|
||||
# 중복되는 데이터가 없으면 새로운 데이터 삽입
|
||||
c.execute("INSERT INTO NaverShopping (keyword_id, keyword, price, productTitle, category1Name, category2Name, category3Name, category4Name, cat_code, openDate, mallCount, keepCnt, overseaTp, reviewCount, reviewCountSum, scoreInfo, naverPayAdAccumulatedDisplayValue, mobileLowPrice, lowPrice, deliveryFeeContent, dlvryLowPrice, imageUrl, imgSz, searchKeyword, mallProductUrl, mallPcUrl, mallName, manuTag, purchaseCnt, relatedTags, rank, unique_id, date_created, time_created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(keyword_id+1, current_keyword, price, productTitle, category1Name, category2Name, category3Name, category4Name, cat_code, openDate, mallCount, keepCnt, overseaTp, reviewCount, reviewCountSum, scoreInfo, naverPayAdAccumulatedDisplayValue, mobileLowPrice, lowPrice, deliveryFeeContent, dlvryLowPrice, imageUrl, imgSz, searchKeyword, mallProductUrl, mallPcUrl, mallName, manuTag, purchaseCnt, current_keyword, rank, unique_id, date_created, time_created)) # keyword_id, item_name, price, purchase_count, related_keywords, rank는 적절하게 설정해야 합니다.
|
||||
c.execute("INSERT INTO NaverShopping (keyword_id, keyword, price, productTitle, category1Name, category2Name, category3Name, category4Name, cat_code, openDate, mallCount, keepCnt, overseaTp, reviewCount, reviewCountSum, scoreInfo, naverPayAdAccumulatedDisplayValue, mobileLowPrice, lowPrice, deliveryFeeContent, dlvryLowPrice, imageUrl, imgSz, searchKeyword, mallProductUrl, mallPcUrl, mallName, manuTag, purchaseCnt, relatedTags, rank, merged_price, unique_id, date_created, time_created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(keyword_id+1, current_keyword, price, productTitle, category1Name, category2Name, category3Name, category4Name, cat_code, openDate, mallCount, keepCnt, overseaTp, reviewCount, reviewCountSum, scoreInfo, naverPayAdAccumulatedDisplayValue, mobileLowPrice, lowPrice, deliveryFeeContent, dlvryLowPrice, imageUrl, imgSz, searchKeyword, mallProductUrl, mallPcUrl, mallName, manuTag, purchaseCnt, current_keyword, rank, merged_price, unique_id, date_created, time_created)) # keyword_id, item_name, price, purchase_count, related_keywords, rank는 적절하게 설정해야 합니다.
|
||||
logger.debug(f"{current_keyword} DB업데이트 완료")
|
||||
else:
|
||||
# 중복되는 데이터가 있으면 업데이트 또는 무시 (여기서는 예시로 업데이트 로직을 추가함)
|
||||
|
|
@ -259,4 +269,5 @@ def parse_naver_shopping(keyword_id, keyword, isBranch, branchCount, json_data,
|
|||
logger.debug(f"키워드 검색 결과 상품 [{keyword}]에 대한 [{len(final_top_5_products)}]개의 상품정보수집 완료")
|
||||
|
||||
conn.commit() # Commit the transaction
|
||||
|
||||
#conn.close() # Close the connection
|
||||
|
|
|
|||
11
taoseller.py
11
taoseller.py
|
|
@ -1046,7 +1046,7 @@ class Ui_Dialog(QtWidgets.QDialog):
|
|||
|
||||
# 데이터베이스에서 필요한 데이터 로드
|
||||
conn = sqlite3.connect(db_name)
|
||||
query = "SELECT MatchingUrl, keyword, MatchingCat, delvFee, packingFee, plusFee, manuTag FROM NaverShopping WHERE MatchingUrl IS NOT NULL"
|
||||
query = "SELECT MatchingUrl, keyword, MatchingCat, delvFee, packingFee, plusFee, manuTag, merged_price FROM NaverShopping WHERE MatchingUrl IS NOT NULL"
|
||||
df = pd.read_sql_query(query, conn)
|
||||
conn.close()
|
||||
logger.debug("DB 읽기 완료")
|
||||
|
|
@ -1077,14 +1077,15 @@ class Ui_Dialog(QtWidgets.QDialog):
|
|||
wb = xw.Book(file_name)
|
||||
ws = wb.sheets['multi_ss']
|
||||
|
||||
final_delv = 0
|
||||
|
||||
if 'sourcingman' in self.db_name or 'copyman' in self.db_name:
|
||||
final_delv = 0
|
||||
final_price = math.ceil((row['price'])*0.98 / 100) * 100 # 2%가격을 낮춘 후 100원단위 올림
|
||||
|
||||
else:
|
||||
final_delv = row['delvFee'] + row['packingFee']
|
||||
final_price = row['plusFee']
|
||||
|
||||
# final_delv = row['delvFee'] + row['packingFee']
|
||||
# final_price = row['plusFee']
|
||||
final_price = row['murged_price']
|
||||
|
||||
# 데이터 삽입
|
||||
for index, row in df_subset.iterrows():
|
||||
|
|
|
|||
Loading…
Reference in New Issue