feat: 账单模块

This commit is contained in:
archer
2023-03-21 18:04:39 +08:00
parent 42c26bd155
commit 129f3a2a30
11 changed files with 190 additions and 37 deletions

15
src/utils/adapt.ts Normal file
View 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)
};
};