💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 管理员模型 ``` <?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'])); } } ```