commonuser.php 774 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. /**
  4. * Created by PhpStorm.
  5. * User: ellisran
  6. * Date: 2016/9/22
  7. * Time: 16:20
  8. */
  9. class Commonuser extends DooModel {
  10. public $id;
  11. public $username;
  12. public $password;
  13. public $_table = 'common_user';
  14. public $_primarykey = 'id';
  15. public $_fields = array('id', 'username', 'password');
  16. public function __construct() {
  17. parent::setupModel(__CLASS__);
  18. }
  19. public function getRowByUsername($data){
  20. return $this->getOne(array('where' => 'username=? and password=?', 'param' => array($data['name'],$data['password']), 'asArray' => TRUE));
  21. }
  22. public function getRowByuser($username){
  23. return $this->getOne(array('where' => 'username="'.$username.'"', 'asArray' => TRUE));
  24. }
  25. }