123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php
- class VipquestionDao {
-
- public $id;
-
- public $price;
-
- public $author;
-
- public $authorid;
-
- public $title;
-
- public $description;
-
- public $supply;
-
- public $time;
-
- public $endtime;
-
- public $answers;
-
- public $status;
-
- public $ip;
-
- public $refunds;
-
- public $_table = t_vipquestion;
-
- public $_primarykey = "id";
-
- public $_fields = array ('id', 'price', 'author', 'authorid', 'title', 'description', 'supply', 'time', 'endtime', 'answers', 'status', 'ip', 'refunds' );
-
- /**
- * 获取已付款未完成填写问题
- * @param unknown_type $uid
- */
- public function get_vip_question_by_paid($uid = 0) {
- $sql = "SELECT * FROM " . t_vipquestion . " where authorid=" . $uid . " and status=1 limit 1";
-
- $query = Doo::db ()->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 );
- }
- }
- ?>
|