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

64 lines
1.5 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;
/**
* This is the model class for table "{{%sys_admin}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商户ID
* @property int $user_id 用户ID
* @property int $is_delete 是否删除0=否1=是
* @property int $created_at 添加时间
* @property int $creator_user_id 创建者用户ID
*/
class SysAdmin extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%sys_admin}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['cx_mch_id', 'user_id', 'is_delete', 'created_at', 'creator_user_id'], 'integer'],
[['user_id'], 'required'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商户ID',
'user_id' => '用户ID',
'is_delete' => '是否删除0=否1=是',
'created_at' => '添加时间',
'creator_user_id' => '创建者用户ID',
];
}
public function beforeSave($insert) {
if(parent::beforeSave($insert)){
if($this->isNewRecord){
$this->created_at = time();
}
return true;
} else {
return false;
}
}
}