/** * get_json 通过json获得问题列表 * @param [type] $json [description] * @param [type] $page [description] * @param [type] $count [description] * @return [type] [description] */ public function get_json($json, $page = 0, $count = 20) { $index = 0; $returnData = array(); $json = json_decode($json); $json = array_slice($json, $page, $count); foreach ($json as $value) { $data = parent::get(array('id' => $value)); $data['ctime'] = date("H:i:s", strtotime($data['ctime'])); @($data['tags'] = $this->tag_model->get_list_by_json($data['tags'])); $returnData[] = $data; $index++; } return $returnData; }
} public function get_problem_json($pid, $type = 'collect_problems') { $temp_collect = array(); $collect = json_decode($this->me[$type]); foreach ($collect as $key => $value) { if ($value->t != $pid) { array_push($temp_collect, array("t" => $value->t));
public function remove($id) { $course = parent::get(array('id' => $id)); $this->db->query('update user set god_course_count = god_course_count - 1 where id = ' . $course['god']); parent::remove($id); }
public function get_content($type) { return parent::get(array('type' => $type))['content']; }
public function get($pk, $pot = '') { $this->switching($this->_idx_table, $pot); return parent::get($pk); }
} return $result; } public function add_active_user($tag_id, $user_id, $is_god = false) { $type = $is_god ? 'active_god' : 'active_stu'; $tag = parent::get(array('id' => $tag_id)); $list = json_decode($tag[$type]); if (!empty($list->{$user_id})) { $list->{$user_id}++; } else { $list->{$user_id} = 1; } parent::edit($tag_id, array($type => json_encode($list))); } public function get_active_user($tag_id, $count = 5, $is_god = false) {