You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
<?php
|
|
/**
|
|
*
|
|
*/
|
|
include_once(SERVER_ROOT . "/model/mBase.php");
|
|
|
|
|
|
class mUser extends mBase {
|
|
|
|
private $obj;
|
|
private $tbl;
|
|
|
|
public function __construct() {
|
|
$this->obj = new dUser();
|
|
$this->tbl = 'admin_user_list';
|
|
}
|
|
|
|
public function getAdminUserById($id) {
|
|
return $this->obj->select($this->tbl, array('sql' => '`id`=?', 'vals' => array($id)));
|
|
}
|
|
|
|
public function getAdminUserByOpenid($openid) {
|
|
return $this->obj->select($this->tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
|
|
}
|
|
|
|
public function getAdminUserList($condition, $page_num, $page_size) {
|
|
$offset = ($page_num - 1) * $page_size;
|
|
|
|
$where = "1=1 ";
|
|
if (!empty($condition)) {
|
|
foreach ($condition as $key => $val) {
|
|
if (is_array($val)) {
|
|
$val = implode(',', $val);
|
|
$where .= " and {$key} in ({$val})";
|
|
} else {
|
|
$where .= " and {$key}={$val}";
|
|
}
|
|
}
|
|
}
|
|
|
|
return $this->obj->selectAll($this->tbl, array('sql' => $where, 'vals' => array()), 'id desc', array($offset, $page_size));
|
|
}
|
|
|
|
public function getAdminUserTotal($condition) {
|
|
$where = "1=1 ";
|
|
if (!empty($condition)) {
|
|
foreach ($condition as $key => $val) {
|
|
if (is_array($val)) {
|
|
$val = implode(',', $val);
|
|
$where .= " and {$key} in ({$val})";
|
|
} else {
|
|
$where .= " and {$key}={$val}";
|
|
}
|
|
}
|
|
}
|
|
|
|
return $this->obj->count($this->tbl, array('sql' => $where, 'vals' => array()));
|
|
}
|
|
|
|
public function updateAdminUser($id, $data) {
|
|
return $this->obj->update($this->tbl, $data, array('sql' => '`id`=?', 'vals' => array($id)));
|
|
}
|
|
|
|
public function addAdminUser($data) {
|
|
return $this->obj->insert($this->tbl, $data);
|
|
}
|
|
}
|