cxgj/models/PaymentTransfer.php
2023-11-27 09:45:13 +08:00

86 lines
2.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\models;
use Yii;
use app\models\Model;
/**
* This is the model class for table "{{%payment_transfer}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商户ID
* @property int $user_id 用户ID
* @property string $order_no 提交的订单号
* @property string $transfer_order_no 发起打款的订单号
* @property float $amount 金额
* @property int $is_pay 支付状态: 0=未支付1=已支付
* @property int $pay_type 支付方式
* @property string $title 支付摘要
* @property int $created_at 添加时间
* @property int $updated_at 更新时间
*/
class PaymentTransfer extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%payment_transfer}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_no', 'transfer_order_no', 'title'], 'trim'],
[['cx_mch_id', 'user_id', 'order_no', 'transfer_order_no'], 'required'],
[['cx_mch_id', 'user_id', 'is_pay', 'pay_type', 'created_at', 'updated_at'], 'integer'],
[['amount'], 'number'],
[['order_no', 'transfer_order_no'], 'string', 'max' => 64],
[['title'], 'string', 'max' => 128],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商户ID',
'user_id' => '用户ID',
'order_no' => '提交的订单号',
'transfer_order_no' => '发起打款的订单号',
'amount' => '金额',
'is_pay' => '支付状态: 0=未支付1=已支付',
'pay_type' => '支付方式',
'title' => '支付摘要',
'created_at' => '添加时间',
'updated_at' => '更新时间',
];
}
public function beforeSave($insert) {
if(parent::beforeSave($insert)){
if($this->isNewRecord){
$this->created_at = time();
}
$this->updated_at = time();
$this->htmlTagFilter();
return true;
} else {
return false;
}
}
public function htmlTagFilter()
{
$this->title = Model::htmlTagFilter($this->title);
}
}