query ( $sql ); $result = $query->fetch (); return $result; } /** * 根据ID获取问答 * @param unknown_type $id */ public function get_vip_question_by_id($id = 0) { $sql = "SELECT * FROM " . t_vipquestion . " where id=" . $id . " limit 1"; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result; } /** * 获取该用户指定的名师问题 * @param unknown_type $qid * @param unknown_type $uid */ function get_vip_question_by_quid($qid, $uid) { $sql = "SELECT * FROM " . t_vipquestion . " where id=" . $qid . " and authorid=" . $uid . " limit 1"; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result; } /** * 更新名师问题的详情 * @param unknown_type $qid * @param unknown_type $description */ function update_vip_question_description($qid, $description) { $sql = "UPDATE " . t_vipquestion . " SET description='" . $description . "' WHERE id = " . $qid; $query = Doo::db ()->query ( $sql ); } /** * 设置问题状态 * @param unknown_type $id */ function set_vip_question_status($id, $status, $refunds_description = "") { $sql = "UPDATE " . t_vipquestion . " SET status='" . $status . "' , refunds_description='" . $refunds_description . "' WHERE id = " . $id; $query = Doo::db ()->query ( $sql ); } /** * 获取某个用户的名师答疑 * @param unknown_type $uid */ function get_vip_question_by_uid($uid) { $sql = "SELECT * FROM " . t_vipquestion . " where status!=" . PAID_NO_FILL_IN . " and authorid=" . $uid . " order by time desc"; $query = Doo::db ()->query ( $sql ); $result = $query->fetchAll (); return $result; } /** * 更新问题数 * @param unknown_type $id */ function update_vip_question_by_answers($id = 0) { $sql = "UPDATE " . t_vipquestion . " SET answers= answers + 1 WHERE id = " . $id; $query = Doo::db ()->query ( $sql ); } } ?>