Skip to content

Let's use AI to Earn!

feat: 更换地址

牛文政e6609baaad9a
diff --git a/.env b/.env
index 26324c61..82e7aafe 100644
--- a/.env
+++ b/.env
@@ -3,7 +3,7 @@ VITE_APP_HOT_URL = 'https://att-contents.yikart.cn/api'
VITE_APP_FILE_HOST = 'https://ai-to-earn.oss-cn-beijing.aliyuncs.com/'
# 正式
-VITE_APP_URL = 'https://ttrcvilakwqb.sealosbja.site/api'
+VITE_APP_URL = 'https://apitest.aitoearn.cn/api'
# 调试
# VITE_APP_URL = 'http://127.0.0.1:3000/api'
diff --git a/electron/main/api/tracing.ts b/electron/main/api/tracing.ts
new file mode 100644
index 00000000..ad6f3d3d
--- /dev/null
+++ b/electron/main/api/tracing.ts
@@ -0,0 +1,136 @@
+import netRequest from '.';
+
+export enum TracingType {
+ EVENT = 'event', // 事件
+}
+
+export enum TracingTag {
+ AccountAdd = 'AccountAdd', // 账号添加
+ VideoPul = 'VideoPul', // 视频发布
+ OpenProjectUse = 'OpenProjectUse', // 开源项目调用
+}
+
+export interface Tracing {
+ id: string;
+ userId: string;
+ type: TracingType;
+ tag: TracingTag;
+ accountId?: number; // 平台账号ID
+ desc?: string;
+ dataId?: string; // 关联数据id
+ createTime: string;
+ updateTime: string;
+}
+
+export class TracingApi {
+ // 创建跟踪-账号添加
+ async createTracing(account: {
+ id: number;
+ desc?: string;
+ }): Promise<Tracing | null> {
+ const inData: {
+ type: TracingType;
+ tag: string;
+ accountId?: number; // 平台账号ID
+ desc?: string;
+ dataId?: string; // 关联数据id
+ } = {
+ type: TracingType.EVENT,
+ tag: TracingTag.AccountAdd,
+ accountId: account.id,
+ desc: account.desc,
+ dataId: account.id + '',
+ };
+
+ const res = await netRequest<{
+ data: Tracing;
+ code: number;
+ msg: string;
+ }>({
+ method: 'POST',
+ url: 'tracing',
+ body: inData,
+ });
+ const {
+ status,
+ data: { data, code },
+ } = res;
+ if (status !== 200 && status !== 201) return null;
+ if (!!code) return null;
+ return data;
+ }
+
+ // 创建跟踪-视频发布
+ async createTracingVideoPul(inData: {
+ accountId: number;
+ dataId: string; // 视频发布数据ID
+ desc?: string;
+ }): Promise<Tracing | null> {
+ const body: {
+ type: TracingType;
+ tag: string;
+ accountId?: number; // 平台账号ID
+ desc?: string;
+ dataId?: string; // 关联数据id
+ } = {
+ type: TracingType.EVENT,
+ tag: TracingTag.VideoPul,
+ accountId: inData.accountId,
+ desc: inData.desc,
+ dataId: inData.dataId + '',
+ };
+
+ const res = await netRequest<{
+ data: Tracing;
+ code: number;
+ msg: string;
+ }>({
+ method: 'POST',
+ url: 'tracing',
+ body: body,
+ });
+ const {
+ status,
+ data: { data, code },
+ } = res;
+ if (status !== 200 && status !== 201) return null;
+ if (!!code) return null;
+ return data;
+ }
+
+ // 创建跟踪-开源项目调用
+ async createTracingOpenProjectUse(inData: {
+ desc?: string;
+ }): Promise<Tracing | null> {
+ const body: {
+ type: TracingType;
+ tag: string;
+ accountId?: number; // 平台账号ID
+ desc?: string;
+ dataId?: string; // 关联数据id
+ } = {
+ type: TracingType.EVENT,
+ tag: TracingTag.OpenProjectUse,
+ desc: inData.desc,
+ };
+
+ const res = await netRequest<{
+ data: Tracing;
+ code: number;
+ msg: string;
+ }>({
+ method: 'POST',
+ url: 'tracing',
+ body: body,
+ });
+ const {
+ status,
+ data: { data, code },
+ } = res;
+ if (status !== 200 && status !== 201) return null;
+ if (!!code) return null;
+ return data;
+ }
+}
+
+export const tracingApi = new TracingApi();
diff --git a/electron/main/tracing/controller.ts b/electron/main/tracing/controller.ts
new file mode 100644
index 00000000..431b2aa8
--- /dev/null
+++ b/electron/main/tracing/controller.ts
@@ -0,0 +1,18 @@
+import { tracingApi } from '../api/tracing';
+import { Controller, Et, Inject } from '../core/decorators';
+import { TracingService } from './service';
+
+@Controller()
+export class TracingController {
+ @Inject(TracingService)
+ private readonly tracingService!: TracingService;
+
+ // 创建跟踪记录-账号添加
+ @Et('ET_TRACING_ACCOUNT_ADD')
+ async updateVideoPul(videoModel: {
+ id: number;
+ desc?: string;
+ }): Promise<any> {
+ tracingApi.createTracing(videoModel);
+ }
+}
diff --git a/electron/main/tracing/module.ts b/electron/main/tracing/module.ts
new file mode 100644
index 00000000..24653e0f
--- /dev/null
+++ b/electron/main/tracing/module.ts
@@ -0,0 +1,9 @@
+import { Module } from '../core/decorators';
+import { TracingController } from './controller';
+import { TracingService } from './service';
+
+@Module({
+ controllers: [TracingController],
+ providers: [TracingService],
+})
+export class TracingModule {}
diff --git a/electron/main/tracing/service.ts b/electron/main/tracing/service.ts
new file mode 100644
index 00000000..1cd4f6f4
--- /dev/null
+++ b/electron/main/tracing/service.ts
@@ -0,0 +1,4 @@
+import { Injectable } from '../core/decorators';
+
+@Injectable()
+export class TracingService {}