cxfoot/models/PaymentOrder.php
2023-10-27 14:25:12 +08:00

92 lines
2.8 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_order}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商户ID
* @property int $payment_order_union_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 $notify_class 支付成功回调处理类
* @property string $notify_url 支付成功回调
* @property int $notify_status 回调状态0=待回调1=回调成功2=回调失败
* @property float $refund 已退款金额
*/
class PaymentOrder extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%payment_order}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['cx_mch_id', 'payment_order_union_id', 'is_pay', 'pay_type', 'created_at', 'updated_at', 'notify_status'], 'integer'],
[['payment_order_union_id', 'order_no', 'amount', 'title', 'notify_class',], 'required'],
[['amount', 'refund'], 'number'],
[['order_no'], 'string', 'max' => 64],
[['title'], 'string', 'max' => 128],
[['notify_class', 'notify_url'], 'string', 'max' => 512],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商户ID',
'payment_order_union_id' => '合并支付ID',
'order_no' => '订单号',
'amount' => '订单金额',
'is_pay' => '支付状态0=未支付1=已支付',
'pay_type' => '支付方式',
'title' => '支付摘要',
'created_at' => '添加时间',
'updated_at' => '更新时间',
'notify_class' => '支付成功回调处理类',
'notify_url' => '支付成功回调',
'notify_status' => '回调状态0=待回调1=回调成功2=回调失败',
'refund' => '已退款金额',
];
}
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);
}
}