| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-01-20 16:24:16 |
| 4 | * @LastEditTime: 2025-02-17 12:24:49 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: 平台账号 |
| 7 | */ |
| 8 | import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; |
| 9 | import { TempModel } from './temp'; |
| 10 | import { |
| 11 | AccountStatus, |
| 12 | PlatType, |
| 13 | XhsAccountAbnormal, |
| 14 | } from '../../../commont/AccountEnum'; |
| 15 | |
| 16 | @Entity({ name: 'account' }) |
| 17 | export class AccountModel extends TempModel { |
| 18 | @PrimaryGeneratedColumn({ type: 'int', comment: 'id' }) |
| 19 | id!: number; |
| 20 | |
| 21 | @Column({ type: 'varchar', nullable: false, comment: '用户id' }) |
| 22 | userId!: string; |
| 23 | |
| 24 | @Column({ |
| 25 | type: 'varchar', |
| 26 | enum: PlatType, |
| 27 | nullable: true, |
| 28 | comment: '平台类型', |
| 29 | }) |
| 30 | type!: PlatType; |
| 31 | |
| 32 | @Column({ type: 'varchar', nullable: false, comment: '登录cookie' }) |
| 33 | loginCookie!: string; |
| 34 | |
| 35 | @Column({ |
| 36 | type: 'varchar', |
| 37 | nullable: true, |
| 38 | comment: '其他token 目前抖音用', |
| 39 | default: '', |
| 40 | }) |
| 41 | token?: string; |
| 42 | |
| 43 | @Column({ |
| 44 | type: 'datetime', |
| 45 | nullable: true, |
| 46 | comment: '登录时间', |
| 47 | }) |
| 48 | loginTime?: Date; |
| 49 | |
| 50 | @Column({ type: 'varchar', nullable: false, comment: '用户id' }) |
| 51 | uid!: string; |
| 52 | |
| 53 | // 账号 |
| 54 | @Column({ type: 'varchar', nullable: false, comment: '账号' }) |
| 55 | account!: string; |
| 56 | |
| 57 | // 头像 |
| 58 | @Column({ type: 'varchar', nullable: false, comment: '头像' }) |
| 59 | avatar!: string; |
| 60 | |
| 61 | // 昵称 |
| 62 | @Column({ type: 'varchar', nullable: false, comment: '昵称' }) |
| 63 | nickname!: string; |
| 64 | |
| 65 | // 粉丝数量 |
| 66 | @Column({ type: 'int', nullable: false, comment: '粉丝数量', default: 0 }) |
| 67 | fansCount!: number; |
| 68 | |
| 69 | // 阅读数量 |
| 70 | @Column({ type: 'int', nullable: false, comment: '总阅读数量', default: 0 }) |
| 71 | readCount!: number; |
| 72 | |
| 73 | // 点赞数量 |
| 74 | @Column({ type: 'int', nullable: false, comment: '总点赞数量', default: 0 }) |
| 75 | likeCount!: number; |
| 76 | |
| 77 | // 收藏数量 |
| 78 | @Column({ type: 'int', nullable: false, comment: '总收藏数量', default: 0 }) |
| 79 | collectCount!: number; |
| 80 | |
| 81 | // 转发数量 |
| 82 | @Column({ type: 'int', nullable: false, comment: '总转发数量', default: 0 }) |
| 83 | forwardCount!: number; |
| 84 | |
| 85 | // 评论数量 |
| 86 | @Column({ type: 'int', nullable: false, comment: '总评论数量', default: 0 }) |
| 87 | commentCount!: number; |
| 88 | |
| 89 | @Column({ type: 'datetime', nullable: true, comment: '最后统计时间' }) |
| 90 | lastStatsTime?: Date; |
| 91 | |
| 92 | // 作品数量 |
| 93 | @Column({ type: 'int', nullable: false, comment: '作品数量', default: 0 }) |
| 94 | workCount?: number; |
| 95 | |
| 96 | // 收益 |
| 97 | @Column({ type: 'bigint', nullable: false, comment: '收益', default: 0 }) |
| 98 | income?: number; |
| 99 | |
| 100 | // 账号异常状态,异常状态无法发视频 |
| 101 | @Column({ type: 'json', nullable: true }) |
| 102 | abnormalStatus?: { |
| 103 | [PlatType.Xhs]: XhsAccountAbnormal; |
| 104 | }; |
| 105 | |
| 106 | // 登录状态,判断是否失效 |
| 107 | @Column({ |
| 108 | type: 'tinyint', |
| 109 | nullable: false, |
| 110 | comment: '登录状态,用于判断是否失效', |
| 111 | default: AccountStatus.USABLE, |
| 112 | }) |
| 113 | status?: AccountStatus; |
| 114 | |
| 115 | // 关联组 |
| 116 | @Column({ |
| 117 | type: 'int', |
| 118 | nullable: false, |
| 119 | comment: '关联组,与 AccountGroupModel表 id关联', |
| 120 | default: 1, |
| 121 | }) |
| 122 | groupId!: number; |
| 123 | } |
| 124 |