commissiontx.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. class commissiontx_m extends Model
  3. {
  4. var $psize = 20;
  5. function __construct()
  6. {
  7. parent::Model();
  8. $this->psize = defined("SYS_PSIZE") ? SYS_PSIZE : 20;
  9. }
  10. function commissiontx_m()
  11. {
  12. $this->__construct();
  13. }
  14. function get_one($id)
  15. {
  16. if(!$id)
  17. {
  18. return false;
  19. }
  20. $sql = "SELECT * FROM ".$this->db->prefix."commissiontx WHERE id='".$id."'";
  21. $rs = $this->db->get_one($sql);
  22. if(!$rs) return false;
  23. return $rs;
  24. }
  25. function get_list($offset=0,$condition="")
  26. {
  27. $sql = "SELECT * FROM ".$this->db->prefix."commissiontx ";
  28. if($condition)
  29. {
  30. $sql .= " WHERE ".$condition;
  31. }
  32. $sql .= " ORDER BY id DESC LIMIT ".$offset.",".$this->psize;
  33. return $this->db->get_all($sql);
  34. }
  35. //取得总数量
  36. function get_count($condition="")
  37. {
  38. $sql = "SELECT count(id) FROM ".$this->db->prefix."commissiontx ";
  39. if($condition)
  40. {
  41. $sql .= " WHERE ".$condition;
  42. }
  43. return $this->db->count($sql);
  44. }
  45. //存储会员数据
  46. function save($data,$id=0)
  47. {
  48. if($id)
  49. {
  50. $this->db->update_array($data,"commissiontx",array("id"=>$id));
  51. return $id;
  52. }
  53. else
  54. {
  55. $insert_id = $this->db->insert_array($data,"commissiontx");
  56. return $insert_id;
  57. }
  58. }
  59. function set_status($id,$status=0,$time=0)
  60. {
  61. $sql = "UPDATE ".$this->db->prefix."commissiontx SET status='".$status."',okpostdate='".$time."' WHERE id='".$id."'";
  62. return $this->db->query($sql);
  63. }
  64. function status($id,$status=0,$time=0)
  65. {
  66. $sql = "UPDATE ".$this->db->prefix."commissiontx SET status='".$status."' ,okpostdate='".$time."' WHERE id IN(".$id.") ";
  67. return $this->db->query($sql);
  68. }
  69. function del($id)
  70. {
  71. $sql = "DELETE FROM ".$this->db->prefix."commissiontx WHERE id='".$id."'";
  72. return $this->db->query($sql);
  73. }
  74. function pl_del($id)
  75. {
  76. $sql = "DELETE FROM ".$this->db->prefix."commissiontx WHERE id IN(".$id.")";
  77. return $this->db->query($sql);
  78. }
  79. }
  80. ?>