- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换 - 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片 - 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转 - 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出 - 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志 - 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票 - 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏 - 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
50 行
1.3 KiB
TypeScript
50 行
1.3 KiB
TypeScript
import { Init, Provide } from '@midwayjs/core';
|
|
import { BaseService } from '@cool-midway/core';
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { CardCasesEntity } from '../entity/cases';
|
|
|
|
/**
|
|
* 后台按名片拉取案例的参数格式
|
|
*/
|
|
export interface GetCasesByCardIdParams {
|
|
cardId: number | string;
|
|
}
|
|
|
|
/**
|
|
* 出海案例作品集服务
|
|
* 提供出海案例的标准 CRUD 及按名片筛选能力
|
|
*/
|
|
@Provide()
|
|
export class CardCasesService extends BaseService {
|
|
@InjectEntityModel(CardCasesEntity)
|
|
cardCasesEntity: Repository<CardCasesEntity>;
|
|
|
|
@Init()
|
|
async init() {
|
|
await super.init();
|
|
this.setEntity(this.cardCasesEntity);
|
|
}
|
|
|
|
/**
|
|
* 按名片 cardId 获取案例列表
|
|
* 严格按照 sortOrder 升序排列
|
|
*
|
|
* @param params 名片 ID 或对象参数
|
|
*/
|
|
async getCasesByCardId(
|
|
params: number | string | GetCasesByCardIdParams
|
|
): Promise<CardCasesEntity[]> {
|
|
const cardId = typeof params === 'object' && params !== null ? params.cardId : params;
|
|
const numericCardId = Number(cardId);
|
|
if (!numericCardId) {
|
|
return [];
|
|
}
|
|
|
|
return this.cardCasesEntity.find({
|
|
where: { cardId: numericCardId },
|
|
order: { sortOrder: 'ASC', id: 'DESC' },
|
|
});
|
|
}
|
|
}
|