Skip to content

Commit

Permalink
feat(web): add subscription and wechat pay (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ authored Mar 15, 2023
1 parent b8f2d47 commit 31c3a32
Show file tree
Hide file tree
Showing 27 changed files with 758 additions and 187 deletions.
6 changes: 3 additions & 3 deletions web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"Copy": "copy",
"Create": "new application",
"CreateNow": "create now",
"CreateTime": "Created time",
"Custom": "customize",
"Days": "days",
"Delete": "Delete ",
Expand Down Expand Up @@ -284,5 +283,6 @@
"Price": {
"Free": "Free"
},
"star-us-on-github": "Star us on GitHub"
}
"star-us-on-github": "Star us on GitHub",
"Time": "Time"
}
6 changes: 3 additions & 3 deletions web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"Copy": "复制",
"Create": "新建",
"CreateNow": "立即创建",
"CreateTime": "创建时间",
"Custom": "自定义",
"Days": "",
"Delete": "删除",
Expand Down Expand Up @@ -146,7 +145,7 @@
"UpdateConfirm": "更新环境变量将重新启动应用,是否继续?",
"AppInfo": "应用信息",
"BaseInfo": "基础信息",
"Detail": "规则详情",
"Detail": "规格详情",
"Memory": "内存",
"Disk": "硬盘",
"DB": "数据库",
Expand Down Expand Up @@ -284,5 +283,6 @@
"Price": {
"Free": "免费"
},
"star-us-on-github": "在 GitHub 上支持我们"
"star-us-on-github": "在 GitHub 上支持我们",
"Time": "时间"
}
6 changes: 3 additions & 3 deletions web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"Copy": "复制",
"Create": "新建",
"CreateNow": "立即创建",
"CreateTime": "创建时间",
"Custom": "自定义",
"Days": "",
"Delete": "删除",
Expand Down Expand Up @@ -146,7 +145,7 @@
"UpdateConfirm": "更新环境变量将重新启动应用,是否继续?",
"AppInfo": "应用信息",
"BaseInfo": "基础信息",
"Detail": "规则详情",
"Detail": "规格详情",
"Memory": "内存",
"Disk": "硬盘",
"DB": "数据库",
Expand Down Expand Up @@ -284,5 +283,6 @@
"Price": {
"Free": "免费"
},
"star-us-on-github": "在 GitHub 上支持我们"
"star-us-on-github": "在 GitHub 上支持我们",
"Time": "时间"
}
6 changes: 3 additions & 3 deletions web/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ body {
font-size: 12px;
}

[data-theme=light] body {
[data-theme="light"] body {
background-color: #f1f3f5 !important;
background-image: url("/bg.png") !important;
}

[data-theme=dark] ::-webkit-scrollbar-thumb {
[data-theme="dark"] ::-webkit-scrollbar-thumb {
/* 滚动条滑块 */
background: rgba(21, 22, 26, 0.4);
}
Expand All @@ -64,4 +64,4 @@ a {
color: white;
background: black;
}
}
}
95 changes: 88 additions & 7 deletions web/src/apis/typing.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type TApplication = {
export type TApplicationDetail = {
id: string;
name: string;
appid: string;
Expand Down Expand Up @@ -26,14 +26,13 @@ export type TApplication = {

export type TBundle = {
id: string;
appid: string;
name: string;
displayName: string;
priority: number;
state: string;
resource: TResource;
price: number;
specialPrice: number;
createdAt: string;
updatedAt: string;
limitCountPerUser: number;
subscriptionOptions: TSubscriptionOption[];
};

export type TResource = {
Expand All @@ -44,15 +43,24 @@ export type TResource = {
databaseCapacity: number;
storageCapacity: number;
networkTrafficOutbound: number;
limitCountPerUser: number;
limitCountOfCloudFunction: number;
limitCountOfBucket: number;
limitCountOfDatabasePolicy: number;
limitCountOfTrigger: number;
limitCountOfWebsiteHosting: number;
reservedTimeAfterExpired: number;
limitDatabaseTPS: number;
limitStorageTPS: number;
};

export type TSubscriptionOption = {
name: string;
displayName: string;
duration: number;
price: number;
specialPrice: number;
};

export type TRuntime = {
id: string;
name: string;
Expand Down Expand Up @@ -257,3 +265,76 @@ export type TProfile = {
createdAt: string;
updatedAt: string;
};

export type TApplicationItem = {
id: string;
name: string;
appid: string;
regionId: string;
runtimeId: string;
tags: Array<any>;
state: string;
phase: string;
createdAt: string;
updatedAt: string;
lockedAt: string;
createdBy: string;
bundle: {
id: string;
appid: string;
bundleId: string;
name: string;
displayName: string;
resource: {
limitCPU: number;
limitMemory: number;
requestCPU: number;
requestMemory: number;
databaseCapacity: number;
storageCapacity: number;
networkTrafficOutbound: number;
limitCountOfCloudFunction: number;
limitCountOfBucket: number;
limitCountOfDatabasePolicy: number;
limitCountOfTrigger: number;
limitCountOfWebsiteHosting: number;
reservedTimeAfterExpired: number;
limitDatabaseTPS: number;
limitStorageTPS: number;
};
createdAt: string;
updatedAt: string;
};
runtime: {
id: string;
name: string;
type: string;
image: {
main: string;
init: string;
sidecar: any;
};
state: string;
version: string;
latest: boolean;
};
subscription: {
id: string;
input: {
name: string;
state: string;
runtimeId: string;
regionId: string;
};
bundleId: string;
appid: string;
state: string;
phase: string;
renewalPlan: string;
expiredAt: string;
lockedAt: string;
createdAt: string;
updatedAt: string;
createdBy: string;
};
};
78 changes: 78 additions & 0 deletions web/src/apis/v1/accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// @ts-ignore
/* eslint-disable */
///////////////////////////////////////////////////////////////////////
// //
// this file is autogenerated by service-generate //
// do not edit this file manually //
// //
///////////////////////////////////////////////////////////////////////
/// <reference path = "api-auto.d.ts" />
import request from "@/utils/request";

/**
* Get account info
*/
export async function AccountControllerFindOne(
params: Paths.AccountControllerFindOne.BodyParameters | any,
): Promise<Paths.AccountControllerFindOne.Responses> {
// /v1/accounts
let _params: { [key: string]: any } = {
appid: localStorage.getItem("app"),
...params,
};
return request(`/v1/accounts`, {
method: "GET",
params: params,
});
}

/**
* Get charge order
*/
export async function AccountControllerGetChargeOrder(
params: Paths.AccountControllerGetChargeOrder.BodyParameters | any,
): Promise<Paths.AccountControllerGetChargeOrder.Responses> {
// /v1/accounts/charge-order/{id}
let _params: { [key: string]: any } = {
appid: localStorage.getItem("app"),
...params,
};
return request(`/v1/accounts/charge-order/${_params.id}`, {
method: "GET",
params: params,
});
}

/**
* Create charge order
*/
export async function AccountControllerCharge(
params: Definitions.CreateChargeOrderDto | any,
): Promise<Paths.AccountControllerCharge.Responses> {
// /v1/accounts/charge-order
let _params: { [key: string]: any } = {
appid: localStorage.getItem("app"),
...params,
};
return request(`/v1/accounts/charge-order`, {
method: "POST",
data: params,
});
}

/**
*
*/
export async function AccountControllerWechatNotify(
params: Paths.AccountControllerWechatNotify.BodyParameters | any,
): Promise<Paths.AccountControllerWechatNotify.Responses> {
// /v1/accounts/payment/wechat-notify
let _params: { [key: string]: any } = {
appid: localStorage.getItem("app"),
...params,
};
return request(`/v1/accounts/payment/wechat-notify`, {
method: "POST",
data: params,
});
}
Loading

0 comments on commit 31c3a32

Please sign in to comment.