Skip to content

Commit

Permalink
added load content
Browse files Browse the repository at this point in the history
  • Loading branch information
bcho committed Apr 17, 2013
1 parent ae7c0a5 commit 0f70099
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions application/models/tutor_model.php
Expand Up @@ -11,14 +11,20 @@ class Tutor_model extends Content_model
*
* 根据 id 获取单条 tutor
*
* @param int id
* @param int id
* @param bool load_content 是否获取内容
* @return 查询 result_array
*/
public function get_by_id($id)
public function get_by_id($id, $load_content=False)
{
$this->db->from($this->model_tb_name)->where('id', $id);
$query = $this->db->get();
return $query->result_array();
$ret = $query->result_array();
if ($ret)
$ret = $ret[0];
if ($load_content && $ret['content_id'])
$ret['content'] = $this->get_content($ret['content_id']);
return $ret;
}

/*
Expand Down

0 comments on commit 0f70099

Please sign in to comment.