mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-22 18:14:27 +08:00
更新数据库结构
This commit is contained in:
36
app/models/Admin.php
Normal file
36
app/models/Admin.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 管理员模型
|
||||
*
|
||||
* 对应表:ma_admin
|
||||
*/
|
||||
class Admin extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_admin';
|
||||
|
||||
protected $fillable = [
|
||||
'user_name',
|
||||
'password',
|
||||
'nick_name',
|
||||
'avatar',
|
||||
'mobile',
|
||||
'email',
|
||||
'status',
|
||||
'login_ip',
|
||||
'login_at',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'status' => 'integer',
|
||||
'login_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $hidden = ['password'];
|
||||
}
|
||||
27
app/models/Merchant.php
Normal file
27
app/models/Merchant.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户模型
|
||||
*/
|
||||
class Merchant extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_no',
|
||||
'merchant_name',
|
||||
'funds_mode',
|
||||
'status',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
30
app/models/MerchantApp.php
Normal file
30
app/models/MerchantApp.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户应用模型
|
||||
*/
|
||||
class MerchantApp extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_merchant_app';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'api_type',
|
||||
'app_id',
|
||||
'app_secret',
|
||||
'app_name',
|
||||
'status',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
33
app/models/PaymentCallbackLog.php
Normal file
33
app/models/PaymentCallbackLog.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付回调日志模型
|
||||
*
|
||||
* 对应表:ma_pay_callback_log
|
||||
*/
|
||||
class PaymentCallbackLog extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_callback_log';
|
||||
|
||||
protected $fillable = [
|
||||
'order_id',
|
||||
'channel_id',
|
||||
'callback_type',
|
||||
'request_data',
|
||||
'verify_status',
|
||||
'process_status',
|
||||
'process_result',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'channel_id' => 'integer',
|
||||
'verify_status' => 'integer',
|
||||
'process_status' => 'integer',
|
||||
];
|
||||
}
|
||||
62
app/models/PaymentChannel.php
Normal file
62
app/models/PaymentChannel.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付通道模型
|
||||
*
|
||||
* 对应表:ma_pay_channel
|
||||
*/
|
||||
class PaymentChannel extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_channel';
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id',
|
||||
'merchant_app_id',
|
||||
'chan_code',
|
||||
'chan_name',
|
||||
'plugin_code',
|
||||
'method_id',
|
||||
'config_json',
|
||||
'split_ratio',
|
||||
'chan_cost',
|
||||
'chan_mode',
|
||||
'daily_limit',
|
||||
'daily_cnt',
|
||||
'min_amount',
|
||||
'max_amount',
|
||||
'status',
|
||||
'sort',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_app_id' => 'integer',
|
||||
'method_id' => 'integer',
|
||||
'config_json' => 'array',
|
||||
'split_ratio' => 'decimal:2',
|
||||
'chan_cost' => 'decimal:2',
|
||||
'daily_limit' => 'decimal:2',
|
||||
'daily_cnt' => 'integer',
|
||||
'min_amount' => 'decimal:2',
|
||||
'max_amount' => 'decimal:2',
|
||||
'status' => 'integer',
|
||||
'sort' => 'integer',
|
||||
];
|
||||
|
||||
public function getConfigArray(): array
|
||||
{
|
||||
return $this->config_json ?? [];
|
||||
}
|
||||
|
||||
public function getEnabledProducts(): array
|
||||
{
|
||||
$config = $this->getConfigArray();
|
||||
return $config['enabled_products'] ?? [];
|
||||
}
|
||||
}
|
||||
30
app/models/PaymentMethod.php
Normal file
30
app/models/PaymentMethod.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付方式模型
|
||||
*
|
||||
* 对应表:ma_pay_method
|
||||
*/
|
||||
class PaymentMethod extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_method';
|
||||
|
||||
protected $fillable = [
|
||||
'method_code',
|
||||
'method_name',
|
||||
'icon',
|
||||
'sort',
|
||||
'status',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'sort' => 'integer',
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
42
app/models/PaymentNotifyTask.php
Normal file
42
app/models/PaymentNotifyTask.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 商户通知任务模型
|
||||
*
|
||||
* 对应表:ma_notify_task
|
||||
*/
|
||||
class PaymentNotifyTask extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_notify_task';
|
||||
|
||||
protected $fillable = [
|
||||
'order_id',
|
||||
'merchant_id',
|
||||
'merchant_app_id',
|
||||
'notify_url',
|
||||
'notify_data',
|
||||
'status',
|
||||
'retry_cnt',
|
||||
'next_retry_at',
|
||||
'last_notify_at',
|
||||
'last_response',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_app_id' => 'integer',
|
||||
'retry_cnt' => 'integer',
|
||||
'next_retry_at' => 'datetime',
|
||||
'last_notify_at' => 'datetime',
|
||||
];
|
||||
|
||||
const STATUS_PENDING = 'PENDING';
|
||||
const STATUS_SUCCESS = 'SUCCESS';
|
||||
const STATUS_FAIL = 'FAIL';
|
||||
}
|
||||
62
app/models/PaymentOrder.php
Normal file
62
app/models/PaymentOrder.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付订单模型
|
||||
*
|
||||
* 对应表:ma_pay_order
|
||||
*/
|
||||
class PaymentOrder extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_order';
|
||||
|
||||
protected $fillable = [
|
||||
'order_id',
|
||||
'merchant_id',
|
||||
'merchant_app_id',
|
||||
'mch_order_no',
|
||||
'method_id',
|
||||
'channel_id',
|
||||
'amount',
|
||||
'real_amount',
|
||||
'fee',
|
||||
'currency',
|
||||
'subject',
|
||||
'body',
|
||||
'status',
|
||||
'chan_order_no',
|
||||
'chan_trade_no',
|
||||
'pay_at',
|
||||
'expire_at',
|
||||
'client_ip',
|
||||
'notify_stat',
|
||||
'notify_cnt',
|
||||
'extra',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'merchant_id' => 'integer',
|
||||
'merchant_app_id' => 'integer',
|
||||
'method_id' => 'integer',
|
||||
'channel_id' => 'integer',
|
||||
'amount' => 'decimal:2',
|
||||
'real_amount' => 'decimal:2',
|
||||
'fee' => 'decimal:2',
|
||||
'status' => 'integer',
|
||||
'notify_stat' => 'integer',
|
||||
'notify_cnt' => 'integer',
|
||||
'extra' => 'array',
|
||||
'pay_at' => 'datetime',
|
||||
'expire_at' => 'datetime',
|
||||
];
|
||||
|
||||
const STATUS_PENDING = 0;
|
||||
const STATUS_SUCCESS = 1;
|
||||
const STATUS_FAIL = 2;
|
||||
const STATUS_CLOSED = 3;
|
||||
}
|
||||
34
app/models/PaymentPlugin.php
Normal file
34
app/models/PaymentPlugin.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付插件模型
|
||||
*
|
||||
* 对应表:ma_pay_plugin(主键 plugin_code)
|
||||
*/
|
||||
class PaymentPlugin extends BaseModel
|
||||
{
|
||||
protected $table = 'ma_pay_plugin';
|
||||
|
||||
protected $primaryKey = 'plugin_code';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'plugin_code',
|
||||
'plugin_name',
|
||||
'class_name',
|
||||
'status',
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\common\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 用户模型
|
||||
*
|
||||
* 对应表:users
|
||||
*/
|
||||
class User extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 表名
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
* 关联角色(多对多)
|
||||
*/
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsToMany(Role::class, 'role_user', 'user_id', 'role_id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user