Credit3logDao.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. class Credit3logDao {
  3. public $id;
  4. public $uid;
  5. public $action;
  6. public $amount;
  7. public $time;
  8. public $username;
  9. public $ip;
  10. public $qid;
  11. public $_table = t_credit3log;
  12. public $_primarykey = "id";
  13. public $_fields = array ('id', 'uid', 'qid', 'action', 'amount', 'time', 'username', 'ip' );
  14. /**
  15. * 设置回答被采纳的ACTION说明
  16. */
  17. public function set_ACTION_ADOPT_QUESTION() {
  18. return $this->username . "用户在" . format_date ( $this->time ) . "时间" . $this->ip . "IP回答被采纳,获得财富为" . $this->amount . ";问题ID为" . $this->qid;
  19. }
  20. /**
  21. * 设置发布悬赏问题的action说明
  22. */
  23. public function set_ACTION_OFFER_QUESTION() {
  24. return $this->username . "用户在" . format_date ( $this->time ) . "时间" . $this->ip . "IP发起了悬赏为" . $this->amount . "的问题" . $this->qid . "ID";
  25. }
  26. /**
  27. * 设置退款问题的action说明
  28. */
  29. public function set_ACTION_REFUNDS_QUESTION() {
  30. return $this->username . "用户在" . format_date ( $this->time ) . "时间" . $this->ip . "IP名师答疑回答不满意,退款" . $this->amount . ";问题ID为" . $this->qid;
  31. }
  32. /**
  33. * 发布名师答疑问题的action说明
  34. */
  35. public function set_ACTION_ADD_VIP_QUESTION() {
  36. return $this->username . "用户在" . format_date ( $this->time ) . "时间" . $this->ip . "IP发起了名师答疑,悬赏为" . $this->amount . ";问题ID为" . $this->qid;
  37. }
  38. /**
  39. * 添加一条财富流向记录
  40. * @param unknown_type $uid
  41. * @param unknown_type $username
  42. * @param unknown_type $action
  43. * @param unknown_type $amount
  44. * @param unknown_type $ip
  45. */
  46. public function add_credit3_log($uid = 0, $username = "", $qid = 0, $action = "", $amount = 0, $ip = "",$is_vip=0) {
  47. $sql = "INSERT INTO " . t_credit3log . "(uid,username,qid,action,amount,time,ip,is_vip) VALUES (" . $uid . ",'" . $username . "'," . $qid . ",'" . $action . "','" . $amount . "'," . get_date () . ",'" . $ip . "','".$is_vip."')";
  48. $query = Doo::db ()->query ( $sql );
  49. }
  50. /**
  51. * 获取用户财富流向明细
  52. * @param unknown_type $uid
  53. */
  54. function get_list_by_uid($uid = 0) {
  55. $sql = "select * from " . t_credit3log . " where uid = " . $uid;
  56. $query = Doo::db ()->query ( $sql );
  57. $result = $query->fetchAll ();
  58. return $result;
  59. }
  60. function get_all_list(){
  61. $sql = "select * from " . t_credit3log;
  62. $query = Doo::db ()->query ( $sql );
  63. $result = $query->fetchAll ();
  64. return $result;
  65. }
  66. }
  67. ?>