1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class User extends Model
- {
- protected $table = "users";
- public $timestamps = false;
- public function CreateUser(array $params)
- {
- // todo 是否需要保证用户名唯一的功能
- $this->username = $params["username"];
- $this->password = $params["password"];
- $this->nickname = $params["nickname"];
- $this->icon = $params["icon"];
- $this->tel = $params["tel"];
- $this->email = $params["email"];
- $this->status = "normal";
- if ($this->username == "" || $this->password == "") {
- return "empty username or password";
- }
- // todo 这里需要对密码加密
- $this->save();
- return "success";
- }
- public function ModifyUser(array $params)
- {
- }
- public function DeleteUser($uid)
- {
- }
- public function ListUser($page, $pageCount)
- {
- }
- }
|