feat(ops): v4.0.2 活动图模板、合伙人选择持久化与用户管理主图

HQ 上传底图与码栏;合伙人单选写入 partner_account.activity_poster_id,用户管理下次登录仍显示同一张图。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-30 21:36:43 +08:00
parent 0ff61c2cd1
commit 3166467518
39 changed files with 1872 additions and 35 deletions
@@ -0,0 +1,37 @@
-- v4.0.2:活动图模板(底图 + 方形码栏 + 文案)
ALTER TABLE `common_resource`
MODIFY COLUMN `biz_type` ENUM(
'COVER',
'ENV',
'CONTRACT',
'CAROUSEL',
'DETAIL',
'AVATAR',
'QRCODE',
'SIGN_PHOTO',
'VIDEO',
'REDEEM_PENDING_PHOTO',
'ACTIVITY_POSTER'
) NOT NULL;
CREATE TABLE IF NOT EXISTS `activity_poster` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(128) NOT NULL,
`copy_text` TEXT NOT NULL,
`image_url` VARCHAR(512) NOT NULL,
`qr_x_pct` DECIMAL(5,2) NOT NULL,
`qr_y_pct` DECIMAL(5,2) NOT NULL,
`qr_size_pct` DECIMAL(5,2) NOT NULL,
`sort_order` INT NOT NULL DEFAULT 0,
`status` VARCHAR(16) NOT NULL DEFAULT 'ACTIVE',
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`),
KEY `idx_activity_poster_status_sort` (`status`, `sort_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HQ 活动图模板';
INSERT IGNORE INTO `hq_role_permission` (`admin_role`, `permission_key`)
SELECT 'OPS', 'activity_posters'
FROM DUAL
WHERE EXISTS (SELECT 1 FROM `hq_role_permission` WHERE `admin_role` = 'OPS');
@@ -0,0 +1,9 @@
-- v4.0.2:主合伙人记住所选活动图(空=仅二维码)
ALTER TABLE `partner_account`
ADD COLUMN `activity_poster_id` BIGINT UNSIGNED DEFAULT NULL AFTER `assoc_qrcode_resource_id`,
ADD KEY `idx_partner_account_activity_poster` (`activity_poster_id`);
ALTER TABLE `partner_account`
ADD CONSTRAINT `fk_partner_account_activity_poster`
FOREIGN KEY (`activity_poster_id`) REFERENCES `activity_poster`(`id`) ON DELETE SET NULL;
+24
View File
@@ -44,6 +44,7 @@ enum ResourceBizType {
SIGN_PHOTO
VIDEO
REDEEM_PENDING_PHOTO
ACTIVITY_POSTER
}
enum RedeemPendingStatus {
@@ -1204,6 +1205,7 @@ model PartnerAccount {
managedWarehouseId BigInt? @unique @map("managed_warehouse_id") @db.UnsignedBigInt
assocQrcodeId String? @unique @map("assoc_qrcode_id") @db.VarChar(64)
assocQrcodeResourceId BigInt? @map("assoc_qrcode_resource_id") @db.UnsignedBigInt
activityPosterId BigInt? @map("activity_poster_id") @db.UnsignedBigInt
/// 测试合伙人账号
isTest Boolean @default(false) @map("is_test")
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
@@ -1219,6 +1221,7 @@ model PartnerAccount {
assocUsers User[] @relation("UserPartnerAssoc")
userNotes PartnerUserNote[]
assocQrcodeResource CommonResource? @relation("PartnerAssocQrcode", fields: [assocQrcodeResourceId], references: [id], onDelete: SetNull)
activityPoster ActivityPoster? @relation(fields: [activityPosterId], references: [id], onDelete: SetNull)
@@index([cityId, scopeType])
@@index([cityId, isPrimary])
@@ -1226,6 +1229,7 @@ model PartnerAccount {
@@index([wxOpenId])
@@index([contactPhone])
@@index([isTest])
@@index([activityPosterId])
@@map("partner_account")
}
@@ -1246,6 +1250,26 @@ model PartnerUserNote {
@@map("partner_user_note")
}
/// HQ 活动图模板:底图 + 方形码栏(相对百分比)+ 文案
model ActivityPoster {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
title String @db.VarChar(128)
copyText String @map("copy_text") @db.Text
imageUrl String @map("image_url") @db.VarChar(512)
qrXPct Decimal @map("qr_x_pct") @db.Decimal(5, 2)
qrYPct Decimal @map("qr_y_pct") @db.Decimal(5, 2)
qrSizePct Decimal @map("qr_size_pct") @db.Decimal(5, 2)
sortOrder Int @default(0) @map("sort_order")
status String @default("ACTIVE") @db.VarChar(16)
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
selectedByPartners PartnerAccount[]
@@index([status, sortOrder])
@@map("activity_poster")
}
model PartnerBill {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
billNo String @unique @map("bill_no") @db.VarChar(32)