mirror of
https://github.com/labring/sealos.git
synced 2026-09-21 13:51:32 +08:00
fix(costcenter): transfer error (#4010)
This commit is contained in:
@@ -21,7 +21,6 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
if (kube_user === null) {
|
||||
return jsonRes(resp, { code: 404, message: 'user not found' });
|
||||
}
|
||||
const kube_namespace = kc.getContexts()[0].namespace;
|
||||
// get payment crd
|
||||
type paymentStatus = {
|
||||
tradeNo: string;
|
||||
@@ -31,7 +30,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
|
||||
const paymentM = {
|
||||
...paymentMeta,
|
||||
namespace: kube_namespace || GetUserDefaultNameSpace(kube_user.name)
|
||||
namespace: GetUserDefaultNameSpace(kube_user.name)
|
||||
};
|
||||
const paymentDesc = await GetCRD(kc, paymentM, id);
|
||||
//@ts-ignore
|
||||
|
||||
@@ -34,7 +34,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
return jsonRes(resp, { code: 401, message: 'user not found' });
|
||||
}
|
||||
|
||||
const namespace = kc.getContexts()[0].namespace || GetUserDefaultNameSpace(kubeUser.name);
|
||||
const namespace = GetUserDefaultNameSpace(kubeUser.name);
|
||||
const name = to + '-' + getTime(new Date());
|
||||
const transferCRD = generateTransferCrd({
|
||||
to,
|
||||
|
||||
@@ -11,7 +11,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
if (user === null) {
|
||||
return jsonRes(resp, { code: 403, message: 'user null' });
|
||||
}
|
||||
const namespace = GetUserDefaultNameSpace(user.name);
|
||||
const namespace = kc.getContexts()[0].namespace || GetUserDefaultNameSpace(user.name);
|
||||
const name = new Date().getTime() + 'appquery';
|
||||
const crdSchema = {
|
||||
apiVersion: `account.sealos.io/v1`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { authSession } from '@/service/backend/auth';
|
||||
import { CRDMeta, GetCRD } from '@/service/backend/kubernetes';
|
||||
import { CRDMeta, GetCRD, GetUserDefaultNameSpace } from '@/service/backend/kubernetes';
|
||||
import { jsonRes } from '@/service/backend/response';
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { ApplyYaml } from '@/service/backend/kubernetes';
|
||||
@@ -44,7 +44,8 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
if (user === null) {
|
||||
return jsonRes(resp, { code: 403, message: 'user null' });
|
||||
}
|
||||
const namespace = kc.getContexts()[0].namespace || 'ns-' + user.name;
|
||||
// 要和kc保持一致
|
||||
const namespace = kc.getContexts()[0].namespace || GetUserDefaultNameSpace(user.name);
|
||||
const name = new Date().getTime() + 'namespacequery';
|
||||
const crdSchema = {
|
||||
apiVersion: `account.sealos.io/v1`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { authSession } from '@/service/backend/auth';
|
||||
import { CRDMeta, GetCRD } from '@/service/backend/kubernetes';
|
||||
import { CRDMeta, GetCRD, GetUserDefaultNameSpace } from '@/service/backend/kubernetes';
|
||||
import { jsonRes } from '@/service/backend/response';
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { ApplyYaml } from '@/service/backend/kubernetes';
|
||||
@@ -42,7 +42,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
|
||||
if (user === null) {
|
||||
return jsonRes(resp, { code: 403, message: 'user null' });
|
||||
}
|
||||
const namespace = 'ns-' + user.name;
|
||||
const namespace = GetUserDefaultNameSpace(user.name);
|
||||
const body = req.body;
|
||||
let spec: BillingSpec = body.spec;
|
||||
if (!spec) {
|
||||
|
||||
Reference in New Issue
Block a user