<?php


namespace backend\modules\shop\models\ars;


use yii\behaviors\TimestampBehavior;
use yii\redis\ActiveRecord;

/**
 * Class WxPayConfig
 * @package backend\modules\shop\models\ars
 * @property int $id
 * @property int $user_id 用户id
 * @property int $mch_id 商户号
 * @property string $key 支付秘钥
 * @property string $cert_path cert文件路径
 * @property string $key_path key文件路径
 */

class WxPayConfig extends ActiveRecord
{
    /**
     * 主键 默认为 id
     *
     * @return array|string[]
     */
    public static function primaryKey()
    {
        return ['id'];
    }

    /**
     * 模型对应记录的属性列表
     *
     * @return array
     */
    public function attributes()
    {
        return ['id', 'user_id', 'mch_id', 'key', 'cert_path', 'key_path', 'created_at', 'updated_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();
                },
            ],
        ];
    }

}