You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
803 B

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: zhengmingwei
  5. * Date: 2020/3/8
  6. * Time: 7:25 PM
  7. */
  8. namespace addons\unishop\model;
  9. use think\Model;
  10. /**
  11. * 基础用户表
  12. * Class User
  13. * @package addons\unishop\model
  14. */
  15. class User extends Model
  16. {
  17. // 表名
  18. protected $name = 'user';
  19. // 自动写入时间戳字段
  20. protected $autoWriteTimestamp = 'int';
  21. // 定义时间戳字段名
  22. protected $createTime = 'createtime';
  23. protected $updateTime = 'updatetime';
  24. public function getAvatarAttr($value)
  25. {
  26. $value = $value != '' ? $value : Config::getByName('avatar')['value'];
  27. return Config::getImagesFullUrl($value);
  28. }
  29. public function getUsernameAttr($value, $data) {
  30. return $data['username'] ? $data['username'] : __('Tourist');
  31. }
  32. }