| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914 |
- import tkinter as tk
- from tkinter import ttk, filedialog, messagebox, scrolledtext
- import pandas as pd
- import requests
- import json
- import threading
- import time
- import random
- import re
- from datetime import datetime
- import os
- import shutil
- from openpyxl import load_workbook
- from openpyxl.utils import get_column_letter
- from PIL import Image
- import io
- import base64
- import zlib
- class FeishuSubmitApp:
- def __init__(self, root):
- self.root = root
- self.root.title("飞书表格数据提交工具 - 自动提取图片")
- self.root.geometry("1100x800")
-
- # 状态变量
- self.is_running = False
- self.stop_flag = False
- self.excel_file = ""
- self.cookie_string = ""
-
- # 图片缓存
- self.image_cache = {} # {行号: [图片数据列表]}
- self.image_extract_folder = None
- self.uploaded_cache = {} # 缓存已上传的图片token {行号: attachment_info}
-
- # 从curl提取的默认配置
- self.default_headers = {
- "accept": "application/json, text/plain, */*",
- "accept-language": "zh-CN,zh;q=0.9",
- "content-type": "application/json",
- "f-version": "docs-6-17-1781628518399",
- "origin": "https://xhd.feishu.cn",
- "priority": "u=1, i",
- "referer": "https://xhd.feishu.cn/share/base/form/shrcnJqFUFF0sqlmrfsWpDNf8df",
- "sec-ch-ua": '"Chromium";v="148", "Google Chrome";v="148", "Not/A)Brand";v="99"',
- "sec-ch-ua-mobile": "?0",
- "sec-ch-ua-platform": '"Windows"',
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-origin",
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36",
- "x-csrftoken": "83aae12269bced10680d3ccf817f82262305e7d0-1781579108",
- "x-tt-logid": "02178275091573600000000000000000000ffff5bd640caae0cb8",
- "x-tt-trace": "1"
- }
-
- self.url = "https://xhd.feishu.cn/space/api/bitable/share/content"
- self.share_token = "shrcnJqFUFF0sqlmrfsWpDNf8df"
-
- self.setup_ui()
- self.load_config()
-
- def setup_ui(self):
- """构建界面"""
- # 主容器
- main_frame = ttk.Frame(self.root, padding="10")
- main_frame.pack(fill=tk.BOTH, expand=True)
-
- # ========== 第一行:文件选择 ==========
- file_frame = ttk.LabelFrame(main_frame, text="📁 数据文件", padding="10")
- file_frame.pack(fill=tk.X, pady=(0, 10))
-
- ttk.Label(file_frame, text="Excel文件:").grid(row=0, column=0, sticky=tk.W)
- self.file_path_var = tk.StringVar()
- ttk.Entry(file_frame, textvariable=self.file_path_var, width=60).grid(row=0, column=1, padx=(10, 10))
- ttk.Button(file_frame, text="浏览...", command=self.select_file).grid(row=0, column=2)
-
- ttk.Label(file_frame, text="工作表:").grid(row=1, column=0, sticky=tk.W, pady=(10, 0))
- self.sheet_var = tk.StringVar(value="Sheet1")
- ttk.Entry(file_frame, textvariable=self.sheet_var, width=20).grid(row=1, column=1, sticky=tk.W, padx=(10, 10), pady=(10, 0))
- ttk.Label(file_frame, text="(默认: Sheet1)").grid(row=1, column=2, sticky=tk.W, pady=(10, 0))
-
- # ========== 第二行:Cookie配置 ==========
- cookie_frame = ttk.LabelFrame(main_frame, text="🍪 Cookie 配置", padding="10")
- cookie_frame.pack(fill=tk.X, pady=(0, 10))
-
- ttk.Label(cookie_frame, text="Cookie:").grid(row=0, column=0, sticky=tk.W)
- self.cookie_text = tk.Text(cookie_frame, height=4, width=80, wrap=tk.WORD)
- self.cookie_text.grid(row=0, column=1, padx=(10, 10), pady=(0, 5), sticky=tk.W)
-
- cookie_btn_frame = ttk.Frame(cookie_frame)
- cookie_btn_frame.grid(row=1, column=1, sticky=tk.W, padx=(10, 0))
- ttk.Button(cookie_btn_frame, text="从剪贴板粘贴", command=self.paste_cookie).pack(side=tk.LEFT, padx=(0, 10))
- ttk.Button(cookie_btn_frame, text="保存配置", command=self.save_config).pack(side=tk.LEFT, padx=(0, 10))
- ttk.Button(cookie_btn_frame, text="加载默认", command=self.load_default_cookie).pack(side=tk.LEFT)
-
- # ========== 第三行:发送控制 ==========
- control_frame = ttk.LabelFrame(main_frame, text="⚙️ 发送控制", padding="10")
- control_frame.pack(fill=tk.X, pady=(0, 10))
-
- # 间隔配置
- ttk.Label(control_frame, text="最小间隔(秒):").grid(row=0, column=0, sticky=tk.W)
- self.min_interval_var = tk.StringVar(value="20")
- ttk.Entry(control_frame, textvariable=self.min_interval_var, width=10).grid(row=0, column=1, padx=(5, 15), sticky=tk.W)
-
- ttk.Label(control_frame, text="最大间隔(秒):").grid(row=0, column=2, sticky=tk.W)
- self.max_interval_var = tk.StringVar(value="50")
- ttk.Entry(control_frame, textvariable=self.max_interval_var, width=10).grid(row=0, column=3, padx=(5, 15), sticky=tk.W)
-
- ttk.Label(control_frame, text="起始行:").grid(row=0, column=4, sticky=tk.W)
- self.start_row_var = tk.StringVar(value="2")
- ttk.Entry(control_frame, textvariable=self.start_row_var, width=8).grid(row=0, column=5, padx=(5, 15), sticky=tk.W)
- ttk.Label(control_frame, text="(表头在第1行)").grid(row=0, column=6, sticky=tk.W)
-
- # 操作按钮
- btn_frame = ttk.Frame(control_frame)
- btn_frame.grid(row=1, column=0, columnspan=7, pady=(15, 0), sticky=tk.W)
-
- self.start_btn = ttk.Button(btn_frame, text="🚀 开始发送", command=self.start_send)
- self.start_btn.pack(side=tk.LEFT, padx=(0, 10))
-
- self.stop_btn = ttk.Button(btn_frame, text="⏹ 停止", command=self.stop_send, state=tk.DISABLED)
- self.stop_btn.pack(side=tk.LEFT, padx=(0, 10))
-
- ttk.Button(btn_frame, text="清空日志", command=self.clear_log).pack(side=tk.LEFT, padx=(0, 10))
- ttk.Button(btn_frame, text="📸 提取图片", command=self.extract_images).pack(side=tk.LEFT)
-
- # 状态显示
- self.status_var = tk.StringVar(value="就绪")
- ttk.Label(control_frame, textvariable=self.status_var, foreground="blue").grid(row=2, column=0, columnspan=7, pady=(10, 0), sticky=tk.W)
-
- # ========== 日志显示 ==========
- log_frame = ttk.LabelFrame(main_frame, text="📋 发送日志", padding="10")
- log_frame.pack(fill=tk.BOTH, expand=True)
-
- self.log_text = scrolledtext.ScrolledText(log_frame, height=20, wrap=tk.WORD, font=("Consolas", 9))
- self.log_text.pack(fill=tk.BOTH, expand=True)
-
- # 日志颜色标签
- self.log_text.tag_config("success", foreground="green")
- self.log_text.tag_config("error", foreground="red")
- self.log_text.tag_config("info", foreground="blue")
- self.log_text.tag_config("warning", foreground="orange")
- self.log_text.tag_config("debug", foreground="purple")
-
- # ========== 底部状态栏 ==========
- status_bar = ttk.Frame(self.root)
- status_bar.pack(fill=tk.X, side=tk.BOTTOM)
- ttk.Label(status_bar, textvariable=self.status_var, relief=tk.SUNKEN, anchor=tk.W).pack(fill=tk.X, padx=5, pady=2)
-
- def select_file(self):
- """选择Excel文件"""
- file_path = filedialog.askopenfilename(
- title="选择Excel文件",
- filetypes=[("Excel files", "*.xlsx *.xls"), ("All files", "*.*")]
- )
- if file_path:
- self.file_path_var.set(file_path)
- self.excel_file = file_path
- self.log(f"已选择文件: {file_path}", "info")
-
- # 尝试自动识别工作表
- try:
- xl = pd.ExcelFile(file_path)
- sheets = xl.sheet_names
- if sheets:
- self.sheet_var.set(sheets[0])
- self.log(f"自动选择工作表: {sheets[0]}", "info")
- except Exception as e:
- self.log(f"读取工作表失败: {str(e)}", "warning")
-
- def paste_cookie(self):
- """从剪贴板粘贴Cookie"""
- try:
- clipboard_text = self.root.clipboard_get()
- if "cookie:" in clipboard_text.lower() or "-H" in clipboard_text:
- cookie_match = re.search(r'-b\s+"([^"]+)"', clipboard_text)
- if not cookie_match:
- cookie_match = re.search(r'-H\s+"cookie:\s*([^"]+)"', clipboard_text, re.IGNORECASE)
- if cookie_match:
- self.cookie_text.delete(1.0, tk.END)
- self.cookie_text.insert(1.0, cookie_match.group(1))
- self.log("已从剪贴板提取Cookie", "success")
- return
-
- self.cookie_text.delete(1.0, tk.END)
- self.cookie_text.insert(1.0, clipboard_text)
- self.log("已粘贴Cookie", "info")
- except:
- messagebox.showwarning("提示", "无法读取剪贴板内容")
-
- def load_default_cookie(self):
- """加载默认Cookie"""
- default_cookie = "_uuid_hera_ab_path_1=7651649498397052109; __tea__ug__uid=4144561781538482924; _gcl_au=1.1.775810441.1781538483; lgw_csrf_token=9dcbe9c422a1a2df5727bebebf4136760e1ad6dc-1781538485; passport_web_did=7651823325329411260; passport_trace_id=7651823325353757894; QXV0aHpDb250ZXh0=ba539bcfe4a042c8bc1e99d4d03add38; s_v_web_id=verify_mqg251ox_Tp4ofGaR_NCf4_4zII_8Ad3_c3HxGb4PXIuN; session=XN0YXJ0-5b9t9966-1122-4520-890c-e9313b1f818a-WVuZA; session_list=XN0YXJ0-5b9t9966-1122-4520-890c-e9313b1f818a-WVuZA; login_recently=1; is_anonymous_session=; _csrf_token=83aae12269bced10680d3ccf817f82262305e7d0-1781579108; lang=zh; et=c0c63f4480fdf14d7e6e9a21bab2b7e1; ccm_cdn_host=//lf-package-cn.feishucdn.com/obj/feishu-static; locale=zh-CN; landing_url=https://www.feishu.cn/; Hm_lvt_a79616d9322d81f12a92402ac6ae32ea=1781538483,1781579751; Hm_lpvt_a79616d9322d81f12a92402ac6ae32ea=1781579751; HMACCOUNT=5CA5EB76287246C7; _ga_VPYRHN104D=GS2.1.s1781579004$o2$g1$t1781579751$j60$l0$h0; _uetvid=9877555068d111f1992d03b61d301033; _ga=GA1.2.692261332.1781538484; i18n_locale=zh-CN; i18n_locale=zh-CN; _gid=GA1.2.1918132955.1781749497; site_env=pre=0; sl_session=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODE3OTMyNTgsInVuaXQiOiJldV9uYyIsInJhdyI6eyJtZXRhIjoiQVdvYzIrdU1BNHZSYUhkQjl4N2lRQUpxTUx6RjlrN012R293dk1YMlRzeThhakM5WXdRQURMSUNLZ0VBUVVGQlFVRkJRVUZCUVVKeFRVd3hha2h6UkUxNFVUMDkiLCJzdW0iOiI1MWU3ZWM3YzU0NTAzNTljMzRhMjE3ODdlM2U1OGNmZjQzNzZmM2IzYjJjNzU4NWVjMGE3MjQyZDZjNTBiNmNkIiwibG9jIjoiemhfY24iLCJhcGMiOiJSZWxlYXNlIiwiaWF0IjoxNzgxNzUwMDU4LCJzYWMiOnsiVXNlclN0YWZmU3RhdHVzIjoiMSIsIlVzZXJUeXBlIjoiNDIifSwibG9kIjpudWxsLCJjbmYiOnsiamt0Ijoic3VWaTdnNDNJX0lUb0w2ZGo5QXhEWnBacUhkYldzNWJaaVhvV0s4akZrdyJ9LCJucyI6ImxhcmsiLCJuc191aWQiOiI3NjQ2MjI4MDcyMDgxMDk5NzI5IiwibnNfdGlkIjoiNzUyNzU1NzgzMTgwMzk0NDk2MiIsIm90IjoxLCJjdCI6MTc4MTU3OTEwNywicnQiOjE3ODE2Njg4OTMsInRjcyI6MiwidGJ0IjowfX0.6MrIkLX5grSs5PUBr3U-TC5keonxZZDADzbJ0c00y9HsalJhhQ0gbmfk2u2w5RWhMkXt46a50yMc9E7Po6kymg; msToken=Oyg-XUAwfnJlSSSvRBdj1W_LxhRCXLlWMx9mk0Ryxvku6FZLH0ysyeYnmGrIG_yvUClyZT2cLYe5rhC1PtVygRRXOhYTvrDcL8Oidp-ZHHI-LNFKPJk-She-3kUxNTnwb3fYj5FfI36vX-1eFZ_neFVmoTtgD1GhK3M3oNjh5H-Y; swp_csrf_token=6fe8dbf3-4ab2-4f46-b4f3-5c9cba7364cd; t_beda37=a427edf4f48d9fa049a454a58600fa2f188ffacaf053a85e3782d6615e737b03; passport_app_access_token=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODE3OTU2NDcsInVuaXQiOiJldV9uYyIsInJhdyI6eyJtX2FjY2Vzc19pbmZvIjp7IjE0MyI6eyJpYXQiOjE3ODE3NDk1MTksImFjY2VzcyI6dHJ1ZX0sIjIiOnsiaWF0IjoxNzgxNzUyMTY1LCJhY2Nlc3MiOnRydWV9LCIxMDAiOnsiaWF0IjoxNzgxNzUyMjk1LCJhY2Nlc3MiOnRydWV9LCI0Ijp7ImlhdCI6MTc4MTc1MjQ0NywiYWNjZXNzIjp0cnVlfX0sInN1bSI6IjUxZTdlYzdjNTQ1MDM1OWMzNGEyMTc4N2UzZTU4Y2ZmNDM3NmYzYjNiMmM3NTg1ZWMwYTcyNDJkNmM1MGI2Y2QifX0.6o43emSe8iOBsXTPUbx4cShf-DdIpGuTTYDR5NDAAvA6ZByV_biiboF32sk5SjLAuTfEEy1xWpZ_35Fb-nxvJg"
- self.cookie_text.delete(1.0, tk.END)
- self.cookie_text.insert(1.0, default_cookie)
- self.log("已加载默认Cookie", "info")
-
- def save_config(self):
- """保存Cookie配置到文件"""
- cookie = self.cookie_text.get(1.0, tk.END).strip()
- if not cookie:
- messagebox.showwarning("提示", "Cookie不能为空")
- return
- try:
- with open("cookie_config.txt", "w", encoding="utf-8") as f:
- f.write(cookie)
- self.log("Cookie配置已保存", "success")
- messagebox.showinfo("成功", "Cookie配置已保存到 cookie_config.txt")
- except Exception as e:
- self.log(f"保存失败: {str(e)}", "error")
-
- def load_config(self):
- """加载保存的Cookie配置"""
- try:
- with open("cookie_config.txt", "r", encoding="utf-8") as f:
- cookie = f.read().strip()
- if cookie:
- self.cookie_text.delete(1.0, tk.END)
- self.cookie_text.insert(1.0, cookie)
- self.log("已加载保存的Cookie配置", "info")
- except FileNotFoundError:
- pass
- except Exception as e:
- self.log(f"加载配置失败: {str(e)}", "warning")
-
- def log(self, message, tag="info"):
- """添加日志"""
- timestamp = datetime.now().strftime("%H:%M:%S")
- self.log_text.insert(tk.END, f"[{timestamp}] {message}\n", tag)
- self.log_text.see(tk.END)
- self.root.update_idletasks()
-
- def clear_log(self):
- """清空日志"""
- self.log_text.delete(1.0, tk.END)
-
- def parse_cookie(self, cookie_string):
- """解析Cookie字符串为字典"""
- cookies = {}
- for item in cookie_string.split(';'):
- item = item.strip()
- if '=' in item:
- key, value = item.split('=', 1)
- cookies[key.strip()] = value.strip()
- return cookies
-
- def _get_csrf_token(self):
- """从cookie中提取csrf_token"""
- cookie_text = self.cookie_text.get(1.0, tk.END).strip()
- # 匹配 _csrf_token=xxx 或 csrf_token=xxx
- match = re.search(r'_csrf_token=([^;]+)', cookie_text)
- if match:
- return match.group(1)
- # 也尝试匹配 x-csrftoken
- match = re.search(r'x-csrftoken[=:]\s*([^;\s]+)', cookie_text, re.IGNORECASE)
- if match:
- return match.group(1)
- # 返回默认值
- return "83aae12269bced10680d3ccf817f82262305e7d0-1781579108"
-
- def _get_mime_type(self, filename):
- """获取文件MIME类型"""
- ext = os.path.splitext(filename)[1].lower()
- mime_map = {
- '.jpg': 'image/jpeg',
- '.jpeg': 'image/jpeg',
- '.png': 'image/png',
- '.gif': 'image/gif',
- '.bmp': 'image/bmp',
- '.webp': 'image/webp'
- }
- return mime_map.get(ext, 'image/jpeg')
-
- def upload_image(self, image_data, filename="image.jpg"):
- """
- 完整上传图片到飞书,返回file_token信息
- """
- try:
- cookie_string = self.cookie_text.get(1.0, tk.END).strip()
- if not cookie_string:
- self.log(" ❌ Cookie为空,无法上传图片", "error")
- return None
-
- cookies = self.parse_cookie(cookie_string)
- csrf_token = self._get_csrf_token()
-
- self.log(f" 🔍 使用的CSRF token: {csrf_token[:30] if csrf_token else 'None'}...", "debug")
- self.log(f" 🔍 图片大小: {len(image_data)} bytes", "debug")
-
- # 构建通用请求头
- base_headers = {
- "accept": "application/json, text/plain, */*",
- "accept-language": "zh-CN,zh;q=0.9",
- "f-version": "docs-6-17-1781628518399",
- "x-csrftoken": csrf_token,
- "x-tt-logid": "02178275091573600000000000000000000ffff5bd640caae0cb8",
- "x-tt-trace": "1",
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
- }
-
- # ========== 步骤1: 获取uploadCode ==========
- self.log(f" 📤 [1/4] 获取上传code...", "info")
- code_url = "https://xhd.feishu.cn/space/api/bitable/external/share/uploadCode"
- code_params = {
- "shareToken": self.share_token,
- "fileName": filename,
- "size": len(image_data),
- "mountPoint": "bitable_tmp_point"
- }
-
- self.log(f" 📋 请求URL: {code_url}", "debug")
- self.log(f" 📋 请求参数: {json.dumps(code_params, ensure_ascii=False)}", "debug")
-
- code_response = requests.get(code_url, params=code_params, headers=base_headers, cookies=cookies, timeout=30)
-
- self.log(f" 📡 响应状态码: {code_response.status_code}", "debug")
-
- if code_response.status_code != 200:
- self.log(f" ❌ 获取code失败: HTTP {code_response.status_code}", "error")
- self.log(f" ❌ 响应内容: {code_response.text}", "error")
- return None
-
- try:
- code_data = code_response.json()
- except Exception as e:
- self.log(f" ❌ 解析JSON失败: {str(e)}", "error")
- return None
-
- upload_code = code_data.get('data', {}).get('uploadCode')
- if not upload_code:
- self.log(f" ❌ 响应中没有uploadCode字段", "error")
- self.log(f" ❌ data内容: {code_data.get('data', {})}", "error")
- return None
-
- self.log(f" ✅ 获取uploadCode成功: {upload_code[:30]}...", "success")
-
- # ========== 步骤2: 准备上传 ==========
- self.log(f" 📤 [2/4] 准备上传,获取upload_id...", "info")
- prepare_url = "https://xhd.feishu.cn/space/api/box/upload/prepare/authcode/"
- prepare_headers = base_headers.copy()
- prepare_headers["content-type"] = "application/json"
- prepare_headers["x-command"] = "space.api.box.upload.prepare.authcode"
-
- prepare_body = {
- "code": upload_code,
- "mount_point": "bitable_tmp_point",
- "mount_node_token": self.share_token
- }
-
- self.log(f" 📋 请求体: {json.dumps(prepare_body, ensure_ascii=False)}", "debug")
-
- prepare_response = requests.post(prepare_url, headers=prepare_headers, cookies=cookies, json=prepare_body, timeout=30)
-
- self.log(f" 📡 响应状态码: {prepare_response.status_code}", "debug")
-
- if prepare_response.status_code != 200:
- self.log(f" ❌ 准备上传失败: HTTP {prepare_response.status_code}", "error")
- self.log(f" ❌ 响应内容: {prepare_response.text}", "error")
- return None
-
- try:
- prepare_data = prepare_response.json()
- except Exception as e:
- self.log(f" ❌ 解析JSON失败: {str(e)}", "error")
- return None
-
- if prepare_data.get('code') != 0:
- self.log(f" ❌ 准备上传失败: code={prepare_data.get('code')}, msg={prepare_data.get('msg', '未知错误')}", "error")
- return None
-
- upload_id = prepare_data.get('data', {}).get('upload_id')
- if not upload_id:
- self.log(f" ❌ 响应中没有upload_id字段", "error")
- self.log(f" ❌ data内容: {prepare_data.get('data', {})}", "error")
- return None
-
- self.log(f" ✅ 获取upload_id成功: {upload_id}", "success")
-
- self.log(f" 📤 [3/4] 上传文件内容 ({len(image_data)} bytes)...", "info")
- # 使用 Adler-32 计算 checksum(飞书使用的算法)
- import zlib
- checksum = zlib.adler32(image_data) & 0xffffffff
- upload_url = f"https://internal-api-drive-stream.feishu.cn/space/api/box/stream/upload/merge_block/?upload_id={upload_id}"
- upload_headers = base_headers.copy()
- upload_headers["content-type"] = "application/octet-stream"
- upload_headers["x-command"] = "space.api.box.stream.upload.merge_block"
- upload_headers["x-seq-list"] = "0"
- upload_headers["x-block-list-checksum"] = str(checksum) # 注意:是数字字符串,不是十六进制
- upload_headers["x-block-origin-size"] = str(len(image_data))
- self.log(f" 📋 文件大小: {len(image_data)} bytes, checksum(Adler-32): {checksum}", "debug")
-
- upload_response = requests.post(upload_url, headers=upload_headers, cookies=cookies, data=image_data, timeout=60)
-
- self.log(f" 📡 响应状态码: {upload_response.status_code}", "debug")
- self.log(f" 📡 响应内容: {upload_response.text[:500]}", "debug")
-
- if upload_response.status_code != 200:
- self.log(f" ❌ 上传文件失败: HTTP {upload_response.status_code}", "error")
- self.log(f" ❌ 响应内容: {upload_response.text}", "error")
- return None
-
- # 检查上传是否真正成功
- try:
- upload_result = upload_response.json()
- if upload_result.get('code') != 0:
- self.log(f" ❌ 上传文件失败: code={upload_result.get('code')}, msg={upload_result.get('message', '未知错误')}", "error")
- return None
- except:
- pass
-
- self.log(f" ✅ 文件上传成功", "success")
-
- # ========== 步骤4: 完成上传 ==========
- self.log(f" 📤 [4/4] 完成上传,获取file_token...", "info")
- finish_url = "https://xhd.feishu.cn/space/api/box/upload/finish/"
- finish_headers = base_headers.copy()
- finish_headers["content-type"] = "application/json"
- finish_headers["x-command"] = "space.api.box.upload.finish"
-
- finish_body = {
- "upload_id": upload_id,
- "num_blocks": 1,
- "push_open_history_record": 0
- }
-
- self.log(f" 📋 请求体: {json.dumps(finish_body, ensure_ascii=False)}", "debug")
-
- finish_response = requests.post(finish_url, headers=finish_headers, cookies=cookies, json=finish_body, timeout=30)
-
- self.log(f" 📡 响应状态码: {finish_response.status_code}", "debug")
- self.log(f" 📡 响应内容: {finish_response.text[:500]}", "debug")
-
- if finish_response.status_code != 200:
- self.log(f" ❌ 完成上传失败: HTTP {finish_response.status_code}", "error")
- self.log(f" ❌ 响应内容: {finish_response.text}", "error")
- return None
-
- try:
- finish_data = finish_response.json()
- except Exception as e:
- self.log(f" ❌ 解析JSON失败: {str(e)}", "error")
- return None
-
- if finish_data.get('code') != 0:
- self.log(f" ❌ 完成上传失败: code={finish_data.get('code')}, msg={finish_data.get('message', '未知错误')}", "error")
- self.log(f" ❌ 完整响应: {json.dumps(finish_data, ensure_ascii=False, indent=2)}", "error")
- return None
-
- file_token = finish_data.get('data', {}).get('file_token')
- if not file_token:
- self.log(f" ❌ 响应中没有file_token字段", "error")
- self.log(f" ❌ data内容: {finish_data.get('data', {})}", "error")
- return None
-
- # 获取图片信息
- width, height = 0, 0
- try:
- from PIL import Image
- import io
- pil_img = Image.open(io.BytesIO(image_data))
- width, height = pil_img.size
- except:
- pass
-
- result = {
- 'attachmentToken': file_token,
- 'id': file_token,
- 'mimeType': self._get_mime_type(filename),
- 'name': filename,
- 'size': len(image_data),
- 'timeStamp': int(time.time() * 1000),
- 'height': height,
- 'width': width
- }
-
- self.log(f" ✅ 图片上传完成! file_token: {file_token}", "success")
- return result
-
- except requests.exceptions.Timeout:
- self.log(f" ❌ 上传超时", "error")
- return None
- except Exception as e:
- self.log(f" ❌ 上传图片异常: {str(e)}", "error")
- import traceback
- self.log(f" 详细: {traceback.format_exc()}", "debug")
- return None
-
- def extract_images_to_cache(self, file_path, sheet_name):
- """
- 提取Excel中的所有图片到缓存
- 返回: dict {行号: [图片数据列表]}
- """
- image_cache = {}
- try:
- wb = load_workbook(file_path, data_only=True)
- ws = wb[sheet_name]
-
- if hasattr(ws, '_images') and ws._images:
- self.log(f" 📸 开始提取 {len(ws._images)} 张图片到缓存...", "info")
- for idx, img in enumerate(ws._images):
- try:
- # 获取位置信息
- if hasattr(img, 'anchor') and hasattr(img.anchor, '_from'):
- anchor_from = img.anchor._from
- row = anchor_from.row + 1
- col = anchor_from.col + 1
- else:
- row = idx + 1
- col = 0
-
- # 获取图片数据
- image_data = None
- img_format = 'jpg'
- filename = f"image_{row}_{idx}.jpg"
-
- if hasattr(img, '_data') and callable(img._data):
- image_data = img._data()
- elif hasattr(img, '_data') and not callable(img._data):
- image_data = img._data
- elif hasattr(img, 'image'):
- if hasattr(img.image, '_data') and callable(img.image._data):
- image_data = img.image._data()
- elif hasattr(img.image, '_data'):
- image_data = img.image._data
-
- if image_data is None:
- continue
-
- # 检测图片格式
- try:
- from PIL import Image
- import io
- pil_img = Image.open(io.BytesIO(image_data))
- img_format = pil_img.format if pil_img.format else 'jpg'
- filename = f"image_{row}_{idx}.{img_format.lower()}"
- except:
- pass
-
- if row not in image_cache:
- image_cache[row] = []
- image_cache[row].append({
- 'data': image_data,
- 'col': col,
- 'format': img_format,
- 'filename': filename
- })
-
- except Exception as e:
- self.log(f" ⚠️ 提取图片失败: {str(e)}", "warning")
-
- wb.close()
-
- total = sum(len(imgs) for imgs in image_cache.values())
- self.log(f" ✅ 成功提取 {total} 张图片到缓存,分布在 {len(image_cache)} 行", "success")
-
- except Exception as e:
- self.log(f" ❌ 提取图片失败: {str(e)}", "error")
-
- return image_cache
-
- def build_request_body(self, row_dict, row_index):
- """根据Excel行数据构建请求体"""
- try:
- # 获取各列数据
- name = str(row_dict.get("姓名", "")) if pd.notna(row_dict.get("姓名")) else ""
- gender = str(row_dict.get("性别", "")) if pd.notna(row_dict.get("性别")) else ""
- phone = str(row_dict.get("手机号码", "")) if pd.notna(row_dict.get("手机号码")) else ""
- remark = str(row_dict.get("备注", "")) if pd.notna(row_dict.get("备注")) else ""
- institution = str(row_dict.get("机构", "")) if pd.notna(row_dict.get("机构")) else ""
- target_school_text = str(row_dict.get("意向学校", "")) if pd.notna(row_dict.get("意向学校")) else ""
- consulting_text = str(row_dict.get("咨询项目", "")) if pd.notna(row_dict.get("咨询项目")) else ""
- product_text = str(row_dict.get("产品", "")) if pd.notna(row_dict.get("产品")) else ""
- source = str(row_dict.get("线索来源", "")) if pd.notna(row_dict.get("线索来源")) else ""
- market_person = str(row_dict.get("市场人员", "")) if pd.notna(row_dict.get("市场人员")) else ""
- channel_code = str(row_dict.get("渠道代码", "")) if pd.notna(row_dict.get("渠道代码")) else ""
- # 去掉数字的小数点
- phone = phone.split('.')[0]
- self.log(f" 📝 提取数据: 姓名={name}, 手机={phone}, 渠道代码={channel_code}, 意向学校={target_school_text}, 咨询项目={consulting_text}, 产品={product_text}", "debug")
-
- # 意向校区映射字典
- school_mapping = {
- "上海": "optqw2jaJ5",
- "徐汇": "optTD4UQsM",
- "人广": "opt7hQjSZQ",
- "长宁": "opt7A8WBtE",
- "浦东": "optnyoxnTK",
- "杨浦": "optgArj17r",
- "闵行": "optCIwo1J1",
- "松江": "optuZzXsYm",
- "锦秋个人学校": "optLQYDW3S",
- "封闭学院": "optitJpd5G",
- "大学生-市区": "optHlvKsKy",
- "大学生-曹崇杨": "optdcoQXBt",
- "大学生-临港": "opt3i4fOKJ",
- "大学生-松江": "optG7eGFUg",
- "大学生-奉贤": "optJJqnLgY",
- "常州": "opt5wuiYjW"
- }
-
- # 咨询项目映射字典
- consulting_mapping = {
- "语培": "opt96MRele",
- "留学": "optQFQsXIe",
- "考研": "opti3wbRF7",
- "AF艺术": "optaZC2VCL",
- "美行音乐": "optzSqwgLp",
- "锦秋个人学校": "opt9N4AGbJ",
- "研学考团": "optdYBLknN",
- "尚思": "optf8lTDcV"
- }
-
- # 语培产品映射字典(完整版)
- product_mapping = {
- "ACT": "optlGkVm5n",
- "AEAS": "optqX3b1rJ",
- "ALEVEL": "optgMNcV8D",
- "AP": "optWKWYQgo",
- "BC": "opt8huX4Nv",
- "DSE": "optxFBYmUs",
- "ESL": "optaYj9RZM",
- "GMAT": "optgwu03Nf",
- "GRE": "optEOyf5TR",
- "IB": "optBhWIw7x",
- "IGCSE": "optIuoUFpo",
- "KET": "optjcLdrsB",
- "PET": "optY42DNFo",
- "PTE": "optOrHJvTX",
- "SAT": "optTxT8NEu",
- "SSAT": "optJ2a0tkB",
- "Toefl Junior": "optEGInE0d",
- "国际备考": "optgwn1azI",
- "国际研学及考团": "optAmxtqGN",
- "国家地理": "opttXZvoj3",
- "剑桥英语": "optQkkhzD5",
- "锦秋竞赛": "optUgXXmpF",
- "考研": "optgQrGHTS",
- "留学预备": "optWxtOU8b",
- "美高": "opt36E5u0t",
- "硕果": "optNKeSnho",
- "硕果竞赛": "optMzk3TpL",
- "腾飞计划": "optYTD9h04",
- "团企培": "optW5UDF6G",
- "托福": "optKuZ2zCq",
- "雅思": "optWsal1MB",
- "用英语讲中国故事": "optinda27s",
- "在线": "opt2X07PY4",
- "浙大国际本科": "optZFmVTTC",
- "语培待定/未知": "optTNitLA5",
- "大学四级": "optAqYPFmN",
- "大学六级": "optpdfKgdl",
- "菁英树": "optBFhBHFX",
- "其它": "opt698ww1H"
- }
- # ========== 渠道代码映射(从你提供的列表构建) ==========
- channel_mapping = {}
- # 这里从你提供的列表中构建映射
- # 注意:由于你提供的列表非常长,我在这里使用一个简化的构建方式
- # 实际使用中,你可以将下面这段替换为直接从JSON文件读取
-
- # 构建渠道映射(从你提供的列表中提取)
- channel_list = [
- {"id": "optLmJRYaG", "name": "78060017"},
- {"id": "optMGa0026", "name": "常州01070120"},
- {"id": "optLgvJqZ7", "name": "78010006"},
- {"id": "opt17YSXOf", "name": "78060026"},
- {"id": "optqpwKkwU", "name": "11030001"},
- {"id": "optkss2y0D", "name": "11030005"},
- {"id": "optDo1EMFF", "name": "11030007"},
- {"id": "optt88Do20", "name": "11050008"},
- {"id": "optwHPudWZ", "name": "11050010"},
- {"id": "optAEI150b", "name": "11010002"},
- {"id": "optQQnMHIp", "name": "11010016"},
- {"id": "optWs6H2Xp", "name": "11050018"},
- {"id": "optZBKRejf", "name": "11070020"},
- {"id": "opt4TOjMb3", "name": "11010022"},
- {"id": "optRmgEkX8", "name": "11070024"},
- {"id": "optY4p3Owx", "name": "11030026"},
- {"id": "optraQKM8E", "name": "11030028"},
- {"id": "opt6mzweJS", "name": "11030030"},
- {"id": "optl41JGHT", "name": "11090031"},
- {"id": "optbrq8qkL", "name": "11010034"},
- {"id": "optwxtq8FP", "name": "11010037"},
- {"id": "optqZAHaJJ", "name": "11010040"},
- {"id": "opto4kY2lR", "name": "11010042"},
- {"id": "opt2KXjnP1", "name": "94010031"},
- {"id": "opttB06MWK", "name": "32010135"},
- {"id": "optiV3G6yE", "name": "20010045"},
- {"id": "optW56vGxS", "name": "培训妙杀网(考研)"},
- {
- "id": "optDYPrsIR",
- "name": "50070120"
- }, {
- "id": "opt7UiNtsf",
- "name": "38010048"
- }, {
- "id": "opt9qq8sL7",
- "name": "79050024"
- }, {
- "id": "optd10ESsL",
- "name": "98010008"
- }, {
- "id": "optt4SGOm0",
- "name": "32010047"
- }, {
- "id": "optSSf87v6",
- "name": "33040011"
- }, {
- "id": "optrrMaCZA",
- "name": "86050115"
- }, {
- "id": "optjuG5sSz",
- "name": "82010094"
- }, {
- "id": "optcqGyWbq",
- "name": "96010015"
- }, {
- "id": "optLNGv7r6",
- "name": "78060004"
- }, {
- "id": "optsPFaBv4",
- "name": "50010094"
- }, {
- "id": "optC3ju66z",
- "name": "78060007"
- }, {
- "id": "optMqGkAFn",
- "name": "37050109"
- }, {
- "id": "optJF6X0rf",
- "name": "61010175"
- }, {
- "id": "optXlen3Wz",
- "name": "78010005"
- }, {
- "id": "opt182292475",
- "name": "教育宝"
- }, {
- "id": "optuwfOVMX",
- "name": "37010207"
- }, {
- "id": "optG7T87wx",
- "name": "35060002"
- }, {
- "id": "optkeQefk1",
- "name": "79010065"
- }, {
- "id": "optCnpJ1bm",
- "name": "86050147"
- }, {
- "id": "optjsv83Yp",
- "name": "37010140"
- }, {
- "id": "optGoeaPKe",
- "name": "104010008"
- }, {
- "id": "optSnDBaNc",
- "name": "79080155"
- }, {
- "id": "optYDCkcTy",
- "name": "常州05010012"
- }, {
- "id": "optEWdbb9i",
- "name": "66010028"
- }, {
- "id": "opt3GKnqpZ",
- "name": "104010009"
- }, {
- "id": "optdyRHrph",
- "name": "66010029"
- }, {
- "id": "optQYMdKSN",
- "name": "94010028"
- }, {
- "id": "optKqEJ1K4",
- "name": "94010024"
- }, {
- "id": "optmdAP6vN",
- "name": "86030892"
- }, {
- "id": "optSlNFycr",
- "name": "35010016"
- }, {
- "id": "opt3LNpnVp",
- "name": "110010001"
- }, {
- "id": "optrE3WUDe",
- "name": "110010002"
- }, {
- "id": "optjiE0knO",
- "name": "110010003"
- }, {
- "id": "optZxtkjK4",
- "name": "110010004"
- }, {
- "id": "opttWFSgbj",
- "name": "110010005"
- }, {
- "id": "optDZwMaOL",
- "name": "110010006"
- }, {
- "id": "optYMrGHYd",
- "name": "110010007"
- }, {
- "id": "opt9XIP7EA",
- "name": "110010008"
- }, {
- "id": "optkGLTHYo",
- "name": "110010009"
- }, {
- "id": "optf09PlYA",
- "name": "72010233"
- }, {
- "id": "optO3OYC31",
- "name": "52040003"
- }, {
- "id": "optCt8Q6LI",
- "name": "50010183"
- }, {
- "id": "optZ0EnmoV",
- "name": "32010204"
- }, {
- "id": "optcmhO4of",
- "name": "33010006"
- }, {
- "id": "optltWUGkn",
- "name": "66010030"
- }, {
- "id": "optrL6Hlc3",
- "name": "66010031"
- }, {
- "id": "optcaABEu4",
- "name": "112010034"
- }, {
- "id": "opt8Ve0t4u",
- "name": "94010067"
- }, {
- "id": "optw4hAQzm",
- "name": "99010020"
- }, {
- "id": "opteD1QrMn",
- "name": "79080146"
- }, {
- "id": "optfe7sj8g",
- "name": "112010035"
- }, {
- "id": "optkQVZrrf",
- "name": "32010112"
- }, {
- "id": "optcg1MExb",
- "name": "尚师推荐"
- }, {
- "id": "optYhNWIwc",
- "name": "72010084"
- }, {
- "id": "opt4xUCuFY",
- "name": "79050166"
- }, {
- "id": "opt02ZStXE",
- "name": "37010333"
- }, {
- "id": "optymUCmEr",
- "name": "37010334"
- }, {
- "id": "optYV0cij9",
- "name": "124010001"
- }, {
- "id": "optJS276iq",
- "name": "110010059"
- }, {
- "id": "optZdK6CmS",
- "name": "37010335"
- }, {
- "id": "opt1699614650",
- "name": "留学监理网"
- }, {
- "id": "optw48FC3V",
- "name": "88010022"
- }, {
- "id": "optbKcwrJq",
- "name": "37010336"
- }, {
- "id": "opt3xtKDt5",
- "name": "86050152"
- }, {
- "id": "optQYd0KK5",
- "name": "86010889"
- }, {
- "id": "opt0rOraD7",
- "name": "86030137"
- }, {
- "id": "optHuGR4Eq",
- "name": "86030139"
- }, {
- "id": "optrM7Wdsr",
- "name": "86030138"
- }, {
- "id": "optU5i7ype",
- "name": "80010102"
- }, {
- "id": "opt0Lmg4Uo",
- "name": "53040001"
- }, {
- "id": "opt7vuWnmi",
- "name": "20010025"
- }, {
- "id": "optqVcTHb0",
- "name": "52050024"
- }, {
- "id": "opt7iSnls3",
- "name": "94010052"
- }, {
- "id": "optZALHOHF",
- "name": "37010101"
- }, {
- "id": "optzm19SkW",
- "name": "20010096"
- }, {
- "id": "opt1u3ntO6",
- "name": "94010073"
- }, {
- "id": "optvjrwpjv",
- "name": "20010032"
- }, {
- "id": "opt9z28X3s",
- "name": "37010133"
- }, {
- "id": "optEJ62vts",
- "name": "常州01010082"
- }, {
- "id": "optcD7Vnwl",
- "name": "20010047"
- }, {
- "id": "optah8WxeW",
- "name": "79040167"
- }, {
- "id": "opt5z8vt00",
- "name": "79040168"
- }, {
- "id": "opt308501188",
- "name": "培训指南网"
- }, {
- "id": "opt0DUCf4K",
- "name": "50010067"
- }, {
- "id": "optlcdAcS2",
- "name": "86080162"
- }, {
- "id": "optbvM7HzX",
- "name": "44040024"
- }, {
- "id": "optWZ205SY",
- "name": "78050002"
- }, {
- "id": "optlcDf2Hc",
- "name": "37010337"
- }, {
- "id": "optmJ0m6p9",
- "name": "123010003"
- }, {
- "id": "optF6UqoCY",
- "name": "86050093"
- }, {
- "id": "opt5yXEZf7",
- "name": "20010061"
- }, {
- "id": "optlxhoaiQ",
- "name": "86050135"
- }, {
- "id": "optUTSnRGk",
- "name": "20010132"
- }, {
- "id": "optVIhx9gK",
- "name": "79040169"
- }, {
- "id": "optoV4dCts",
- "name": "37010338"
- }, {
- "id": "optMHxE3Mr",
- "name": "110010060"
- }, {
- "id": "optHU0qhvx",
- "name": "20010133"
- }, {
- "id": "opt182474874",
- "name": "新课网"
- }, {
- "id": "optiz07nV8",
- "name": "94010060"
- }, {
- "id": "optMBkkEKU",
- "name": "20010134"
- }, {
- "id": "optMAqZC9c",
- "name": "80010014"
- }, {
- "id": "optGsAe8s1",
- "name": "86010014"
- }, {
- "id": "optR9gLsLL",
- "name": "55080016"
- }, {
- "id": "optB8JH1pO",
- "name": "55010014"
- }, {
- "id": "optwAKXYyb",
- "name": "50010161"
- }, {
- "id": "optI3wk2T8",
- "name": "92040056"
- }, {
- "id": "optPDv70jT",
- "name": "41080138"
- }, {
- "id": "opti5cmCMl",
- "name": "20010043"
- }, {
- "id": "optyTY79vN",
- "name": "94010046"
- }, {
- "id": "optogH6eoo",
- "name": "86050142"
- }, {
- "id": "optfBIbvgZ",
- "name": "常州01080083"
- }, {
- "id": "optThymT3v",
- "name": "常州01080084"
- }, {
- "id": "optEiKu5vl",
- "name": "常州04080013"
- }, {
- "id": "optDVH5ZSL",
- "name": "50010130"
- }, {
- "id": "optv3kaEy7",
- "name": "86030894"
- }, {
- "id": "optXbsT2GR",
- "name": "88010075"
- }, {
- "id": "optxEeogL7",
- "name": "20060003"
- }, {
- "id": "opteUZSd9Q",
- "name": "52060025"
- }, {
- "id": "optlrtZMKE",
- "name": "锦秋渠道007"
- }, {
- "id": "optC77JIHO",
- "name": "82010042"
- }, {
- "id": "opt3Hno3BZ",
- "name": "94010074"
- }, {
- "id": "optGR0AA2t",
- "name": "125040001"
- }, {
- "id": "optR0jwzXW",
- "name": "125040002"
- }, {
- "id": "optY7rA2oW",
- "name": "94010075"
- }, {
- "id": "optFkKWOm7",
- "name": "94010023"
- }, {
- "id": "optJgSKTMQ",
- "name": "94010036"
- }, {
- "id": "optcvsTbWf",
- "name": "50010019"
- }, {
- "id": "optDmg5e7Z",
- "name": "37010275"
- }, {
- "id": "optUX4n6mt",
- "name": "37010122"
- }, {
- "id": "optKHcZD5h",
- "name": "112060001"
- }, {
- "id": "optRzRGkxn",
- "name": "37010339"
- }, {
- "id": "optVlHoneP",
- "name": "37010340"
- }, {
- "id": "optgfud6Fe",
- "name": "110010061"
- }, {
- "id": "optd3Gl5kE",
- "name": "66030032"
- }, {
- "id": "optvV9hBoB",
- "name": "66030033"
- }, {
- "id": "opt8tWm6QB",
- "name": "37010341"
- }, {
- "id": "optiUt6F10",
- "name": "50010023"
- }, {
- "id": "optHVSJ53X",
- "name": "86050111"
- }, {
- "id": "optpxj67eR",
- "name": "86050141"
- }, {
- "id": "optv6vw4lz",
- "name": "79040170"
- }, {
- "id": "optfiMFOIP",
- "name": "锦秋渠道008"
- }, {
- "id": "opt089LdIK",
- "name": "20010135"
- }, {
- "id": "optUBfgEU4",
- "name": "124070002"
- }, {
- "id": "opt8yNu6Fj",
- "name": "110010062"
- }, {
- "id": "optKLwVO1T",
- "name": "37010342"
- }, {
- "id": "optwcQENOQ",
- "name": "86080880"
- }, {
- "id": "optesP729q",
- "name": "37010343"
- }, {
- "id": "optFPdhA9n",
- "name": "常州05080041"
- }, {
- "id": "opt9W0M5NY",
- "name": "123010004"
- }, {
- "id": "optWTqU9iD",
- "name": "86050149"
- }, {
- "id": "optsfLM8Mu",
- "name": "寻校网"
- }, {
- "id": "opteerBBEX",
- "name": "50010012"
- }, {
- "id": "optpcOIOZ0",
- "name": "20010136"
- }, {
- "id": "opttqkd7bz",
- "name": "50010004"
- }, {
- "id": "optktsRRSU",
- "name": "79010042"
- }, {
- "id": "opteGj35SA",
- "name": "37010344"
- }, {
- "id": "optGckQgsv",
- "name": "86030140"
- }, {
- "id": "optXQTSDzA",
- "name": "72080176"
- }, {
- "id": "opt8Z3Bpw9",
- "name": "79010061"
- }, {
- "id": "optT0xWriP",
- "name": "52010026"
- }, {
- "id": "opt458007492",
- "name": "常州01080114"
- }, {
- "id": "opt62WW7jz",
- "name": "86030141"
- }, {
- "id": "optjNSCfjl",
- "name": "54010013"
- }, {
- "id": "optvK9TAe9",
- "name": "52010027"
- }, {
- "id": "optdW6sJPo",
- "name": "86050101"
- }, {
- "id": "optQVDcB2B",
- "name": "32010062"
- }, {
- "id": "optxf9O9Xt",
- "name": "20010087"
- }, {
- "id": "optxQA1lXh",
- "name": "37010195"
- }, {
- "id": "optRp86IVz",
- "name": "32010071"
- }, {
- "id": "opts108I1t",
- "name": "37010232"
- }, {
- "id": "opt8Jcy8iO",
- "name": "301010011"
- }, {
- "id": "optnuCtAkh",
- "name": "20010073"
- }, {
- "id": "optQicp1vd",
- "name": "37010123"
- }, {
- "id": "optxvYXuoQ",
- "name": "86030142"
- }, {
- "id": "optKpK2Y3l",
- "name": "124070003"
- }, {
- "id": "opt9SMhGCV",
- "name": "80080027"
- }, {
- "id": "opt0QMLyW0",
- "name": "52010028"
- }, {
- "id": "optuqSm1K8",
- "name": "78060011"
- }, {
- "id": "optN5leUyl",
- "name": "37010127"
- }, {
- "id": "optfMNN6YX",
- "name": "27010027"
- }, {
- "id": "optnLmC0dm",
- "name": "32010029"
- }, {
- "id": "optWW7T4Lj",
- "name": "37010345"
- }, {
- "id": "optXTeaCBw",
- "name": "50010013"
- }, {
- "id": "opt0BWDUXE",
- "name": "126010001"
- }, {
- "id": "optCByVwts",
- "name": "37010346"
- }, {
- "id": "optrThaJAH",
- "name": "常州06080007"
- }, {
- "id": "optuQQ4d4Q",
- "name": "38010001"
- }, {
- "id": "optIFyg444",
- "name": "86050136"
- }, {
- "id": "optKlKEI8S",
- "name": "72010202"
- }, {
- "id": "optIEaT8A5",
- "name": "110010063"
- }, {
- "id": "optOQcMTdR",
- "name": "37070347"
- }, {
- "id": "optfJwaRGt",
- "name": "37010348"
- }, {
- "id": "optVnsUM9g",
- "name": "20010076"
- }, {
- "id": "optDHalZA4",
- "name": "37010349"
- }, {
- "id": "optzcA91rk",
- "name": "126010002"
- }, {
- "id": "optrHuogIc",
- "name": "35010019"
- }, {
- "id": "optmpWcfzo",
- "name": "52010029"
- }, {
- "id": "optNHer42k",
- "name": "66030034"
- }, {
- "id": "optdlQmLEE",
- "name": "123010005"
- }, {
- "id": "optLN6TSRZ",
- "name": "35010017"
- }, {
- "id": "optYEMCc09",
- "name": "72010209"
- }, {
- "id": "optnkpWAf3",
- "name": "20010137"
- }, {
- "id": "optFRCDOHR",
- "name": "常州01030120"
- }, {
- "id": "optX0SSHyw",
- "name": "86030143"
- }, {
- "id": "optNRiIs1j",
- "name": "37010350"
- }, {
- "id": "optUjDbY9K",
- "name": "86010144"
- }, {
- "id": "optn8ich2d",
- "name": "61010040"
- }, {
- "id": "opteQQtW52",
- "name": "90040019"
- }, {
- "id": "optszm7N4q",
- "name": "37010351"
- }, {
- "id": "optGwledsv",
- "name": "66030035"
- }, {
- "id": "optPt0pW5u",
- "name": "61010056"
- }, {
- "id": "optWOaupUR",
- "name": "112050032"
- }, {
- "id": "optoRVfHD4",
- "name": "82010028"
- }, {
- "id": "optGDv0zTP",
- "name": "72010115"
- }, {
- "id": "optB2UQdFn",
- "name": "94030076"
- }, {
- "id": "optee3XkkT",
- "name": "110010064"
- }, {
- "id": "optSUGKlXg",
- "name": "79070170"
- }, {
- "id": "optapPGTOu",
- "name": "31070006"
- }, {
- "id": "opt7MWXbnf",
- "name": "50010033"
- }, {
- "id": "optjSMtWuo",
- "name": "66010036"
- }, {
- "id": "opt7Qjokwx",
- "name": "86010145"
- }, {
- "id": "optRC8nz4A",
- "name": "55010018"
- }, {
- "id": "optJcB9duc",
- "name": "61010074"
- }, {
- "id": "optBjhkFAj",
- "name": "20010138"
- }, {
- "id": "optKjLgzMc",
- "name": "110010031"
- }, {
- "id": "opt3hoJVyW",
- "name": "72010234"
- }, {
- "id": "optRUBPj40",
- "name": "79010171"
- }, {
- "id": "optoi9RDqC",
- "name": "常州04080014"
- }, {
- "id": "optXt9SR3v",
- "name": "94010070"
- }, {
- "id": "optvAKytjF",
- "name": "37010352"
- }, {
- "id": "optFYaMWwC",
- "name": "10070010"
- }, {
- "id": "optoWES6nx",
- "name": "86030877"
- }, {
- "id": "optJefog2D",
- "name": "52040004"
- }, {
- "id": "optQomOxGm",
- "name": "99010001"
- }, {
- "id": "optsEb9Z7a",
- "name": "110010065"
- }, {
- "id": "opt73FJKEl",
- "name": "79010119"
- }, {
- "id": "optJO64N1I",
- "name": "84010003"
- }, {
- "id": "optJpt3BrS",
- "name": "84010004"
- }, {
- "id": "opty6yJV2y",
- "name": "84010005"
- }, {
- "id": "opt8rfqzHJ",
- "name": "84060001"
- }, {
- "id": "optXHRejgx",
- "name": "84010006"
- }, {
- "id": "optZENW4Ec",
- "name": "84010007"
- }, {
- "id": "optHZARh3T",
- "name": "55010019"
- }, {
- "id": "opt3YNAoO4",
- "name": "80010113"
- }, {
- "id": "optboi4jG4",
- "name": "110010066"
- }, {
- "id": "optsxwb9uV",
- "name": "79080151"
- }, {
- "id": "optRub6nSG",
- "name": "84010008"
- }, {
- "id": "opty3GXSYy",
- "name": "84010009"
- }, {
- "id": "optBKEfzsr",
- "name": "37010105"
- }, {
- "id": "optI3K0fKv",
- "name": "95010010"
- }, {
- "id": "optmvgoCDv",
- "name": "84010010"
- }, {
- "id": "optuCccgTp",
- "name": "33010001"
- }, {
- "id": "optSyDHvNn",
- "name": "110010067"
- }, {
- "id": "opt9QMlB8B",
- "name": "61010119"
- }, {
- "id": "optwiSBzio",
- "name": "79080154"
- }, {
- "id": "optbUq8Kug",
- "name": "84010011"
- }, {
- "id": "opt308mW6a",
- "name": "110010068"
- }, {
- "id": "optBV8u5OH",
- "name": "84010012"
- }, {
- "id": "optrPNPdM9",
- "name": "112030033"
- }, {
- "id": "optCYZ0bpF",
- "name": "84010013"
- }, {
- "id": "optSKUvXl4",
- "name": "84010014"
- }, {
- "id": "optnL2tWtV",
- "name": "112030034"
- }, {
- "id": "opt20Q9lJh",
- "name": "69010007"
- }, {
- "id": "optI5zBEGH",
- "name": "37010170"
- }, {
- "id": "optC6dJSPa",
- "name": "98010016"
- }, {
- "id": "optxYvmGs4",
- "name": "84010015"
- }, {
- "id": "optVnt8lnt",
- "name": "84010016"
- }, {
- "id": "optfQqC69k",
- "name": "80010114"
- }, {
- "id": "optHFKLlEB",
- "name": "84010017"
- }, {
- "id": "optdenCz0O",
- "name": "37010353"
- }, {
- "id": "optG4CHv5t",
- "name": "66010037"
- }, {
- "id": "optP62go89",
- "name": "110010069"
- }, {
- "id": "optint7rru",
- "name": "112030035"
- }, {
- "id": "optV6yV0Ha",
- "name": "66010038"
- }, {
- "id": "optffH2X63",
- "name": "94010063"
- }, {
- "id": "optJCrOefS",
- "name": "84010018"
- }, {
- "id": "optgqwsm07",
- "name": "37010354"
- }, {
- "id": "opt4dzcFQy",
- "name": "37010355"
- }, {
- "id": "optqR3Hebh",
- "name": "78050028"
- }, {
- "id": "optsRj7Vrx",
- "name": "38010021"
- }, {
- "id": "optkDY08Xw",
- "name": "37010356"
- }, {
- "id": "optba8eFOW",
- "name": "76010016"
- }, {
- "id": "optougf2x4",
- "name": "37010357"
- }, {
- "id": "optpPJeWS4",
- "name": "84010019"
- }, {
- "id": "optfIeW2JZ",
- "name": "常州01070121"
- }, {
- "id": "optuKNP6d6",
- "name": "常州01030122"
- }, {
- "id": "optq52TspK",
- "name": "20030001"
- }, {
- "id": "optdTUXkoy",
- "name": "86010146"
- }, {
- "id": "optpI0m4dL",
- "name": "37010358"
- }, {
- "id": "opteY5O2r7",
- "name": "86050131"
- }, {
- "id": "opt3LYmZRB",
- "name": "89010017"
- }, {
- "id": "opt1XjtNIx",
- "name": "84010020"
- }, {
- "id": "optMVE41er",
- "name": "84010021"
- }, {
- "id": "optosmRU04",
- "name": "52010030"
- }, {
- "id": "optrUBqwRr",
- "name": "37010359"
- }, {
- "id": "optl3IyGo0",
- "name": "84010022"
- }, {
- "id": "opt5hrbEwN",
- "name": "52010031"
- }, {
- "id": "optT3NxVKR",
- "name": "37010215"
- }, {
- "id": "optmrFmrf8",
- "name": "84010023"
- }, {
- "id": "optyF4Wwrk",
- "name": "79070072"
- }, {
- "id": "optgZXt7Ho",
- "name": "127010001"
- }, {
- "id": "opt3S3maUI",
- "name": "20010139"
- }, {
- "id": "opttOwoaJ5",
- "name": "123010006"
- }, {
- "id": "opt5vgLSiI",
- "name": "127010002"
- }, {
- "id": "optH5BTcVw",
- "name": "103010003"
- }, {
- "id": "optSFxQ6aj",
- "name": "常州01030123"
- }, {
- "id": "optEatGesh",
- "name": "72010235"
- }, {
- "id": "optn5k61l4",
- "name": "37010360"
- }, {
- "id": "optebaGnU5",
- "name": "常州01050124"
- }, {
- "id": "optKDtHm70",
- "name": "37010186"
- }, {
- "id": "optUDhDzFr",
- "name": "126080002"
- }, {
- "id": "optRkUm4RH",
- "name": "32010178"
- }, {
- "id": "optzhgpIDI",
- "name": "126080003"
- }, {
- "id": "optxoU3C22",
- "name": "94010077"
- }, {
- "id": "opt22nJfpw",
- "name": "80010115"
- }, {
- "id": "optTZRFzyU",
- "name": "80010100"
- }, {
- "id": "optb6l4EtN",
- "name": "82010078"
- }, {
- "id": "opt1id2YpW",
- "name": "37010361"
- }, {
- "id": "optXZdeaR2",
- "name": "常州01050125"
- }, {
- "id": "optgW4IMtn",
- "name": "128010001"
- }, {
- "id": "optmPcKQYa",
- "name": "常州01030126"
- }, {
- "id": "optlYZT4ux",
- "name": "50010068"
- }, {
- "id": "optJjDIEbu",
- "name": "86050114"
- }, {
- "id": "optmHq6cmu",
- "name": "122010003"
- }, {
- "id": "opt4hbNqTC",
- "name": "84010024"
- }, {
- "id": "optmqDgpbU",
- "name": "127010003"
- }, {
- "id": "opt9ZjT2QA",
- "name": "37010362"
- }, {
- "id": "optRUPph7q",
- "name": "37010363"
- }, {
- "id": "opt2XpRj93",
- "name": "66010039"
- }, {
- "id": "optuqoQXOd",
- "name": "84010025"
- }, {
- "id": "opti49hWLq",
- "name": "84010026"
- }, {
- "id": "optjojtoPp",
- "name": "55010020"
- }, {
- "id": "optDOQoVyv",
- "name": "112010036"
- }, {
- "id": "optsgFcpJ1",
- "name": "常州01010127"
- }, {
- "id": "opt0K3Pnic",
- "name": "常州01070128"
- }, {
- "id": "optH3vLNeR",
- "name": "72010142"
- }, {
- "id": "optWs8J54I",
- "name": "110070070"
- }, {
- "id": "optCUviEyZ",
- "name": "89010019"
- }, {
- "id": "opt9YBDR3B",
- "name": "110010071"
- }, {
- "id": "optmaWqlni",
- "name": "84010027"
- }, {
- "id": "opt8W2hPKo",
- "name": "37050364"
- }, {
- "id": "optfdPZPvt",
- "name": "38010041"
- }, {
- "id": "optoNxXwGB",
- "name": "94010078"
- }, {
- "id": "opt2dRMdCH",
- "name": "84010028"
- }, {
- "id": "optkvoa6oe",
- "name": "常州01080129"
- }, {
- "id": "optdVBK32x",
- "name": "110050072"
- }, {
- "id": "optELWn9lC",
- "name": "79080148"
- }, {
- "id": "opt1285720668",
- "name": "学雅思网"
- }, {
- "id": "optXK5GQCw",
- "name": "79010173"
- }, {
- "id": "optuhjNTP4",
- "name": "常州01080085"
- }, {
- "id": "optPcdusJK",
- "name": "常州01080130"
- }, {
- "id": "optCnXfQoO",
- "name": "29010004"
- }, {
- "id": "optIAF7uop",
- "name": "86010147"
- }, {
- "id": "optbxT8a22",
- "name": "86010148"
- }, {
- "id": "optBKEZGxV",
- "name": "常州02080042"
- }, {
- "id": "opt82CopOX",
- "name": "37010365"
- }, {
- "id": "optjllXBCm",
- "name": "66010040"
- }, {
- "id": "optboLfbo5",
- "name": "66010041"
- }, {
- "id": "optMD9OIyF",
- "name": "129010001"
- }, {
- "id": "optPmonvMt",
- "name": "常州04080025"
- }, {
- "id": "opts3XkkLt",
- "name": "127010004"
- }, {
- "id": "optVpK1iNu",
- "name": "84010029"
- }, {
- "id": "optEfAYNP0",
- "name": "61010176"
- }, {
- "id": "optsfgK3aQ",
- "name": "66010042"
- }, {
- "id": "optYQ1WHWx",
- "name": "常州01070130"
- }, {
- "id": "optXzdrBPT",
- "name": "常州01070131"
- }, {
- "id": "optk3ZYoUA",
- "name": "19070001"
- }, {
- "id": "optCTJ7KeT",
- "name": "84010030"
- }, {
- "id": "optPaOv5un",
- "name": "84010031"
- }, {
- "id": "optQIoTwZy",
- "name": "130010001"
- }, {
- "id": "optep1w6TG",
- "name": "130010002"
- }, {
- "id": "optaZ6MVjA",
- "name": "130010003"
- }, {
- "id": "optUsgsf5p",
- "name": "79010174"
- }, {
- "id": "optUlrZtGb",
- "name": "110010073"
- }, {
- "id": "optMDlLA6P",
- "name": "常州01080132"
- }, {
- "id": "optJrjrkry",
- "name": "130010004"
- }, {
- "id": "optdYAT6GL",
- "name": "130010005"
- }, {
- "id": "optsdei4oR",
- "name": "131010001"
- }, {
- "id": "optORnPM6O",
- "name": "130010006"
- }, {
- "id": "optq4v5Vqn",
- "name": "126010004"
- }, {
- "id": "optkB4FhvX",
- "name": "130010007"
- }, {
- "id": "optkIbsg6R",
- "name": "37010366"
- }, {
- "id": "optSuK825p",
- "name": "84010032"
- }, {
- "id": "opt1wnnwlF",
- "name": "55040021"
- }, {
- "id": "optGZCwiK3",
- "name": "52010032"
- }, {
- "id": "optOZwIB1K",
- "name": "66010043"
- }, {
- "id": "opto4d05oc",
- "name": "37010367"
- }, {
- "id": "optpdDP96y",
- "name": "99010024"
- }, {
- "id": "opt9Bhbsze",
- "name": "37010368"
- }, {
- "id": "opttelQRFt",
- "name": "132010001"
- }, {
- "id": "optavXqB8G",
- "name": "50010101"
- }, {
- "id": "opthXax1KY",
- "name": "130010008"
- }, {
- "id": "optH0bkpS1",
- "name": "86050129"
- }, {
- "id": "optgnJiyHa",
- "name": "129010002"
- }, {
- "id": "optlcoiTuM",
- "name": "86010149"
- }, {
- "id": "optBWgQy7M",
- "name": "130010009"
- }, {
- "id": "optOUHu7rd",
- "name": "72030236"
- }, {
- "id": "optVr305S2",
- "name": "126010005"
- }, {
- "id": "opt2n4s9dX",
- "name": "94010079"
- }, {
- "id": "optLqf2TWH",
- "name": "94010080"
- }, {
- "id": "optKnVnmyt",
- "name": "94010081"
- }, {
- "id": "optTyHEoNP",
- "name": "37070369"
- }, {
- "id": "optW91zT4z",
- "name": "127010005"
- }, {
- "id": "optV15qsK0",
- "name": "126010006"
- }, {
- "id": "optKpqB4hi",
- "name": "37010159"
- }, {
- "id": "optg1bGZIs",
- "name": "86050128"
- }, {
- "id": "optGsBbMZG",
- "name": "常州01080133"
- }, {
- "id": "optYZwxK1b",
- "name": "110010074"
- }, {
- "id": "optQyqBz0i",
- "name": "20010140"
- }, {
- "id": "optqtd5NCa",
- "name": "94010082"
- }, {
- "id": "optffGYFG2",
- "name": "133010001"
- }, {
- "id": "opt0Tgt7Vy",
- "name": "133010002"
- }, {
- "id": "optXSg8z14",
- "name": "20010105"
- }, {
- "id": "opt6XYvNuF",
- "name": "80010074"
- }, {
- "id": "optRlP4Ygy",
- "name": "66010044"
- }, {
- "id": "optJQWgP35",
- "name": "常州05050046"
- }, {
- "id": "opt5ZI2l9u",
- "name": "常州05050047"
- }, {
- "id": "optACnWPjC",
- "name": "84010033"
- }, {
- "id": "optP5XY3yR",
- "name": "66010045"
- }, {
- "id": "optKQ2AiD7",
- "name": "66010046"
- }, {
- "id": "optt2IU4IP",
- "name": "20010106"
- }, {
- "id": "optlbK4aOk",
- "name": "86010150"
- }, {
- "id": "optAyWhYo1",
- "name": "94010083"
- }, {
- "id": "optHfJWDS7",
- "name": "79060175"
- }, {
- "id": "opt4o9mC1i",
- "name": "79010176"
- }, {
- "id": "optGZcAxal",
- "name": "130010012"
- }, {
- "id": "optWp1ehwC",
- "name": "130010011"
- }, {
- "id": "opt6vVwtkO",
- "name": "86050132"
- }, {
- "id": "optXrs72iR",
- "name": "37010369"
- }, {
- "id": "optQDvY7Zn",
- "name": "66010047"
- }, {
- "id": "optuDK6bvg",
- "name": "80010106"
- }, {
- "id": "optMniKJ69",
- "name": "55010022"
- }, {
- "id": "optxVLaUJz",
- "name": "79010177"
- }, {
- "id": "optG9lQsZg",
- "name": "66010048"
- }, {
- "id": "optpX4CaKz",
- "name": "20010141"
- }, {
- "id": "optahTxDHk",
- "name": "94010084"
- }, {
- "id": "optGOOAOpp",
- "name": "130010013"
- }, {
- "id": "optOUcfe7r",
- "name": "常州01070134"
- }, {
- "id": "opt9sMySxb",
- "name": "134010001"
- }, {
- "id": "optCEzD46z",
- "name": "130010014"
- }, {
- "id": "optGXsobSm",
- "name": "98010017"
- }, {
- "id": "optc3kqlcl",
- "name": "常州01030135"
- }, {
- "id": "optND1VqXc",
- "name": "常州01070136"
- }, {
- "id": "optm4yeL8O",
- "name": "86010151"
- }, {
- "id": "opt1ihJvJ3",
- "name": "134010002"
- }, {
- "id": "optkX0Zxc9",
- "name": "126010007"
- }, {
- "id": "optvfe9Vs9",
- "name": "37070370"
- }, {
- "id": "optKyA8VXy",
- "name": "94010085"
- }, {
- "id": "optsiGdh4M",
- "name": "79060178"
- }, {
- "id": "optyKP5BJX",
- "name": "122010004"
- }, {
- "id": "optFt7busK",
- "name": "54010016"
- }, {
- "id": "optQNiwQbN",
- "name": "66010049"
- }, {
- "id": "optU81DGKw",
- "name": "130010015"
- }, {
- "id": "optl9tUOSa",
- "name": "50010184"
- }, {
- "id": "optV1cZKCo",
- "name": "20010142"
- }, {
- "id": "optargXKeE",
- "name": "126010008"
- }, {
- "id": "optXyTchWs",
- "name": "86050098"
- }, {
- "id": "optdtlwS3G",
- "name": "20010109"
- }, {
- "id": "optClTpepv",
- "name": "86010152"
- }, {
- "id": "opt7skfX3x",
- "name": "37010371"
- }, {
- "id": "optchsnoHO",
- "name": "135010001"
- }, {
- "id": "optG4ZGeQO",
- "name": "66010050"
- }, {
- "id": "optk5gO5Bu",
- "name": "126060009"
- }, {
- "id": "opt5A4LJC6",
- "name": "86010153"
- }, {
- "id": "opt2DtQ5Uu",
- "name": "126060010"
- }, {
- "id": "optiD2yqel",
- "name": "136010001"
- }, {
- "id": "opt4ThV68K",
- "name": "79010139"
- }, {
- "id": "optr7DOvIa",
- "name": "72010237"
- }, {
- "id": "optzEHE4ss",
- "name": "86010887"
- }, {
- "id": "opt09lT40O",
- "name": "82010033"
- }, {
- "id": "optSnI23AU",
- "name": "55080009"
- }, {
- "id": "optzoSyi6P",
- "name": "127070006"
- }, {
- "id": "optv0Pskp2",
- "name": "52070033"
- }, {
- "id": "optZCokTmO",
- "name": "37010245"
- }, {
- "id": "optS6wmy3z",
- "name": "126060011"
- }, {
- "id": "optry11hW2",
- "name": "20010090"
- }, {
- "id": "opt0lBZu0R",
- "name": "20010143"
- }, {
- "id": "optGa3t8Rg",
- "name": "130010016"
- }, {
- "id": "optrfHBPTA",
- "name": "86050156"
- }, {
- "id": "optWNN7MRl",
- "name": "20080144"
- }, {
- "id": "optTkRZuwk",
- "name": "112070037"
- }, {
- "id": "optSbvaRtj",
- "name": "52070034"
- }, {
- "id": "optTjkdojW",
- "name": "61010101"
- }, {
- "id": "opt6rvLdYK",
- "name": "72010017"
- }, {
- "id": "optmI0puuz",
- "name": "84010034"
- }, {
- "id": "optQUVxUen",
- "name": "79060179"
- }, {
- "id": "optSNmpZh8",
- "name": "110010075"
- }, {
- "id": "optl8PJbbs",
- "name": "常州05070048"
- }, {
- "id": "opt2eqsCgi",
- "name": "137080013"
- }, {
- "id": "optqokB94d",
- "name": "37010153"
- }, {
- "id": "opttOuI6jm",
- "name": "110010076"
- }, {
- "id": "optxnkFn15",
- "name": "79060180"
- }, {
- "id": "optYTbVT0Z",
- "name": "20010144"
- }, {
- "id": "opt9abQItt",
- "name": "20010145"
- }, {
- "id": "optZ7G8URR",
- "name": "86010154"
- }, {
- "id": "optAc4pOGX",
- "name": "134010003"
- }, {
- "id": "opt7DMmcKv",
- "name": "126060012"
- }, {
- "id": "optvwlaGOc",
- "name": "110010077"
- }, {
- "id": "optfm7ae1r",
- "name": "66010052"
- }, {
- "id": "optKmYdu87",
- "name": "66010051"
- }, {
- "id": "opt0k6XfsT",
- "name": "37010178"
- }, {
- "id": "opttFBKjqo",
- "name": "138010001"
- }, {
- "id": "optC0S5yry",
- "name": "139010001"
- }, {
- "id": "opt8NIUnuR",
- "name": "37010372"
- }, {
- "id": "optCkoRFPf",
- "name": "80010116"
- }, {
- "id": "optXtsyxWY",
- "name": "110010078"
- }, {
- "id": "optrcnkNBV",
- "name": "37010373"
- }, {
- "id": "optP4Dy2IB",
- "name": "常州01010137"
- }, {
- "id": "optDlXSCHN",
- "name": "127080007"
- }, {
- "id": "optp5CcFO6",
- "name": "86010155"
- }, {
- "id": "opto8abzlx",
- "name": "20030146"
- }, {
- "id": "optmSVjeAj",
- "name": "37070374"
- }, {
- "id": "opt5ibhzde",
- "name": "110010079"
- }, {
- "id": "optscJyzAl",
- "name": "126040013"
- }, {
- "id": "optOEw3hjp",
- "name": "140010001"
- }, {
- "id": "opt1hGVA4y",
- "name": "140010002"
- }, {
- "id": "optpsm7QIF",
- "name": "124070004"
- }, {
- "id": "optT9raf3g",
- "name": "127080008"
- }, {
- "id": "optQ0o8w55",
- "name": "126080014"
- }, {
- "id": "optcufNrXU",
- "name": "79070181"
- }, {
- "id": "optxfxqQii",
- "name": "140010003"
- }, {
- "id": "optzOt8NSq",
- "name": "常州04080026"
- }, {
- "id": "optMkYwJof",
- "name": "79070182"
- }, {
- "id": "optHGLH9ba",
- "name": "140010004"
- }, {
- "id": "optFNGcVDp",
- "name": "130010017"
- }, {
- "id": "optTA4j7b2",
- "name": "84010035"
- }, {
- "id": "opt5jhUPQS",
- "name": "12030008"
- }, {
- "id": "optJqQuwYl",
- "name": "141010002"
- }, {
- "id": "optMfYIrDK",
- "name": "141010001"
- }, {
- "id": "opth7YgiVA",
- "name": "127010009"
- }, {
- "id": "optvKH357u",
- "name": "141010003"
- }, {
- "id": "optMwyEG58",
- "name": "20010147"
- }, {
- "id": "optMko4Gwo",
- "name": "37010005"
- }, {
- "id": "optCBZfyhn",
- "name": "20010148"
- }, {
- "id": "optz6gxJRp",
- "name": "126070015"
- }, {
- "id": "optlgraFmJ",
- "name": "139010004"
- }, {
- "id": "opt3YhS6iM",
- "name": "139010003"
- }, {
- "id": "opt8E1r32N",
- "name": "139010002"
- }, {
- "id": "optrXGWBzH",
- "name": "126070016"
- }, {
- "id": "opt5yG3TXd",
- "name": "20010149"
- }, {
- "id": "optush9dyF",
- "name": "110070080"
- }, {
- "id": "optDuOFYnL",
- "name": "66010053"
- }, {
- "id": "optMG2Oz1M",
- "name": "84010036"
- }, {
- "id": "optAXkvCFZ",
- "name": "92060024"
- }, {
- "id": "opt4CzxTOF",
- "name": "84010037"
- }, {
- "id": "optqOO6gIa",
- "name": "141010004"
- }, {
- "id": "opth2auwtN",
- "name": "94010086"
- }, {
- "id": "optsqspwfo",
- "name": "140010005"
- }, {
- "id": "optUZke8hR",
- "name": "127010010"
- }, {
- "id": "optfmMEWOz",
- "name": "84010038"
- }, {
- "id": "optz83PI4m",
- "name": "128010005"
- }, {
- "id": "optEo1qqwN",
- "name": "140010006"
- }, {
- "id": "optH45oOjh",
- "name": "20010150"
- }, {
- "id": "optfj8CGrt",
- "name": "110010081"
- }, {
- "id": "opto6RZCm9",
- "name": "66010054"
- }, {
- "id": "optMK7PqA6",
- "name": "130010018"
- }
- ]
-
- # 将列表转换为字典以便快速查找
- for item in channel_list:
- channel_mapping[item["name"]] = item["id"]
-
- # 特殊处理:默认渠道ID(你指定的)
- DEFAULT_CHANNEL_ID = "optEkk65hv"
-
- # 查找渠道代码对应的ID
- channel_id = DEFAULT_CHANNEL_ID # 默认值
- if channel_code:
- # 精确匹配
- if channel_code in channel_mapping:
- channel_id = channel_mapping[channel_code]
- self.log(f" 📌 渠道代码匹配: {channel_code} -> {channel_id}", "debug")
- else:
- self.log(f" ⚠️ 未找到渠道代码 {channel_code} 的映射,使用默认值", "warning")
- else:
- self.log(f" ℹ️ 渠道代码为空,使用默认值", "debug")
-
- # ... (后面的代码保持不变)
-
- # 处理意向学校:根据文本查找对应的ID
- target_school_id = None
- if target_school_text:
- # 精确匹配
- if target_school_text in school_mapping:
- target_school_id = school_mapping[target_school_text]
- self.log(f" 🏫 意向学校: {target_school_text} -> {target_school_id}", "debug")
- else:
- # 尝试模糊匹配(包含关系)
- matched = False
- for school_name, school_id in school_mapping.items():
- if school_name in target_school_text or target_school_text in school_name:
- target_school_id = school_id
- matched = True
- self.log(f" 🏫 意向学校模糊匹配: {target_school_text} -> {school_name} ({target_school_id})", "debug")
- break
-
- if not matched:
- self.log(f" ⚠️ 未找到匹配的意向学校: {target_school_text}", "warning")
-
- # 处理咨询项目:根据文本查找对应的ID(支持多选)
- consulting_ids = []
- if consulting_text:
- # 如果是多个项目,用分隔符分割(如逗号、顿号等)
- consulting_items = re.split(r'[,,、/ ]+', consulting_text)
- for item in consulting_items:
- item = item.strip()
- if item:
- if item in consulting_mapping:
- consulting_ids.append(consulting_mapping[item])
- self.log(f" 📚 咨询项目: {item} -> {consulting_mapping[item]}", "debug")
- else:
- # 尝试模糊匹配
- matched = False
- for consulting_name, consulting_id in consulting_mapping.items():
- if consulting_name in item or item in consulting_name:
- consulting_ids.append(consulting_id)
- matched = True
- self.log(f" 📚 咨询项目模糊匹配: {item} -> {consulting_name} ({consulting_id})", "debug")
- break
- if not matched:
- self.log(f" ⚠️ 未找到匹配的咨询项目: {item}", "warning")
-
- # 处理产品:根据文本查找对应的ID(支持多选)
- product_ids = []
- if product_text:
- product_items = re.split(r'[,,、/ ]+', product_text)
- for item in product_items:
- item = item.strip()
- if item:
- if item in product_mapping:
- product_ids.append(product_mapping[item])
- self.log(f" 📦 产品: {item} -> {product_mapping[item]}", "debug")
- else:
- # 尝试模糊匹配(支持大小写不敏感)
- matched = False
- item_lower = item.lower()
- for product_name, product_id in product_mapping.items():
- # 支持大小写不敏感的匹配
- if product_name.lower() == item_lower or product_name in item or item in product_name:
- product_ids.append(product_id)
- matched = True
- self.log(f" 📦 产品模糊匹配: {item} -> {product_name} ({product_id})", "debug")
- break
- if not matched:
- self.log(f" ⚠️ 未找到匹配的产品: {item}", "warning")
-
- # 构建备注文本
- remark_text = f"姓名:{name},性别:{gender},手机号码:{phone}"
- if remark:
- remark_text += f",{remark}"
-
- # 构建data JSON
- data_obj = {
- "fld43Khnuw": {
- "type": 1,
- "value": [{"type": "text", "text": remark_text}]
- },
- "fldexDPwcE": {"type": 3, "value": "optmlZt00z"} if institution else {"type": 3},
- # 意向学校 - 使用映射后的ID
- "fldWt6JrgK": {"type": 3, "value": target_school_id} if target_school_id else {"type": 3},
- # 咨询项目 - 使用映射后的ID列表(多选)
- "fldirDDoLV": {"type": 4, "value": consulting_ids} if consulting_ids else {"type": 4},
- # 语培产品 - 使用映射后的ID列表(多选)
- "fldudfcNVO": {"type": 4, "value": product_ids} if product_ids else {"type": 4},
- "fldS90QCXo": {"type": 1, "value": [{"type": "text", "text": name}]} if name else {"type": 1},
- "fldsA4YdS6": {"type": 3},
- "fldSSElgkA": {"type": 13, "value": {"fullPhoneNum": phone}} if phone else {"type": 13},
- "fldZPL52gS": {"type": 1},
- "fldPIaD4UH": {"type": 13},
- "fldUGeDVDF": {"type": 13},
- "fldKZ5WKyN": {"type": 1},
- "fld0MHPEaW": {"type": 3},
- "fldOLvk3zZ": {"type": 3},
- "fldkSVVnuu": {"type": 1},
- "fldCfRL3qM": {"type": 3, "value": "optTWIvAFb"} if source else {"type": 3},
- "fldodpd0fR": {
- "type": 11,
- "value": {
- "users": [{
- "userId":"7664781110135589871",
- "name":"王欣",
- "avatarUrl":"https://s3-imfile.feishucdn.com/static-resource/v1/v3_0013q_44a1d366-78d6-4a4b-ad37-294ff4b5d55g~?image_size=72x72&cut_type=default-face&quality=&format=jpeg&sticker_format=.webp",
- "enName":"王欣",
- "notify":False,
- }]
- }
- } if market_person else {"type": 11},
- # ====== 渠道代码 - 使用映射后的ID ======
- "flde7thxT7": {"type": 3, "value": channel_id},
- "fldaxavu52": {"type": 3, "value": "optHsn4zKU"},
- "fldMpwPaI1": {"type": 17} # 图片字段,默认空
- }
-
- # ========== 检查并处理图片 ==========
- if self.image_cache and row_index in self.image_cache:
- images = self.image_cache[row_index]
- self.log(f" 🖼️ 检测到 {len(images)} 个嵌入图片在第 {row_index} 行", "info")
-
- # 上传第一张图片
- if images:
- img_info = images[0]
-
- # 检查是否已经上传过
- if row_index in self.uploaded_cache:
- img_value = self.uploaded_cache[row_index]
- self.log(f" ♻️ 使用已上传的图片: {img_value.get('attachmentToken')}", "debug")
- else:
- # 上传图片
- self.log(f" 📤 开始上传图片...", "info")
- uploaded = self.upload_image(img_info['data'], img_info['filename'])
- if uploaded:
- self.uploaded_cache[row_index] = uploaded
- img_value = uploaded
- self.log(f" ✅ 图片上传成功,token: {uploaded.get('attachmentToken')}", "success")
- else:
- self.log(f" ⚠️ 图片上传失败,跳过该图片", "warning")
- img_value = None
-
- # 如果上传成功,添加到data_obj
- if img_value:
- data_obj["fldMpwPaI1"] = {
- "type": 17,
- "value": [img_value]
- }
- self.log(f" 📎 图片已添加到请求中", "debug")
- else:
- # 没有图片,确保图片字段为空
- data_obj["fldMpwPaI1"] = {"type": 17}
-
- # 构建完整的请求体
- body = {
- "shareToken": self.share_token,
- "data": json.dumps(data_obj, ensure_ascii=False),
- "preUploadEnable": True
- }
-
- return body
- except Exception as e:
- self.log(f"构建请求体失败: {str(e)}", "error")
- import traceback
- self.log(f"详细错误: {traceback.format_exc()}", "debug")
- return None
-
- def send_request(self, row_data, row_index):
- """发送单条请求"""
- try:
- self.log(f"\n{'='*50}", "info")
- self.log(f"📤 准备发送第 {row_index} 行数据", "info")
-
- cookie_string = self.cookie_text.get(1.0, tk.END).strip()
- if not cookie_string:
- self.log("❌ Cookie为空,请先配置Cookie", "error")
- return False, "Cookie为空"
-
- # 构建请求体
- body = self.build_request_body(row_data, row_index)
- if body is None:
- self.log("❌ 构建请求体失败", "error")
- return False, "构建请求体失败"
-
- # 记录请求体大小
- body_str = json.dumps(body, ensure_ascii=False)
- self.log(f"📦 请求体大小: {len(body_str)} 字节", "debug")
-
- # 准备请求
- headers = self.default_headers.copy()
- cookies = self.parse_cookie(cookie_string)
-
- # 更新动态头
- headers["x-csrftoken"] = self._get_csrf_token()
- headers["f-version"] = "docs-6-17-1781628518399"
-
- self.log(f"🌐 发送请求到: {self.url}", "debug")
-
- # 发送请求
- response = requests.post(
- self.url,
- headers=headers,
- cookies=cookies,
- json=body,
- timeout=30
- )
-
- self.log(f"📡 响应状态码: {response.status_code}", "debug")
-
- # 解析响应
- try:
- resp_data = response.json()
- resp_text = json.dumps(resp_data, ensure_ascii=False, indent=2)
-
- if isinstance(resp_data, dict):
- if resp_data.get('code') != 0 and resp_data.get('code') is not None:
- self.log(f"⚠️ 服务器返回错误码: {resp_data.get('code')}", "warning")
- self.log(f" 错误信息: {resp_data.get('msg', '未知错误')}", "error")
- if 'data' in resp_data:
- self.log(f" 📊 响应数据: {json.dumps(resp_data['data'], ensure_ascii=False)[:200]}...", "debug")
- except:
- resp_text = response.text
- self.log("⚠️ 响应不是有效的JSON格式", "warning")
-
- if response.status_code == 200:
- self.log(f"✅ 第{row_index}行 发送成功", "success")
- return True, resp_text
- else:
- self.log(f"❌ 第{row_index}行 发送失败 (HTTP {response.status_code})", "error")
- self.log(f" 响应内容: {resp_text[:500]}...", "error")
- return False, resp_text
-
- except requests.exceptions.Timeout:
- self.log(f"⏱️ 第{row_index}行 请求超时", "error")
- return False, "请求超时"
- except requests.exceptions.ConnectionError:
- self.log(f"🔌 第{row_index}行 连接失败,请检查网络", "error")
- return False, "连接失败"
- except Exception as e:
- self.log(f"💥 第{row_index}行 异常: {str(e)}", "error")
- import traceback
- self.log(f"详细错误: {traceback.format_exc()}", "debug")
- return False, str(e)
- finally:
- self.log(f"{'='*50}\n", "info")
-
- def send_all(self):
- """发送所有数据的主循环"""
- try:
- excel_file = self.file_path_var.get()
- sheet_name = self.sheet_var.get()
- min_interval = float(self.min_interval_var.get())
- max_interval = float(self.max_interval_var.get())
- start_row = int(self.start_row_var.get()) - 1
-
- if not excel_file:
- self.log("❌ 请先选择Excel文件", "error")
- self.status_var.set("❌ 请先选择Excel文件")
- return
-
- # 清空上次上传缓存
- self.uploaded_cache = {}
-
- # ========== 自动提取所有图片到缓存 ==========
- self.log(f"🔍 正在自动提取Excel中的嵌入图片...", "info")
- self.image_cache = self.extract_images_to_cache(excel_file, sheet_name)
-
- if self.image_cache:
- total_images = sum(len(imgs) for imgs in self.image_cache.values())
- self.log(f"📊 共提取 {total_images} 张图片,分布在 {len(self.image_cache)} 行", "info")
- rows_with_images = sorted(self.image_cache.keys())
- if len(rows_with_images) <= 20:
- self.log(f"📋 有图片的行: {rows_with_images}", "debug")
- else:
- self.log(f"📋 有图片的行: {rows_with_images[:20]} ... (共{len(rows_with_images)}行)", "debug")
- else:
- self.log(f"📷 未检测到任何嵌入图片", "info")
-
- # ========== 读取Excel数据 ==========
- try:
- df = pd.read_excel(excel_file, sheet_name=sheet_name)
- self.log(f"📊 成功读取Excel: {len(df)} 行数据", "info")
- self.log(f"📋 列名: {', '.join(df.columns.tolist())}", "info")
- except Exception as e:
- self.log(f"❌ 读取Excel失败: {str(e)}", "error")
- self.status_var.set(f"❌ 读取失败: {str(e)}")
- return
-
- if len(df) == 0:
- self.log("⚠️ Excel中没有数据", "warning")
- self.status_var.set("⚠️ 没有数据")
- return
-
- df = df.iloc[start_row:]
- total = len(df)
- success_count = 0
- fail_count = 0
-
- self.log(f"🚀 开始发送,共 {total} 条数据", "info")
- self.status_var.set(f"🔄 发送中... 0/{total}")
-
- for idx, (_, row) in enumerate(df.iterrows()):
- if self.stop_flag:
- self.log("⏹️ 已停止发送", "warning")
- self.status_var.set("⏹️ 已停止")
- break
-
- # ===== 关键修复:计算Excel实际行号 =====
- # DataFrame的索引 + 2(因为第1行是表头,DataFrame从0开始)
- # 再加上start_row(起始行的偏移)
- excel_row_number = idx + 2 + start_row
-
- self.log(f" 📍 DataFrame索引: {idx}, Excel行号: {excel_row_number}", "debug")
-
- # 检查该行是否有图片(使用Excel实际行号)
- if self.image_cache and excel_row_number in self.image_cache:
- img_count = len(self.image_cache[excel_row_number])
- self.log(f" 🖼️ 第{excel_row_number}行有 {img_count} 个嵌入图片,将自动上传并添加", "info")
-
- success, resp_text = self.send_request(row.to_dict(), excel_row_number)
- if success:
- success_count += 1
- else:
- fail_count += 1
-
- self.status_var.set(f"🔄 发送中... {idx+1}/{total} (成功:{success_count} 失败:{fail_count})")
-
- if idx < total - 1 and not self.stop_flag:
- interval = random.uniform(min_interval, max_interval)
- self.log(f"⏳ 等待 {interval:.1f} 秒...", "info")
- time.sleep(interval)
-
- self.log(f"🏁 发送完成!成功: {success_count}, 失败: {fail_count}", "success" if fail_count == 0 else "warning")
- self.status_var.set(f"✅ 完成 成功:{success_count} 失败:{fail_count}")
-
- except Exception as e:
- self.log(f"💥 程序异常: {str(e)}", "error")
- import traceback
- self.log(f"详细错误: {traceback.format_exc()}", "debug")
- self.status_var.set(f"❌ 异常: {str(e)}")
- finally:
- self.is_running = False
- self.start_btn.config(state=tk.NORMAL)
- self.stop_btn.config(state=tk.DISABLED)
-
- def start_send(self):
- """启动发送线程"""
- if self.is_running:
- return
-
- if not self.file_path_var.get():
- messagebox.showwarning("提示", "请先选择Excel文件")
- return
-
- cookie = self.cookie_text.get(1.0, tk.END).strip()
- if not cookie:
- messagebox.showwarning("提示", "请先配置Cookie")
- return
-
- try:
- float(self.min_interval_var.get())
- float(self.max_interval_var.get())
- int(self.start_row_var.get())
- except ValueError:
- messagebox.showerror("错误", "间隔或行号请输入有效数字")
- return
-
- self.is_running = True
- self.stop_flag = False
- self.start_btn.config(state=tk.DISABLED)
- self.stop_btn.config(state=tk.NORMAL)
- self.status_var.set("🔄 正在发送...")
-
- thread = threading.Thread(target=self.send_all, daemon=True)
- thread.start()
-
- def stop_send(self):
- """停止发送"""
- self.stop_flag = True
- self.log("⏹️ 正在停止...", "warning")
- self.stop_btn.config(state=tk.DISABLED)
- # ========== 提取图片功能(手动) ==========
- def extract_images_to_folder(self, file_path, sheet_name, output_folder=None):
- """提取Excel中的所有图片并保存到文件夹"""
- try:
- if output_folder is None:
- base_dir = os.path.dirname(file_path)
- base_name = os.path.splitext(os.path.basename(file_path))[0]
- output_folder = os.path.join(base_dir, f"{base_name}_提取的图片")
-
- if not os.path.exists(output_folder):
- os.makedirs(output_folder)
-
- mapping_file = os.path.join(output_folder, "图片映射表.txt")
- wb = load_workbook(file_path, data_only=True)
- ws = wb[sheet_name]
-
- image_count = 0
- error_count = 0
-
- with open(mapping_file, 'w', encoding='utf-8') as f:
- f.write("="*60 + "\n")
- f.write("Excel图片提取映射表\n")
- f.write(f"源文件: {file_path}\n")
- f.write(f"工作表: {sheet_name}\n")
- f.write(f"提取时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
- f.write("="*60 + "\n\n")
- f.write("行号\t列号\t列字母\t文件名\t尺寸\t格式\n")
- f.write("-"*60 + "\n")
-
- if hasattr(ws, '_images') and ws._images:
- self.log(f" 📸 开始提取 {len(ws._images)} 张图片...", "debug")
- for idx, img in enumerate(ws._images):
- try:
- if hasattr(img, 'anchor') and hasattr(img.anchor, '_from'):
- anchor_from = img.anchor._from
- row = anchor_from.row + 1
- col = anchor_from.col + 1
- col_letter = get_column_letter(col)
- else:
- row = idx + 1
- col = 0
- col_letter = '?'
-
- image_data = None
- if hasattr(img, '_data') and callable(img._data):
- image_data = img._data()
- elif hasattr(img, '_data') and not callable(img._data):
- image_data = img._data
- elif hasattr(img, 'image'):
- if hasattr(img.image, '_data') and callable(img.image._data):
- image_data = img.image._data()
- elif hasattr(img.image, '_data'):
- image_data = img.image._data
-
- if image_data is None:
- error_count += 1
- continue
-
- # 检测格式并保存
- img_format = 'jpg'
- width, height = 0, 0
- try:
- from PIL import Image
- import io
- pil_img = Image.open(io.BytesIO(image_data))
- img_format = pil_img.format if pil_img.format else 'jpg'
- width, height = pil_img.size
- filename = f"第{row}行_列{col_letter}_{idx+1}.{img_format.lower()}"
- filepath = os.path.join(output_folder, filename)
- pil_img.save(filepath)
- except:
- filename = f"第{row}行_列{col_letter}_{idx+1}.jpg"
- filepath = os.path.join(output_folder, filename)
- with open(filepath, 'wb') as f_out:
- f_out.write(image_data)
-
- f.write(f"{row}\t{col}\t{col_letter}\t{filename}\t{width}x{height}\t{img_format}\n")
- image_count += 1
-
- if image_count % 50 == 0:
- self.log(f" 📸 已提取 {image_count} 张图片...", "debug")
- except Exception as e:
- error_count += 1
- self.log(f" ⚠️ 提取图片失败: {str(e)}", "warning")
-
- wb.close()
-
- with open(mapping_file, 'a', encoding='utf-8') as f:
- f.write("\n" + "="*60 + "\n")
- f.write(f"提取完成: 成功 {image_count} 张, 失败 {error_count} 张\n")
- f.write("="*60 + "\n")
-
- self.log(f"✅ 成功提取 {image_count} 张图片到: {output_folder}", "success")
- if error_count > 0:
- self.log(f"⚠️ 有 {error_count} 张图片提取失败", "warning")
- self.log(f"📋 映射文件: {mapping_file}", "info")
-
- return output_folder
-
- except Exception as e:
- self.log(f"❌ 提取图片失败: {str(e)}", "error")
- return None
-
- def extract_images(self):
- """手动提取图片的入口方法"""
- excel_file = self.file_path_var.get()
- if not excel_file:
- messagebox.showwarning("提示", "请先选择Excel文件")
- return
-
- sheet_name = self.sheet_var.get()
-
- if not messagebox.askyesno("确认",
- f"即将提取Excel中的所有图片\n\n"
- f"文件: {os.path.basename(excel_file)}\n"
- f"工作表: {sheet_name}\n\n"
- f"是否继续?"):
- return
-
- def extract_thread():
- self.log("📸 开始提取图片...", "info")
- self.status_var.set("🔄 正在提取图片...")
- self.start_btn.config(state=tk.DISABLED)
-
- output_folder = self.extract_images_to_folder(excel_file, sheet_name)
-
- if output_folder:
- self.status_var.set(f"✅ 图片已提取到: {output_folder}")
- messagebox.showinfo("提取成功",
- f"图片已成功提取!\n\n"
- f"保存位置: {output_folder}\n\n"
- f"请查看文件夹中的 '图片映射表.txt' 文件")
- else:
- self.status_var.set("❌ 提取失败")
- messagebox.showerror("提取失败", "图片提取失败,请查看日志了解详情。")
-
- self.start_btn.config(state=tk.NORMAL)
-
- thread = threading.Thread(target=extract_thread, daemon=True)
- thread.start()
- if __name__ == "__main__":
- root = tk.Tk()
- app = FeishuSubmitApp(root)
- root.mainloop()
|