feat: google login

This commit is contained in:
imeepos 2025-09-28 10:32:59 +08:00
parent 733713f42f
commit be24e28fc4
3 changed files with 49 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import { useEffect, useRef, useCallback } from 'react';
import Taro from '@tarojs/taro';
import { AsyncTaskManager, TaskStatus, TaskConfig } from '../utils/AsyncTaskManager';
import { PlatformFactory } from '../platforms/factory';
/**
*
*/
@ -189,6 +190,36 @@ export function useImageDetectionTaskManager() {
const { imageUrl, platform, options = {} } = params;
const targetPlatform = platform || currentPlatform.current;
// H5平台跳过审核直接返回通过结果
if (targetPlatform === PlatformType.H5) {
const mockTaskId = `h5_mock_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
const h5Result: ImageAuditResult = {
taskId: mockTaskId,
platform: PlatformType.H5,
status: AuditStatus.COMPLETED,
conclusion: AuditConclusion.PASS,
imageUrl,
result: {
safe: true,
score: 100,
riskLevel: 'low',
categories: [],
suggestion: 'pass',
details: 'H5平台跳过审核自动通过'
},
processingTime: 0,
timestamp: Date.now()
};
// 异步触发回调,模拟真实的审核流程
setTimeout(() => {
onProgress?.(TaskStatus.SUCCESS);
onSuccess?.(h5Result);
}, 100);
return mockTaskId;
}
// 检查缓存
const cacheKey = `${targetPlatform}_${imageUrl}`;
if (options.enableCache && auditCacheRef.current.has(cacheKey)) {
@ -450,7 +481,23 @@ async function preprocessImage(
*
*/
function getCurrentPlatform(): PlatformType {
return PlatformType.BYTEDANCE;
const platform = PlatformFactory.detectPlatform();
switch (platform) {
case 'bytedance':
return PlatformType.BYTEDANCE;
case 'wechat':
return PlatformType.WECHAT;
case 'alipay':
return PlatformType.ALIPAY;
case 'swan':
return PlatformType.BAIDU;
case 'qq':
return PlatformType.QQ;
case 'h5':
return PlatformType.H5;
default:
return PlatformType.BYTEDANCE;
}
}
/**

View File

@ -151,7 +151,7 @@ export default function Home() {
Taro.hideLoading();
// 跳转到生成页面
navigateTo({
url: `/pages/result/index?taskId=${taskId}&templateCode=${template.code}`,
url: `/pages/result/index?taskId=${taskId.taskId}&templateCode=${template.code}`,
});
} catch (businessError) {
// 业务处理失败

View File

@ -49,7 +49,6 @@ interface ApiResponse<T = any> {
*/
export interface ExecuteTemplateParams {
templateCode: string; // 模板代码
userId: string; // 用户ID
imageUrl: string; // 图片URL
}