12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- class FundDao {
-
- public $id;
-
- public $uid;
-
- public $qid;
-
- public $time;
-
- public $amount;
-
- public $_table = t_fund;
-
- public $_primarykey = "id";
-
- public $_fields = array ('id', 'uid', 'qid', 'time', 'amount');
-
- /**
- * 获取基金总额
- */
- public function get_fund (){
- $sql = "SELECT sum(amount) as allmoney from " . $this->_table ;
-
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetch ();
-
- return $result;
- }
-
- public function get_fund_by_amount(){
- $sql = "SELECT * from " . $this->_table ." where amount>0 limit 1";
-
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetch ();
-
- return $result;
- }
-
- public function set_fund_amount_spread($amount="+1",$id=0){
- $sql = "UPDATE `" . $this->_table . "` SET `amount` = `amount` " . $amount . " WHERE `id` = " . $id;
-
- $query = Doo::db ()->query ( $sql );
- }
-
- }
- ?>
|