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)
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user