123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\model;
-
- use think\Model;
-
- class AdminUser extends Model
- {
-
- protected $autoWriteTimestamp = true;
-
- protected $name = 'admin';
- protected $insert = ['status' => 1];
-
- public function getLastLoginTimeAttr($value)
- {
- return date('Y-m-d H:i:s', $value);
- }
-
- public static function init()
- {
- self::beforeWrite(function ($row) {
- $changed = $row->getChangedData();
-
- if (isset($changed['username']) || isset($changed['password']) || isset($changed['salt'])) {
- $row->token = '';
- }
- });
- }
- }
|