31 lines
747 B
PHP
31 lines
747 B
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class Admin extends \common\modelsgii\Admin
|
|
{
|
|
|
|
public function beforeSave($insert)
|
|
{
|
|
if (!parent::beforeSave($insert)) {
|
|
return false;
|
|
}
|
|
if($this->isNewRecord){
|
|
$this->reg_time = time();
|
|
$this->reg_ip = ip2long(\Yii::$app->request->getUserIP());
|
|
}
|
|
$this->last_login_time = time();
|
|
$this->last_login_ip = ip2long(\Yii::$app->request->getUserIP());
|
|
$this->update_time = time();
|
|
return true; // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
public function getStore()
|
|
{
|
|
return $this->hasOne(Store::class,['id'=>'store_id']);
|
|
}
|
|
}
|