From eec6b00685781bfb696fdd3f83856cf711b9505e Mon Sep 17 00:00:00 2001 From: xingc Date: Fri, 25 Apr 2025 17:41:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(card):=20=E4=BF=AE=E5=A4=8D`cgc`=E5=8D=A1?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=8A=9B=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versions/2d63d72e671a_trim_card_table.py | 27 +++++++++++++++++++ core/routers/card/scraper.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/2d63d72e671a_trim_card_table.py diff --git a/alembic/versions/2d63d72e671a_trim_card_table.py b/alembic/versions/2d63d72e671a_trim_card_table.py new file mode 100644 index 0000000..b9f8866 --- /dev/null +++ b/alembic/versions/2d63d72e671a_trim_card_table.py @@ -0,0 +1,27 @@ +"""trim card table + +Revision ID: 2d63d72e671a +Revises: bde4f21924c8 +Create Date: 2025-04-25 16:42:04.000778 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision: str = '2d63d72e671a' +down_revision: Union[str, None] = 'bde4f21924c8' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.add_column("system_cards", + sa.Column('diy_source', sa.String(length=50), nullable=True, comment='自定义品牌名') + ) + + +def downgrade() -> None: + pass diff --git a/core/routers/card/scraper.py b/core/routers/card/scraper.py index 978fd92..0ea7fd7 100644 --- a/core/routers/card/scraper.py +++ b/core/routers/card/scraper.py @@ -279,7 +279,7 @@ class CardScraper: """CGC""" r = await self.api.cgc(cert_number) html = Selector(r.text) - if html.xpath('//div[@class="error" and @ng-show]').get() is None: + if html.xpath('//div[@class="certlookup-search-box"]').get() is None: return info_elements = html.xpath('//div[@class="content-wrapper"]//dl')