mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-23 02:24:27 +08:00
重构初始化
This commit is contained in:
41
app/model/admin/AdminUser.php
Normal file
41
app/model/admin/AdminUser.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 管理员账号模型。
|
||||
* 表示后台管理员基础资料,不承载登录 token。
|
||||
*/
|
||||
class AdminUser extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_admin_user';
|
||||
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'password_hash',
|
||||
'real_name',
|
||||
'mobile',
|
||||
'email',
|
||||
'is_super',
|
||||
'status',
|
||||
'last_login_at',
|
||||
'last_login_ip',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password_hash',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_super' => 'integer',
|
||||
'status' => 'integer',
|
||||
'last_login_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
48
app/model/admin/ChannelDailyStat.php
Normal file
48
app/model/admin/ChannelDailyStat.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 通道日统计模型。
|
||||
* 用于路由健康度、成功率和耗时统计。
|
||||
*/
|
||||
class ChannelDailyStat extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_channel_daily_stat';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'channel_id',
|
||||
'stat_date',
|
||||
'pay_success_count',
|
||||
'pay_fail_count',
|
||||
'pay_amount',
|
||||
'refund_count',
|
||||
'refund_amount',
|
||||
'avg_latency_ms',
|
||||
'success_rate_bp',
|
||||
'health_score',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'pay_success_count' => 'integer',
|
||||
'pay_fail_count' => 'integer',
|
||||
'pay_amount' => 'integer',
|
||||
'refund_count' => 'integer',
|
||||
'refund_amount' => 'integer',
|
||||
'avg_latency_ms' => 'integer',
|
||||
'success_rate_bp' => 'integer',
|
||||
'health_score' => 'integer',
|
||||
'stat_date' => 'date',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
47
app/model/admin/ChannelNotifyLog.php
Normal file
47
app/model/admin/ChannelNotifyLog.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 渠道通知日志模型。
|
||||
* 用于记录异步通知、查单请求和去重处理结果。
|
||||
*/
|
||||
class ChannelNotifyLog extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_channel_notify_log';
|
||||
|
||||
protected $fillable = [
|
||||
'notify_no',
|
||||
'channel_id',
|
||||
'notify_type',
|
||||
'biz_no',
|
||||
'pay_no',
|
||||
'channel_request_no',
|
||||
'channel_trade_no',
|
||||
'raw_payload',
|
||||
'verify_status',
|
||||
'process_status',
|
||||
'retry_count',
|
||||
'next_retry_at',
|
||||
'last_error',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'raw_payload',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'channel_id' => 'integer',
|
||||
'notify_type' => 'integer',
|
||||
'verify_status' => 'integer',
|
||||
'process_status' => 'integer',
|
||||
'retry_count' => 'integer',
|
||||
'next_retry_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
41
app/model/admin/PayCallbackLog.php
Normal file
41
app/model/admin/PayCallbackLog.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付回调日志模型。
|
||||
* 用于记录同步和异步回调原始报文和处理结果。
|
||||
*/
|
||||
class PayCallbackLog extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_callback_log';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'pay_no',
|
||||
'channel_id',
|
||||
'callback_type',
|
||||
'request_data',
|
||||
'verify_status',
|
||||
'process_status',
|
||||
'process_result',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'request_data',
|
||||
'process_result',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'channel_id' => 'integer',
|
||||
'callback_type' => 'integer',
|
||||
'verify_status' => 'integer',
|
||||
'process_status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
43
app/model/file/FileRecord.php
Normal file
43
app/model/file/FileRecord.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\file;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 文件记录模型。
|
||||
*/
|
||||
class FileRecord extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_file_asset';
|
||||
|
||||
protected $fillable = [
|
||||
'scene',
|
||||
'source_type',
|
||||
'visibility',
|
||||
'storage_engine',
|
||||
'original_name',
|
||||
'file_name',
|
||||
'file_ext',
|
||||
'mime_type',
|
||||
'size',
|
||||
'md5',
|
||||
'object_key',
|
||||
'url',
|
||||
'source_url',
|
||||
'created_by',
|
||||
'created_by_name',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'scene' => 'integer',
|
||||
'source_type' => 'integer',
|
||||
'visibility' => 'integer',
|
||||
'storage_engine' => 'integer',
|
||||
'size' => 'integer',
|
||||
'created_by' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
51
app/model/merchant/Merchant.php
Normal file
51
app/model/merchant/Merchant.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户基础资料模型。
|
||||
* 仅承载商户身份、联系信息、结算信息和启停状态,不承载资金余额。
|
||||
*/
|
||||
class Merchant extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_no',
|
||||
'password_hash',
|
||||
'merchant_name',
|
||||
'merchant_short_name',
|
||||
'merchant_type',
|
||||
'group_id',
|
||||
'risk_level',
|
||||
'contact_name',
|
||||
'contact_phone',
|
||||
'contact_email',
|
||||
'settlement_account_name',
|
||||
'settlement_account_no',
|
||||
'settlement_bank_name',
|
||||
'settlement_bank_branch',
|
||||
'status',
|
||||
'last_login_at',
|
||||
'last_login_ip',
|
||||
'password_updated_at',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password_hash',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_type' => 'integer',
|
||||
'group_id' => 'integer',
|
||||
'risk_level' => 'integer',
|
||||
'status' => 'integer',
|
||||
'last_login_at' => 'datetime',
|
||||
'password_updated_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
28
app/model/merchant/MerchantAccount.php
Normal file
28
app/model/merchant/MerchantAccount.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户余额账户模型。
|
||||
* 仅保存可提现余额、冻结余额和时间戳。
|
||||
*/
|
||||
class MerchantAccount extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_account';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'available_balance',
|
||||
'frozen_balance',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'available_balance' => 'integer',
|
||||
'frozen_balance' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
50
app/model/merchant/MerchantAccountLedger.php
Normal file
50
app/model/merchant/MerchantAccountLedger.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户余额流水模型。
|
||||
* 所有余额变动都必须落流水,便于审计、对账和幂等控制。
|
||||
*/
|
||||
class MerchantAccountLedger extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_account_ledger';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'ledger_no',
|
||||
'merchant_id',
|
||||
'biz_type',
|
||||
'biz_no',
|
||||
'trace_no',
|
||||
'event_type',
|
||||
'direction',
|
||||
'amount',
|
||||
'available_before',
|
||||
'available_after',
|
||||
'frozen_before',
|
||||
'frozen_after',
|
||||
'idempotency_key',
|
||||
'remark',
|
||||
'ext_json',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'biz_type' => 'integer',
|
||||
'event_type' => 'integer',
|
||||
'direction' => 'integer',
|
||||
'amount' => 'integer',
|
||||
'available_before' => 'integer',
|
||||
'available_after' => 'integer',
|
||||
'frozen_before' => 'integer',
|
||||
'frozen_after' => 'integer',
|
||||
'ext_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
35
app/model/merchant/MerchantApiCredential.php
Normal file
35
app/model/merchant/MerchantApiCredential.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户对外接口凭证模型。
|
||||
* 保存商户接口凭证、签名类型、启用状态和最近使用时间。
|
||||
*/
|
||||
class MerchantApiCredential extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_api_credential';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'sign_type',
|
||||
'api_key',
|
||||
'status',
|
||||
'last_used_at',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'api_key',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'sign_type' => 'integer',
|
||||
'status' => 'integer',
|
||||
'last_used_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
27
app/model/merchant/MerchantGroup.php
Normal file
27
app/model/merchant/MerchantGroup.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户分组模型。
|
||||
* 用于路由编排、策略绑定和通道分配。
|
||||
*/
|
||||
class MerchantGroup extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_group';
|
||||
|
||||
protected $fillable = [
|
||||
'group_name',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
41
app/model/merchant/MerchantPolicy.php
Normal file
41
app/model/merchant/MerchantPolicy.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\merchant;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户策略模型。
|
||||
* 维护商户级覆盖策略,例如结算周期、自动处理和路由策略。
|
||||
*/
|
||||
class MerchantPolicy extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_policy';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'settlement_cycle_override',
|
||||
'auto_payout',
|
||||
'min_settlement_amount',
|
||||
'retry_policy_json',
|
||||
'route_policy_json',
|
||||
'fee_rule_override_json',
|
||||
'risk_policy_json',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'settlement_cycle_override' => 'integer',
|
||||
'auto_payout' => 'integer',
|
||||
'min_settlement_amount' => 'integer',
|
||||
'retry_policy_json' => 'array',
|
||||
'route_policy_json' => 'array',
|
||||
'fee_rule_override_json' => 'array',
|
||||
'risk_policy_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
58
app/model/payment/BizOrder.php
Normal file
58
app/model/payment/BizOrder.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 业务订单模型。
|
||||
* 表示商户业务侧原始订单,支付单和退款单都从这里展开。
|
||||
*/
|
||||
class BizOrder extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_biz_order';
|
||||
|
||||
protected $fillable = [
|
||||
'biz_no',
|
||||
'trace_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'poll_group_id',
|
||||
'merchant_order_no',
|
||||
'subject',
|
||||
'body',
|
||||
'order_amount',
|
||||
'paid_amount',
|
||||
'refund_amount',
|
||||
'status',
|
||||
'active_pay_no',
|
||||
'attempt_count',
|
||||
'expire_at',
|
||||
'paid_at',
|
||||
'closed_at',
|
||||
'failed_at',
|
||||
'timeout_at',
|
||||
'ext_json',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'poll_group_id' => 'integer',
|
||||
'order_amount' => 'integer',
|
||||
'paid_amount' => 'integer',
|
||||
'refund_amount' => 'integer',
|
||||
'status' => 'integer',
|
||||
'attempt_count' => 'integer',
|
||||
'expire_at' => 'datetime',
|
||||
'paid_at' => 'datetime',
|
||||
'closed_at' => 'datetime',
|
||||
'failed_at' => 'datetime',
|
||||
'timeout_at' => 'datetime',
|
||||
'ext_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
47
app/model/payment/NotifyTask.php
Normal file
47
app/model/payment/NotifyTask.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户通知任务模型。
|
||||
* 保存通知重试队列、最后一次响应和下一次重试时间。
|
||||
*/
|
||||
class NotifyTask extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_notify_task';
|
||||
|
||||
protected $fillable = [
|
||||
'notify_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'biz_no',
|
||||
'pay_no',
|
||||
'notify_url',
|
||||
'notify_data',
|
||||
'status',
|
||||
'retry_count',
|
||||
'next_retry_at',
|
||||
'last_notify_at',
|
||||
'last_response',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'notify_data',
|
||||
'last_response',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
'retry_count' => 'integer',
|
||||
'next_retry_at' => 'datetime',
|
||||
'last_notify_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
83
app/model/payment/PayOrder.php
Normal file
83
app/model/payment/PayOrder.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付单模型。
|
||||
* 表示一次具体支付尝试,包含通道、状态、手续费快照和回调状态。
|
||||
*/
|
||||
class PayOrder extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_order';
|
||||
|
||||
protected $fillable = [
|
||||
'pay_no',
|
||||
'biz_no',
|
||||
'trace_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'poll_group_id',
|
||||
'attempt_no',
|
||||
'channel_id',
|
||||
'pay_type_id',
|
||||
'plugin_code',
|
||||
'channel_type',
|
||||
'channel_mode',
|
||||
'pay_amount',
|
||||
'fee_rate_bp_snapshot',
|
||||
'split_rate_bp_snapshot',
|
||||
'fee_estimated_amount',
|
||||
'fee_actual_amount',
|
||||
'status',
|
||||
'fee_status',
|
||||
'settlement_status',
|
||||
'channel_request_no',
|
||||
'channel_order_no',
|
||||
'channel_trade_no',
|
||||
'channel_error_code',
|
||||
'channel_error_msg',
|
||||
'request_at',
|
||||
'paid_at',
|
||||
'expire_at',
|
||||
'closed_at',
|
||||
'failed_at',
|
||||
'timeout_at',
|
||||
'callback_status',
|
||||
'callback_times',
|
||||
'ext_json',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'poll_group_id' => 'integer',
|
||||
'attempt_no' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'pay_type_id' => 'integer',
|
||||
'channel_type' => 'integer',
|
||||
'channel_mode' => 'integer',
|
||||
'pay_amount' => 'integer',
|
||||
'fee_rate_bp_snapshot' => 'integer',
|
||||
'split_rate_bp_snapshot' => 'integer',
|
||||
'fee_estimated_amount' => 'integer',
|
||||
'fee_actual_amount' => 'integer',
|
||||
'status' => 'integer',
|
||||
'fee_status' => 'integer',
|
||||
'settlement_status' => 'integer',
|
||||
'request_at' => 'datetime',
|
||||
'paid_at' => 'datetime',
|
||||
'expire_at' => 'datetime',
|
||||
'closed_at' => 'datetime',
|
||||
'failed_at' => 'datetime',
|
||||
'timeout_at' => 'datetime',
|
||||
'callback_status' => 'integer',
|
||||
'callback_times' => 'integer',
|
||||
'ext_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
51
app/model/payment/PaymentChannel.php
Normal file
51
app/model/payment/PaymentChannel.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付通道模型。
|
||||
* 承载通道成本、分成、限额、启停状态和通道模式。
|
||||
*/
|
||||
class PaymentChannel extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_channel';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'name',
|
||||
'split_rate_bp',
|
||||
'cost_rate_bp',
|
||||
'channel_mode',
|
||||
'pay_type_id',
|
||||
'plugin_code',
|
||||
'api_config_id',
|
||||
'daily_limit_amount',
|
||||
'daily_limit_count',
|
||||
'min_amount',
|
||||
'max_amount',
|
||||
'remark',
|
||||
'status',
|
||||
'sort_no',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'split_rate_bp' => 'integer',
|
||||
'cost_rate_bp' => 'integer',
|
||||
'channel_mode' => 'integer',
|
||||
'pay_type_id' => 'integer',
|
||||
'api_config_id' => 'integer',
|
||||
'daily_limit_amount' => 'integer',
|
||||
'daily_limit_count' => 'integer',
|
||||
'min_amount' => 'integer',
|
||||
'max_amount' => 'integer',
|
||||
'status' => 'integer',
|
||||
'sort_no' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
45
app/model/payment/PaymentPlugin.php
Normal file
45
app/model/payment/PaymentPlugin.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付插件模型。
|
||||
* 插件编码使用字符串主键 code,负责描述第三方支付实现能力。
|
||||
*/
|
||||
class PaymentPlugin extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_plugin';
|
||||
|
||||
protected $primaryKey = 'code';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'class_name',
|
||||
'config_schema',
|
||||
'pay_types',
|
||||
'transfer_types',
|
||||
'version',
|
||||
'author',
|
||||
'link',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'config_schema' => 'array',
|
||||
'pay_types' => 'array',
|
||||
'transfer_types' => 'array',
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
31
app/model/payment/PaymentPluginConf.php
Normal file
31
app/model/payment/PaymentPluginConf.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付插件配置模型。
|
||||
* 保存插件初始化参数和默认结算周期等配置。
|
||||
*/
|
||||
class PaymentPluginConf extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_plugin_conf';
|
||||
|
||||
protected $fillable = [
|
||||
'plugin_code',
|
||||
'config',
|
||||
'settlement_cycle_type',
|
||||
'settlement_cutoff_time',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'config' => 'array',
|
||||
'settlement_cycle_type' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
31
app/model/payment/PaymentPollGroup.php
Normal file
31
app/model/payment/PaymentPollGroup.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付轮询组模型。
|
||||
* 用于将支付方式映射到一组可路由通道。
|
||||
*/
|
||||
class PaymentPollGroup extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_poll_group';
|
||||
|
||||
protected $fillable = [
|
||||
'group_name',
|
||||
'pay_type_id',
|
||||
'route_mode',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'pay_type_id' => 'integer',
|
||||
'route_mode' => 'integer',
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
33
app/model/payment/PaymentPollGroupBind.php
Normal file
33
app/model/payment/PaymentPollGroupBind.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户分组与轮询组绑定模型。
|
||||
* 用于确定某商户分组在某支付方式下的默认路由组。
|
||||
*/
|
||||
class PaymentPollGroupBind extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_poll_group_bind';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_group_id',
|
||||
'pay_type_id',
|
||||
'poll_group_id',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_group_id' => 'integer',
|
||||
'pay_type_id' => 'integer',
|
||||
'poll_group_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
37
app/model/payment/PaymentPollGroupChannel.php
Normal file
37
app/model/payment/PaymentPollGroupChannel.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 轮询组与通道编排模型。
|
||||
* 定义组内通道顺序、权重和默认通道。
|
||||
*/
|
||||
class PaymentPollGroupChannel extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_poll_group_channel';
|
||||
|
||||
protected $fillable = [
|
||||
'poll_group_id',
|
||||
'channel_id',
|
||||
'sort_no',
|
||||
'weight',
|
||||
'is_default',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'poll_group_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'sort_no' => 'integer',
|
||||
'weight' => 'integer',
|
||||
'is_default' => 'integer',
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
32
app/model/payment/PaymentType.php
Normal file
32
app/model/payment/PaymentType.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付方式字典模型。
|
||||
* 用于维护支付方式编码、名称、排序和启停状态。
|
||||
*/
|
||||
class PaymentType extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_payment_type';
|
||||
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'icon',
|
||||
'sort_no',
|
||||
'status',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'sort_no' => 'integer',
|
||||
'status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
57
app/model/payment/RefundOrder.php
Normal file
57
app/model/payment/RefundOrder.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 退款单模型。
|
||||
* 当前按整单全额退款设计,因此同一支付单只允许一张退款单。
|
||||
*/
|
||||
class RefundOrder extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_refund_order';
|
||||
|
||||
protected $fillable = [
|
||||
'refund_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'biz_no',
|
||||
'trace_no',
|
||||
'pay_no',
|
||||
'merchant_refund_no',
|
||||
'channel_id',
|
||||
'refund_amount',
|
||||
'fee_reverse_amount',
|
||||
'status',
|
||||
'channel_request_no',
|
||||
'channel_refund_no',
|
||||
'reason',
|
||||
'request_at',
|
||||
'processing_at',
|
||||
'succeeded_at',
|
||||
'failed_at',
|
||||
'retry_count',
|
||||
'last_error',
|
||||
'ext_json',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'refund_amount' => 'integer',
|
||||
'fee_reverse_amount' => 'integer',
|
||||
'status' => 'integer',
|
||||
'request_at' => 'datetime',
|
||||
'processing_at' => 'datetime',
|
||||
'succeeded_at' => 'datetime',
|
||||
'failed_at' => 'datetime',
|
||||
'retry_count' => 'integer',
|
||||
'ext_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
45
app/model/payment/SettlementItem.php
Normal file
45
app/model/payment/SettlementItem.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 清算明细模型。
|
||||
* 用于记录清算单下每笔支付订单的入账结果。
|
||||
*/
|
||||
class SettlementItem extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_settlement_item';
|
||||
|
||||
protected $fillable = [
|
||||
'settle_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'channel_id',
|
||||
'pay_no',
|
||||
'refund_no',
|
||||
'pay_amount',
|
||||
'fee_amount',
|
||||
'refund_amount',
|
||||
'fee_reverse_amount',
|
||||
'net_amount',
|
||||
'item_status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'pay_amount' => 'integer',
|
||||
'fee_amount' => 'integer',
|
||||
'refund_amount' => 'integer',
|
||||
'fee_reverse_amount' => 'integer',
|
||||
'net_amount' => 'integer',
|
||||
'item_status' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
60
app/model/payment/SettlementOrder.php
Normal file
60
app/model/payment/SettlementOrder.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\payment;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 清算单模型。
|
||||
* 平台代收链路清算成功后将资金转入可提现余额。
|
||||
*/
|
||||
class SettlementOrder extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_settlement_order';
|
||||
|
||||
protected $fillable = [
|
||||
'settle_no',
|
||||
'trace_no',
|
||||
'merchant_id',
|
||||
'merchant_group_id',
|
||||
'channel_id',
|
||||
'cycle_type',
|
||||
'cycle_key',
|
||||
'status',
|
||||
'gross_amount',
|
||||
'fee_amount',
|
||||
'refund_amount',
|
||||
'fee_reverse_amount',
|
||||
'net_amount',
|
||||
'accounted_amount',
|
||||
'generated_at',
|
||||
'accounted_at',
|
||||
'completed_at',
|
||||
'failed_at',
|
||||
'fail_reason',
|
||||
'ext_json',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_group_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'cycle_type' => 'integer',
|
||||
'status' => 'integer',
|
||||
'gross_amount' => 'integer',
|
||||
'fee_amount' => 'integer',
|
||||
'refund_amount' => 'integer',
|
||||
'fee_reverse_amount' => 'integer',
|
||||
'net_amount' => 'integer',
|
||||
'accounted_amount' => 'integer',
|
||||
'generated_at' => 'datetime',
|
||||
'accounted_at' => 'datetime',
|
||||
'completed_at' => 'datetime',
|
||||
'failed_at' => 'datetime',
|
||||
'ext_json' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
32
app/model/system/SystemConfig.php
Normal file
32
app/model/system/SystemConfig.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\model\system;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 系统配置模型。
|
||||
* 适合全局开关、默认策略和运行时参数。
|
||||
*/
|
||||
class SystemConfig extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_system_config';
|
||||
|
||||
protected $primaryKey = 'config_key';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'config_key',
|
||||
'group_code',
|
||||
'config_value',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user