User.php 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class User extends Model
  5. {
  6. protected $table = "users";
  7. public $timestamps = false;
  8. public function CreateUser(array $params)
  9. {
  10. // todo 是否需要保证用户名唯一的功能
  11. $this->username = $params["username"];
  12. $this->password = $params["password"];
  13. $this->nickname = $params["nickname"];
  14. $this->icon = $params["icon"];
  15. $this->tel = $params["tel"];
  16. $this->email = $params["email"];
  17. $this->status = "normal";
  18. if ($this->username == "" || $this->password == "") {
  19. return "empty username or password";
  20. }
  21. // todo 这里需要对密码加密
  22. $this->save();
  23. return "success";
  24. }
  25. public function ModifyUser(array $params)
  26. {
  27. }
  28. public function DeleteUser($uid)
  29. {
  30. }
  31. public function ListUser($page, $pageCount)
  32. {
  33. }
  34. }