移除了x-api-token字段

This commit is contained in:
zayac 2024-05-07 17:42:12 +08:00
parent 3f1bae6866
commit 3fc1c2d556
4 changed files with 6 additions and 9 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 80200 (8.2.0) Target Server Version : 80200 (8.2.0)
File Encoding : 65001 File Encoding : 65001
Date: 01/04/2024 20:29:31 Date: 07/05/2024 12:39:04
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -25,10 +25,9 @@ CREATE TABLE `ky_account` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '账号', `username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '账号',
`password` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码', `password` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码',
`type` enum('ky','hth','jy') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '类型 ky hth', `type` enum('ky','hth','jy','aty') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '类型 ky hth',
`name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '别名', `name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '别名',
`url` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'url', `url` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'url',
`x_api_token` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'x-api-token',
`headers` json NULL COMMENT 'headers', `headers` json NULL COMMENT 'headers',
`user_id` int NOT NULL COMMENT '关联的用户id', `user_id` int NOT NULL COMMENT '关联的用户id',
`status` int NOT NULL DEFAULT 0 COMMENT '账号的状态默认为0 禁用', `status` int NOT NULL DEFAULT 0 COMMENT '账号的状态默认为0 禁用',
@ -36,7 +35,7 @@ CREATE TABLE `ky_account` (
UNIQUE INDEX `username`(`username` ASC) USING BTREE, UNIQUE INDEX `username`(`username` ASC) USING BTREE,
INDEX `user_id`(`user_id` ASC) USING BTREE, INDEX `user_id`(`user_id` ASC) USING BTREE,
CONSTRAINT `ky_account_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `ky_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT CONSTRAINT `ky_account_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `ky_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Table structure for ky_user -- Table structure for ky_user
@ -53,8 +52,9 @@ CREATE TABLE `ky_user` (
`chat_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '私聊id', `chat_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '私聊id',
`telegram_ids` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'telegram_id ,分割', `telegram_ids` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'telegram_id ,分割',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '用户状态 0 禁用 1启用', `status` tinyint NOT NULL DEFAULT 0 COMMENT '用户状态 0 禁用 1启用',
`count_group_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '报数群组id',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username`(`username` ASC) USING BTREE UNIQUE INDEX `username`(`username` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@ -6,7 +6,7 @@ import time
import requests import requests
from playwright.sync_api import Position, TimeoutError, sync_playwright from playwright.sync_api import Position, TimeoutError, sync_playwright
from src import logger from loguru import logger
from src.entity.account import Account, AccountType from src.entity.account import Account, AccountType
from src.entity.database import db from src.entity.database import db
from src.ui import global_signals from src.ui import global_signals
@ -159,7 +159,6 @@ def persistence(account: Account, headers: dict):
db_account = session.query(Account).filter(Account.username == account.username, db_account = session.query(Account).filter(Account.username == account.username,
Account.password == account.password).one() Account.password == account.password).one()
db_account.headers = headers db_account.headers = headers
db_account.x_api_token = headers['x-api-token']
session.commit() session.commit()
logger.info(f'Headers persisted for account {account.name}') logger.info(f'Headers persisted for account {account.name}')

View File

@ -28,7 +28,6 @@ class Account(db.Base):
comment='类型 ky hth jy aty') comment='类型 ky hth jy aty')
name: Mapped[str] = mapped_column(String(64), nullable=True, comment='别名') name: Mapped[str] = mapped_column(String(64), nullable=True, comment='别名')
url: Mapped[str] = mapped_column(String(128), nullable=False, comment='url') url: Mapped[str] = mapped_column(String(128), nullable=False, comment='url')
x_api_token: Mapped[str] = mapped_column(String(64), nullable=True, comment='x-api-token')
headers: Mapped[Sql_JSON] = mapped_column(Sql_JSON, nullable=True, comment='headers') headers: Mapped[Sql_JSON] = mapped_column(Sql_JSON, nullable=True, comment='headers')
user_id: Mapped[int] = mapped_column(ForeignKey('ky_user.id'), user_id: Mapped[int] = mapped_column(ForeignKey('ky_user.id'),
nullable=False, comment='关联的用户id') nullable=False, comment='关联的用户id')

View File

@ -8,7 +8,6 @@ from loguru import logger
from src.core.api_request import account_post from src.core.api_request import account_post
from src.core.constant import BANNER_URL from src.core.constant import BANNER_URL
from src.core.message_client import send_message from src.core.message_client import send_message
from src.core.util import get_curr_day
from src.entity.account import Account from src.entity.account import Account
from src.entity.member import get_today_new_member_list from src.entity.member import get_today_new_member_list
from src.entity.pay_record import get_latest_deposit_user from src.entity.pay_record import get_latest_deposit_user