企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 管理员模型 ``` <?php namespace app\admin\model; use think\Model; class AdminModel extends Model { protected $table = 'admin'; protected $autoWriteTimestamp = true; public function login($data) { $info = $this->where('username', $data['username'])->find(); if (!$info) { return false; } if ($info['password'] != md5($data['password'])) { return false; } $this->log($info['id']); session('aid', $info['id']); session('aname', $info['username']); return true; } public function log($aid) { return true; } /* * 修改密码 */ public function setPassword($data) { $info = $this->where('id', session('aid'))->find(); if (md5($data['oldpwd']) != $info['password']) { return false; } return $this->where('id', session('aid'))->setField('password', md5($data['password'])); } } ```