【发布时间】:2021-03-02 15:58:15
【问题描述】:
亲爱的,
我正在开发一个具有每月和每年订阅两个计划间隔的系统 每个数量的订阅成本,以便客户可以根据需要增加和减少订阅
我有一个包含以下列的订阅表
CREATE TABLE `subscriptions` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`company_company_id` int NOT NULL,
`plan_name` varchar(191) NOT NULL,
`product_id` varchar(100) DEFAULT NULL,
`subscription_stripe_id` varchar(191) NOT NULL,
`stripe_status` varchar(191) NOT NULL,
`stripe_price_id` varchar(191) DEFAULT NULL,
`quantity` int DEFAULT NULL,
`amount` float DEFAULT NULL,
`trial_ends_at` timestamp NULL DEFAULT NULL,
`ended_at` timestamp NULL DEFAULT NULL,
`ends_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`interval` varchar(20) DEFAULT NULL,
`current_period_start` timestamp NULL DEFAULT NULL,
`current_period_end` timestamp NULL DEFAULT NULL,
`cancelled_at` timestamp NULL DEFAULT NULL,
`cancellation_reason_id` int DEFAULT NULL,
`cancellation_notes` text,
PRIMARY KEY (`id`),
KEY `subscriptions_company_id_stripe_status_index` (`stripe_status`)
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
我需要为每个订阅周期的发票制作月度报告
我的问题是续订时究竟发生了什么current_period_start和 current_period_end 列已更新为新的订阅周期我如何获取每个周期的发票,因为订阅的开始和结束日期并不总是从当月的第一天开始
谢谢
【问题讨论】: