mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 08:25:07 +00:00
feat: 账单模块
This commit is contained in:
15
src/utils/adapt.ts
Normal file
15
src/utils/adapt.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { formatPrice } from './user';
|
||||
import dayjs from 'dayjs';
|
||||
import type { BillSchema } from '../types/mongoSchema';
|
||||
import type { UserBillType } from '@/types/user';
|
||||
|
||||
export const adaptBill = (bill: BillSchema): UserBillType => {
|
||||
return {
|
||||
id: bill._id,
|
||||
userId: bill.userId,
|
||||
chatId: bill.chatId,
|
||||
time: dayjs(bill.time).format('YYYY/MM/DD hh:mm:ss'),
|
||||
textLen: bill.textLen,
|
||||
price: formatPrice(bill.price)
|
||||
};
|
||||
};
|
@@ -41,6 +41,14 @@ export const createHashPassword = (text: string) => {
|
||||
return hash;
|
||||
};
|
||||
|
||||
export const Obj2Query = (obj: Record<string, string | number>) => {
|
||||
const queryParams = new URLSearchParams();
|
||||
for (const key in obj) {
|
||||
queryParams.append(key, `${obj[key]}`);
|
||||
}
|
||||
return queryParams.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* 读取文件内容
|
||||
*/
|
||||
|
Reference in New Issue
Block a user