mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-31 19:12:46 +00:00
18 lines
492 B
TypeScript
18 lines
492 B
TypeScript
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,
|
|
type: bill.type,
|
|
userId: bill.userId,
|
|
chatId: bill.chatId,
|
|
time: dayjs(bill.time).format('YYYY/MM/DD HH:mm:ss'),
|
|
textLen: bill.textLen,
|
|
tokenLen: bill.tokenLen,
|
|
price: formatPrice(bill.price)
|
|
};
|
|
};
|