| 1 | import { Prop, Schema } from '@nestjs/mongoose'; |
| 2 | import { TimeTemp } from './time.tamp'; |
| 3 | import { AccountType } from './account.schema'; |
| 4 | |
| 5 | export enum PubStatus { |
| 6 | UNPUBLISH = 0, // 未发布/草稿 |
| 7 | RELEASED = 1, // 已发布 |
| 8 | FAIL = 2, // 发布失败 |
| 9 | } |
| 10 | |
| 11 | export interface ILableValue { |
| 12 | label: string; |
| 13 | value: string | number; |
| 14 | } |
| 15 | |
| 16 | // 地点数据 |
| 17 | export interface ILocationDataItem { |
| 18 | // 地点名称 |
| 19 | name: string; |
| 20 | // 简单地址简介 |
| 21 | simpleAddress: string; |
| 22 | // 地址ID |
| 23 | id: string; |
| 24 | // 小红书特有 |
| 25 | poi_type?: number; |
| 26 | latitude: number; |
| 27 | longitude: number; |
| 28 | // 市 |
| 29 | city: string; |
| 30 | } |
| 31 | |
| 32 | export interface WxSphEvent { |
| 33 | eventCreatorNickname: string; |
| 34 | eventTopicId: string; |
| 35 | eventName: string; |
| 36 | } |
| 37 | |
| 38 | export enum DeclarationDouyin { |
| 39 | // 内容由AI生成 |
| 40 | AIGC = 'aigc', |
| 41 | // 可能会引人不适 |
| 42 | MaybeUnsuitable = 'maybe_unsuitable', |
| 43 | // 虚拟作品。仅供娱乐 |
| 44 | OnlyFunNew = 'only_fun_new', |
| 45 | // 危险行为,请勿模仿 |
| 46 | DangerousBehavior = 'dangerous_behavior', |
| 47 | // 内容自行拍摄 |
| 48 | SelfShoot = 'self_shoot', |
| 49 | // 内容取材网络 |
| 50 | FromNetV3 = 'from_net_v3', |
| 51 | } |
| 52 | |
| 53 | export type DiffParmasType = { |
| 54 | [AccountType.Xhs]?: object; |
| 55 | [AccountType.Douyin]?: { |
| 56 | // 申请关联的热点 |
| 57 | hotPoint?: ILableValue; |
| 58 | // 申请关联的活动 |
| 59 | activitys?: ILableValue[]; |
| 60 | // 自主声明 |
| 61 | selfDeclare?: DeclarationDouyin; |
| 62 | }; |
| 63 | [AccountType.WxSph]?: { |
| 64 | // 是否为原创 |
| 65 | isOriginal?: boolean; |
| 66 | // 扩展链接 |
| 67 | extLink?: string; |
| 68 | // 活动 |
| 69 | activity?: WxSphEvent; |
| 70 | }; |
| 71 | [AccountType.KWAI]?: object; |
| 72 | }; |
| 73 | |
| 74 | // 可见性 |
| 75 | export enum VisibleTypeEnum { |
| 76 | // 所有人可见 |
| 77 | Public = 1, |
| 78 | // 仅自己可见 |
| 79 | Private = 2, |
| 80 | // 好友可见 |
| 81 | Friend = 3, |
| 82 | } |
| 83 | |
| 84 | @Schema() |
| 85 | export class WorkData extends TimeTemp { |
| 86 | @Prop({ |
| 87 | required: true, |
| 88 | unique: true, |
| 89 | index: true, |
| 90 | type: Number, |
| 91 | }) |
| 92 | id: number; |
| 93 | |
| 94 | @Prop({ |
| 95 | required: false, |
| 96 | }) |
| 97 | dataId?: string; |
| 98 | |
| 99 | @Prop({ |
| 100 | required: true, |
| 101 | index: true, |
| 102 | type: String, |
| 103 | }) |
| 104 | userId: string; |
| 105 | |
| 106 | @Prop({ |
| 107 | required: false, |
| 108 | type: Date, |
| 109 | }) |
| 110 | lastStatsTime?: Date; // 最后统计时间 |
| 111 | |
| 112 | @Prop({ |
| 113 | required: false, |
| 114 | type: String, |
| 115 | }) |
| 116 | previewVideoLink: string; // 预览地址,这个值是发布完成手动拼接的 |
| 117 | |
| 118 | @Prop({ |
| 119 | required: true, |
| 120 | index: true, |
| 121 | type: Number, |
| 122 | }) |
| 123 | pubRecordId: number; // 发布记录id,对应PubRecord表id |
| 124 | |
| 125 | @Prop({ |
| 126 | required: true, |
| 127 | index: true, |
| 128 | type: Number, |
| 129 | }) |
| 130 | accountId: number; // 账号id |
| 131 | |
| 132 | @Prop({ |
| 133 | required: true, |
| 134 | enum: AccountType, |
| 135 | index: true, |
| 136 | }) |
| 137 | type: AccountType; // 平台类型 |
| 138 | |
| 139 | @Prop({ |
| 140 | required: false, |
| 141 | type: Date, |
| 142 | }) |
| 143 | publishTime?: Date; // 发布时间 |
| 144 | |
| 145 | @Prop({ |
| 146 | required: false, |
| 147 | type: Object, |
| 148 | }) |
| 149 | otherInfo?: Record<string, any>; // 其他信息 |
| 150 | |
| 151 | @Prop({ |
| 152 | required: false, |
| 153 | }) |
| 154 | failMsg?: string; // 发布失败原因(如果失败) |
| 155 | |
| 156 | @Prop({ |
| 157 | required: true, |
| 158 | enum: PubStatus, |
| 159 | default: PubStatus.UNPUBLISH, |
| 160 | }) |
| 161 | status: PubStatus; |
| 162 | |
| 163 | @Prop({ |
| 164 | required: true, |
| 165 | default: 0, |
| 166 | }) |
| 167 | readCount: number; |
| 168 | |
| 169 | @Prop({ |
| 170 | required: true, |
| 171 | default: 0, |
| 172 | }) |
| 173 | likeCount: number; |
| 174 | |
| 175 | @Prop({ |
| 176 | required: true, |
| 177 | default: 0, |
| 178 | }) |
| 179 | collectCount: number; |
| 180 | |
| 181 | @Prop({ |
| 182 | required: true, |
| 183 | default: 0, |
| 184 | }) |
| 185 | forwardCount: number; |
| 186 | |
| 187 | @Prop({ |
| 188 | required: true, |
| 189 | default: 0, |
| 190 | }) |
| 191 | commentCount: number; |
| 192 | |
| 193 | @Prop({ |
| 194 | required: true, |
| 195 | default: 0, |
| 196 | }) |
| 197 | income: number; |
| 198 | |
| 199 | // 以下为发布需要的参数 -------------------------------------------------------------------- |
| 200 | @Prop({ |
| 201 | required: false, |
| 202 | }) |
| 203 | title?: string; // 标题 |
| 204 | |
| 205 | @Prop({ |
| 206 | required: false, |
| 207 | }) |
| 208 | desc?: string; // 简介,简介中不该包含话题,如果有需要每个平台再自己做处理。 |
| 209 | |
| 210 | @Prop({ |
| 211 | required: false, |
| 212 | }) |
| 213 | coverPath?: string; // 封面路径,机器的本地路径 |
| 214 | |
| 215 | @Prop({ |
| 216 | required: false, |
| 217 | type: Object, |
| 218 | }) |
| 219 | mixInfo?: ILableValue; // 合集 |
| 220 | |
| 221 | @Prop({ |
| 222 | required: true, |
| 223 | type: [String], |
| 224 | }) |
| 225 | topics: string[]; // 话题 格式:['话题1', '话题2'],不该包含 ‘#’ |
| 226 | |
| 227 | @Prop({ |
| 228 | required: false, |
| 229 | type: Object, |
| 230 | }) |
| 231 | location?: ILocationDataItem; // 位置 |
| 232 | |
| 233 | /** |
| 234 | * 差异化参数 |
| 235 | * 所有平台有通用参数,如:标题、话题、简介 |
| 236 | * 也有每个平台自己独有的参数,如:抖音活动奖励、抖音热点、视频号声明原创 |
| 237 | */ |
| 238 | @Prop({ |
| 239 | required: false, |
| 240 | type: Object, |
| 241 | }) |
| 242 | diffParams?: DiffParmasType; |
| 243 | |
| 244 | @Prop({ |
| 245 | required: true, |
| 246 | enum: VisibleTypeEnum, |
| 247 | default: VisibleTypeEnum.Private, |
| 248 | }) |
| 249 | visibleType?: VisibleTypeEnum; |
| 250 | |
| 251 | @Prop({ |
| 252 | required: false, |
| 253 | type: Date, |
| 254 | }) |
| 255 | timingTime?: Date; // 定时发布日期 |
| 256 | |
| 257 | @Prop({ |
| 258 | required: false, |
| 259 | type: Object, |
| 260 | }) |
| 261 | cookies?: Record<string, any>; |
| 262 | } |
| 263 |