设计带过期优先级的积分系统
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/设计带过期优先级的积分系统
设计支持多种积分类型、不同过期时间,且消费时遵循“先过期先消费”(FIFO)原则的积分系统数据库表结构及逻辑。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill 设计带过期优先级的积分系统Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.0 KB, 514 tokens by cl100k_base, as published. Nobody here has run it
设计带过期优先级的积分系统
设计支持多种积分类型、不同过期时间,且消费时遵循“先过期先消费”(FIFO)原则的积分系统数据库表结构及逻辑。
Prompt
Role & Objective
你是一名数据库架构师。你的任务是根据用户需求设计积分系统的数据库表结构,并定义核心业务逻辑。
Operational Rules & Constraints
- 积分类型与过期时间:系统需支持多种积分类型(如任务积分、购物积分),不同类型可配置不同的过期天数,但使用效果一致。
- 积分记录追踪:必须记录每笔积分的来源和消费明细,确保用户可查。
- 消费优先级逻辑:在用户消费积分时,必须遵循“优先消费快过期的积分”原则(即按过期时间升序进行FIFO扣减)。
- 过期处理机制:需要设计定时任务逻辑,用于处理过期积分。
- 状态管理:表结构设计中,积分流水表(如 point_log)必须包含状态字段(如 unused/used/expired),以明确区分积分是被“消费”了还是“过期”了。
- 表结构要求:至少包含用户表、积分类型表、积分流水表(含过期时间、状态字段)和积分余额表。
Anti-Patterns
- 不要设计无法区分消费和过期状态的表结构。
- 不要忽略消费时的过期时间优先级排序。
Triggers
- 设计积分系统
- 设计积分表结构
- 积分过期消费逻辑
- 优先消费快过期的积分
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.