mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-26 03:54:25 +08:00
重构初始化
This commit is contained in:
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',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user