<?php

namespace  backend\modules\shop\models\ars;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "ats_payment_log".
 *
 * @property int $id
 * @property int $order_id 订单id
 * @property string $wx_refund_id 微信退款单号
 * @property string $mch_id 商户号
 * @property int $order_amount 订单金额
 * @property int $payment_amount 支付金额
 * @property int $type 类型
 * @property int $status 状态
 * @property string $refund_account 退款账户
 * @property int $updated_at 更新时间
 * @property int $created_at 创建时间
 */
class PaymentLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'ats_payment_log';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['order_id', 'order_amount', 'payment_amount', 'type', 'status'], 'integer'],
            [['wx_refund_id', 'mch_id', 'refund_account'], 'string', 'max' => 64],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'id',
            'order_id' => '订单id',
            'wx_refund_id' => '微信退款单号',
            'mch_id' => '商户号',
            'order_amount' => '订单金额',
            'payment_amount' => '支付金额',
            'type' => '类型',
            'status' => '状态',
            'refund_account' => '退款账户',
            'updated_at' => '更新时间',
            'created_at' => '创建时间',
        ];
    }
   

    /**
    * @author linyao
    * @email 602604991@qq.com
    * @created Nov 8, 2019
    *
    * 行为存储创建时间和更新时间
    */
    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'createdAtAttribute' => 'created_at',
                'updatedAtAttribute' => 'updated_at',
                'value' => function() {
                    return time();
                },
            ],
        ];
    }
}