| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- *
- * @author Deben Chen
- *
- */
- class inviteDao extends commonDao
- {
- public $table_name = 'invite_code';
- protected $fields = "id,code,user,status,platform";
- /**
- * 取邀请码
- *
- * @param unknown $id
- */
- public function getOneByInvite($code)
- {
- return $this->dao->db->get_one_by_field(array(
- 'code' => $code
- ), $this->table_name);
- }
- /**
- * 删除邀请码
- *
- * @param unknown $code
- * @return boolean
- */
- public function delete($code)
- {
- $this->getDb()->update_by_field(array(
- 'status' => 0
- ), array(
- 'code' => $code
- ), $this->table_name);
- // return $this->dao->db->delete_by_field(array('code'=>$code), $this->table_name);
- }
- /**
- * 添加邀请码
- *
- * @param unknown $data
- */
- public function add($data)
- {
- return parent::add($data);
- // $data=$this->dao->db->build_key($data, $this->fields);
- // return $this->dao->db->insert($data, $this->table_name);
- }
- /**
- * 获取所有的邀请码
- *
- * @return Ambigous <number, multitype:multitype: >
- */
- public function getAll()
- {
- return parent::getAll(array(
- 'status'=>1,
- 'platform'=>'shadowsocks5'
- ));
- // $result=$this->dao->db->get_all($this->table_name);
- // return $result[0];
- }
- }
|