import type { PageParam } from '@/api'; /** * 订阅状态: pending-待支付 active-已激活 expired-已过期 cancelled-已取消 */ export type SubscriptionStatus = | 'pending' | 'active' | 'expired' | 'cancelled'; /** * 价格类型: free-免费 one_time-买断 subscription-订阅 */ export type PriceType = 'free' | 'one_time' | 'subscription'; /** * 订阅周期: month-月 quarter-季 year-年 */ export type SubscriptionPeriod = 'month' | 'quarter' | 'year'; /** * 支付方式: 0-余额 1-微信 2-支付宝 12-免费 */ export type PayType = 0 | 1 | 2 | 12; /** * 应用订阅实体(对应表 app_subscription) * 字段对照后端 com.gxwebsoft.app.entity.AppSubscription */ export interface AppSubscription { // 主键ID id?: number; // 订阅编号(业务唯一) subscriptionNo?: string; // 购买用户ID userId?: number; // 应用产品ID productId?: number; // 租户ID tenantId?: number; // 订阅状态 status?: SubscriptionStatus; // 价格类型 priceType?: PriceType; // 原价(单位:元) originalPrice?: number; // 实付金额(单位:元) payPrice?: number; // 支付方式 payType?: PayType; // 支付状态: 0-未支付 1-已支付 payStatus?: number; // 支付时间 payTime?: string; // 第三方交易号 transactionId?: string; // 订阅周期 subscriptionPeriod?: SubscriptionPeriod; // 生效时间 startTime?: string; // 到期时间(订阅型) expireTime?: string; // 是否自动续费 0-否 1-是 autoRenew?: number; // 分配的域名 instanceDomain?: string; // 实例管理后台URL instanceAdminUrl?: string; // 实例配置(JSON) instanceConfig?: string; // 关联的支付订单号 orderNo?: string; // 关联的支付订单ID orderId?: number; // 备注 remark?: string; // 排序 sortNumber?: number; // 创建时间 createTime?: string; // 更新时间 updateTime?: string; // ===== 关联查询字段(非数据库字段) ===== productName?: string; productIcon?: string; productLogo?: string; productAppType?: number; productDescription?: string; developerName?: string; } /** * 我的订阅分页查询参数 */ export interface AppSubscriptionQueryParam extends PageParam { // 订阅状态过滤 status?: SubscriptionStatus; } /** * 创建订阅参数 */ export interface SubscribeParam { // 应用产品ID productId: number; // 订阅周期,默认 month subscriptionPeriod?: SubscriptionPeriod; } /** * 生成支付小程序码参数 */ export interface GeneratePayQrcodeParam { // 应用产品ID productId: number; // 订阅周期,默认 month subscriptionPeriod?: SubscriptionPeriod; // 小程序版本:develop / trial / release,默认 trial envVersion?: string; } /** * 创建订阅返回结果 */ export interface SubscribeResult { subscriptionId: number; subscriptionNo: string; status: SubscriptionStatus; message: string; payPrice?: number; orderNo?: string; } /** * 生成支付小程序码返回结果 */ export interface GeneratePayQrcodeResult { subscriptionNo: string; subscriptionId: number; qrcodeBase64: string; productName: string; payPrice: number; } /** * 查询支付状态返回结果 */ export interface CheckStatusResult { paid: boolean; payStatus: number; status: SubscriptionStatus; payTime?: string; transactionId?: string; id: number; subscriptionNo: string; productId: number; productName?: string; productLogo?: string; priceType?: PriceType; payPrice?: number; subscriptionPeriod?: SubscriptionPeriod; } /** * 余额支付返回结果 */ export interface PayResult { paid: boolean; balance?: number; subscriptionNo: string; } /** * 微信 Native 支付(Web 端)返回结果 */ export interface WechatNativePayResult { subscriptionId: number; subscriptionNo: string; miniappQrcode: string; miniappPagePath: string; payPrice: number; } /** * 小程序 JSAPI 预支付返回结果 */ export interface MpPrepayResult { subscriptionId: number; subscriptionNo: string; outTradeNo: string; timeStamp: string; nonceStr: string; package: string; signType: string; paySign: string; payPrice: number; } /** * 获取余额返回结果 */ export interface BalanceResult { balance: number; } /** * 小程序预支付参数 */ export interface MpPrepayParam { openid: string; } /** * 小程序支付确认参数 */ export interface MpConfirmParam { transactionId?: string; }