Revert "sub plan page (#885)" (#886)

This reverts commit 443ad37b6a.
This commit is contained in:
Archer
2024-02-23 17:48:15 +08:00
committed by GitHub
parent 443ad37b6a
commit fd9b6291af
246 changed files with 4281 additions and 6286 deletions

View File

@@ -35,7 +35,8 @@ const OutLinkSchema = new Schema({
type: String,
required: true
},
usagePoints: {
total: {
// total amount
type: Number,
default: 0
},
@@ -47,10 +48,6 @@ const OutLinkSchema = new Schema({
default: false
},
limit: {
maxUsagePoints: {
type: Number,
default: -1
},
expiredTime: {
type: Date
},
@@ -58,18 +55,16 @@ const OutLinkSchema = new Schema({
type: Number,
default: 1000
},
credit: {
type: Number,
default: -1
},
hookUrl: {
type: String
}
}
});
try {
OutLinkSchema.index({ shareId: -1 });
} catch (error) {
console.log(error);
}
export const MongoOutLink: Model<SchemaType> =
models['outlinks'] || model('outlinks', OutLinkSchema);

View File

@@ -1,19 +1,18 @@
import axios from 'axios';
import { MongoOutLink } from './schema';
import { FastGPTProUrl } from '../../common/system/constants';
import { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type';
export const addOutLinkUsage = async ({
export const updateOutLinkUsage = async ({
shareId,
totalPoints
total
}: {
shareId: string;
totalPoints: number;
total: number;
}) => {
MongoOutLink.findOneAndUpdate(
{ shareId },
{
$inc: { usagePoints: totalPoints },
$inc: { total },
lastTime: new Date()
}
).catch((err) => {
@@ -24,13 +23,11 @@ export const addOutLinkUsage = async ({
export const pushResult2Remote = async ({
outLinkUid,
shareId,
appName,
responseData
}: {
outLinkUid?: string; // raw id, not parse
shareId?: string;
appName: string;
responseData?: ChatHistoryItemResType[];
responseData?: any[];
}) => {
if (!shareId || !outLinkUid || !FastGPTProUrl) return;
try {
@@ -45,7 +42,6 @@ export const pushResult2Remote = async ({
url: '/shareAuth/finish',
data: {
token: outLinkUid,
appName,
responseData
}
});