VipquestionDao.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. class VipquestionDao {
  3. public $id;
  4. public $price;
  5. public $author;
  6. public $authorid;
  7. public $title;
  8. public $description;
  9. public $supply;
  10. public $time;
  11. public $endtime;
  12. public $answers;
  13. public $status;
  14. public $ip;
  15. public $refunds;
  16. public $_table = t_vipquestion;
  17. public $_primarykey = "id";
  18. public $_fields = array ('id', 'price', 'author', 'authorid', 'title', 'description', 'supply', 'time', 'endtime', 'answers', 'status', 'ip', 'refunds' );
  19. /**
  20. * 获取已付款未完成填写问题
  21. * @param unknown_type $uid
  22. */
  23. public function get_vip_question_by_paid($uid = 0) {
  24. $sql = "SELECT * FROM " . t_vipquestion . " where authorid=" . $uid . " and status=1 limit 1";
  25. $query = Doo::db ()->query ( $sql );
  26. $result = $query->fetch ();
  27. return $result;
  28. }
  29. /**
  30. * 根据ID获取问答
  31. * @param unknown_type $id
  32. */
  33. public function get_vip_question_by_id($id = 0) {
  34. $sql = "SELECT * FROM " . t_vipquestion . " where id=" . $id . " limit 1";
  35. $query = Doo::db ()->query ( $sql );
  36. $result = $query->fetch ();
  37. return $result;
  38. }
  39. /**
  40. * 获取该用户指定的名师问题
  41. * @param unknown_type $qid
  42. * @param unknown_type $uid
  43. */
  44. function get_vip_question_by_quid($qid, $uid) {
  45. $sql = "SELECT * FROM " . t_vipquestion . " where id=" . $qid . " and authorid=" . $uid . " limit 1";
  46. $query = Doo::db ()->query ( $sql );
  47. $result = $query->fetch ();
  48. return $result;
  49. }
  50. /**
  51. * 更新名师问题的详情
  52. * @param unknown_type $qid
  53. * @param unknown_type $description
  54. */
  55. function update_vip_question_description($qid, $description) {
  56. $sql = "UPDATE " . t_vipquestion . " SET description='" . $description . "' WHERE id = " . $qid;
  57. $query = Doo::db ()->query ( $sql );
  58. }
  59. /**
  60. * 设置问题状态
  61. * @param unknown_type $id
  62. */
  63. function set_vip_question_status($id, $status, $refunds_description = "") {
  64. $sql = "UPDATE " . t_vipquestion . " SET status='" . $status . "' , refunds_description='" . $refunds_description . "' WHERE id = " . $id;
  65. $query = Doo::db ()->query ( $sql );
  66. }
  67. /**
  68. * 获取某个用户的名师答疑
  69. * @param unknown_type $uid
  70. */
  71. function get_vip_question_by_uid($uid) {
  72. $sql = "SELECT * FROM " . t_vipquestion . " where status!=" . PAID_NO_FILL_IN . " and authorid=" . $uid . " order by time desc";
  73. $query = Doo::db ()->query ( $sql );
  74. $result = $query->fetchAll ();
  75. return $result;
  76. }
  77. /**
  78. * 更新问题数
  79. * @param unknown_type $id
  80. */
  81. function update_vip_question_by_answers($id = 0) {
  82. $sql = "UPDATE " . t_vipquestion . " SET answers= answers + 1 WHERE id = " . $id;
  83. $query = Doo::db ()->query ( $sql );
  84. }
  85. }
  86. ?>