初始化仓库
This commit is contained in:
34
common/models/Log.php
Normal file
34
common/models/Log.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Log extends \common\modelsgii\Log
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'class' => TimestampBehavior::class,
|
||||
'attributes' => [
|
||||
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
||||
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public static function saveLog($admin_id,$type,$content)
|
||||
{
|
||||
$Log=new Log();
|
||||
$Log->admin_id=$admin_id;
|
||||
$Log->type='同步互医';
|
||||
$Log->operate_time=date('Y-m-d H:i:s',time());
|
||||
$Log->content=$content;
|
||||
$Log->mold=$type;
|
||||
$Log->saveOrFail();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user