定制 tourze/prepaid-card-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/prepaid-card-bundle

Composer 安装命令:

composer require tourze/prepaid-card-bundle

包简介

Symfony bundle for prepaid card management system

README 文档

README

PHP Version License Build Status Code Coverage

English | 中文

Prepaid card management module - Provides functionality for creating, consuming, balance management and expiration handling of prepaid cards

Features

  • Prepaid Card Management - Create, activate, recharge, and consume prepaid cards
  • Balance Management - Real-time balance queries and consumption tracking
  • Expiration Handling - Automatic checking and processing of expired cards
  • Consumption Records - Detailed consumption history tracking
  • Contract Management - Prepaid order and contract association
  • Multiple Card Types - Support for one-time payment and deposit settlement
  • Automated Tasks - Scheduled expiration checks and status updates

Installation

composer require tourze/prepaid-card-bundle

Main Entities

Card (Prepaid Card)

  • Card number and password management
  • Face value and balance tracking
  • Status management (valid/expired/insufficient balance)
  • Activation time and expiration time

Consumption (Consumption Record)

  • Consumption title and amount
  • Associated order ID
  • Refundable amount management
  • Creation time and IP logging

Contract (Prepaid Contract)

  • Prepaid order management
  • Cost tracking
  • Refund processing
  • Consumption record association

Console Commands

prepaid-card:expire-check

Automatically check and handle expired prepaid cards

php bin/console prepaid-card:expire-check

Features:

  • Check cards with expired time and update status to EXPIRED
  • Check cards with zero balance and update status to EMPTY
  • Process up to 500 cards per batch
  • Automatically executed on schedule (runs every minute)

Processing Logic:

  1. Find cards with status VALID and expired time passed
  2. Update these cards' status to EXPIRED
  3. Find cards with status VALID and balance ≤ 0
  4. Update these cards' status to EMPTY

Usage

Basic Usage

use PrepaidCardBundle\Service\PrepaidCardService;

// Inject service
private PrepaidCardService $prepaidCardService;

// Check if balance is sufficient
if ($this->prepaidCardService->hasEnoughBalance($card, $amount)) {
    // Execute consumption
    $this->prepaidCardService->consume($card, $amount, $title);
}

Card Status Management

use PrepaidCardBundle\Enum\PrepaidCardStatus;

// Check card status
if ($card->getStatus() === PrepaidCardStatus::VALID) {
    // Card is valid and can be used
}

Card Types

use PrepaidCardBundle\Enum\PrepaidCardType;

// One-time full payment
$card->setType(PrepaidCardType::ONE_TIME);

// Deposit with later settlement
$card->setType(PrepaidCardType::AFTER);

Configuration

Configure in config/packages/prepaid_card.yaml:

# Prepaid card module configuration
prepaid_card:
    # Expiration check frequency (cron expression)
    expire_check_cron: '* * * * *'
    # Maximum number of cards processed per batch
    batch_size: 500

Database Schema

  • ims_prepaid_card - Main prepaid card table
  • ims_prepaid_consumption - Consumption record table
  • ims_prepaid_contract - Prepaid contract table
  • ims_prepaid_company - Card issuing company table
  • ims_prepaid_package - Card package table
  • ims_prepaid_campaign - Marketing campaign table

Enum Types

PrepaidCardStatus (Card Status)

  • VALID - Valid
  • EXPIRED - Expired
  • EMPTY - Insufficient balance
  • INACTIVE - Not activated

PrepaidCardType (Card Type)

  • ONE_TIME - One-time full payment
  • AFTER - Deposit with later settlement

PrepaidCardExpireType (Expiration Type)

  • SAME_WITH_CARD - Same as card validity period
  • AFTER_ACTIVATION - After activation

Events and Listeners

The module provides the following events:

  • Card creation event
  • Consumption record creation event
  • Balance change event
  • Status change event

Extensibility

You can extend functionality through:

  • Implementing custom card types
  • Adding additional consumption validation rules
  • Customizing expiration handling logic
  • Integrating third-party payment systems

Reference Documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

tourze/prepaid-card-bundle 适用场景与选型建议

tourze/prepaid-card-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tourze/prepaid-card-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tourze/prepaid-card-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tourze/prepaid-card-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-18