function __construct($uid = NULL) { parent::__construct(); $this->table = 'user'; $this->fields = array_merge($this->fields, array('alias' => '', 'password' => '')); if (is_null($uid)) { $uid = $this->session->userdata('user/id'); } if ($uid) { $user = $this->fetch($uid); $this->id = $uid; $this->name = $user['name']; $this->group = explode(',', $user['group']); } //TODO 生成了过多的查询,应予以优化 $this->teams = $this->team->trace($this->id); //获取存在数据库中的用户配置项 $this->db->from('user_config')->where('user', $this->id); $config = array_sub($this->db->get()->result_array(), 'value', 'name'); array_walk($config, function (&$value) { $decoded = json_decode($value); if (!is_null($decoded)) { $value = $decoded; } }); $this->config->user = $config; }
function __construct() { parent::__construct(); }
function __construct() { parent::__construct(); $this->fields['type'] = 'student'; }
function __construct() { parent::__construct(); $this->fields['type'] = 'team'; }