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

86 lines
2.3 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_refund}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商户ID
* @property int $user_id 用户ID
* @property string $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 更新时间
* @property string $out_trade_no 支付单号
*/
class PaymentRefund extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%payment_refund}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_no', 'out_trade_no', 'title'], 'trim'],
[['cx_mch_id', 'user_id'], 'required'],
[['cx_mch_id', 'user_id', 'is_pay', 'pay_type', 'created_at', 'updated_at'], 'integer'],
[['amount'], 'number'],
[['order_no', 'out_trade_no'], 'string', 'max' => 64],
[['title'], 'string', 'max' => 128],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商户ID',
'user_id' => '用户ID',
'order_no' => '退款单号',
'amount' => '退款金额',
'is_pay' => '支付状态: 0=未支付1=已支付',
'pay_type' => '支付方式',
'title' => '支付摘要',
'created_at' => '添加时间',
'updated_at' => '更新时间',
'out_trade_no' => '支付单号',
];
}
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);
}
}