feat: 对齐闲鱼续期流程并完善业务管理
对齐官方 WebSocket 批量握手、注册、心跳、ACK、同步恢复及运行时设备标识生命周期。 保留 Cookie 完整属性,接入静默续期和保存登录信息设置,并在凭证更新后重建账号连接。 完善订单与商品同步、卡券和通知渠道交互,更新前端品牌、时间展示及嵌入资源。 补充 Go 与前端回归测试,确保完整检查和生产构建通过。
This commit is contained in:
1 parent
3cc1d4094d
commit
d77c317452
69 files changed
+3169
-819
No files matched your search
@@ -187,6 +187,18 @@ test('getItems normalizes multi-spec flags from backend values', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('getItems forwards the selected account filter', async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse([]));
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
await getItems('account-2');
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledWith('/items?cookie_id=account-2', expect.objectContaining({
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
}));
|
||||
});
|
||||
|
||||
test('getSystemSettings normalizes numeric renewal retention', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(jsonResponse({
|
||||
ai_model: 'qwen-plus',
|
||||
|
||||
@@ -159,6 +159,19 @@ export const updateAccountSettings = async (id: string, data: AccountSettingsUpd
|
||||
return put(`/cookies/${id}/settings`, data);
|
||||
};
|
||||
|
||||
export interface LongLoginSettings {
|
||||
can_open_long_login: boolean;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export const getLongLoginSettings = async (id: string): Promise<LongLoginSettings> => {
|
||||
return get(`/cookies/${id}/long-login`);
|
||||
};
|
||||
|
||||
export const setLongLoginSettings = async (id: string, enabled: boolean): Promise<LongLoginSettings> => {
|
||||
return put(`/cookies/${id}/long-login`, { enabled });
|
||||
};
|
||||
|
||||
export interface PasswordLoginStartResponse {
|
||||
success: boolean;
|
||||
session_id?: string;
|
||||
@@ -413,8 +426,8 @@ export const appendCardData = async (cardId: string | number, content: string):
|
||||
const normalizeBooleanFlag = (value: unknown): boolean =>
|
||||
value === true || value === 1 || value === '1';
|
||||
|
||||
export const getItems = async (): Promise<Item[]> => {
|
||||
const res = await get<any>('/items');
|
||||
export const getItems = async (cookieId?: string): Promise<Item[]> => {
|
||||
const res = await get<any>('/items', cookieId ? { cookie_id: cookieId } : undefined);
|
||||
const items = Array.isArray(res) ? res : (res.items || []);
|
||||
return items.map((item: any) => ({
|
||||
...item,
|
||||
|
||||
Reference in new issue
Block a user