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

2 months ago
<?php
/**
*
*/
2 months ago
include_once(SERVER_ROOT . "/model/mBase.php");
2 months ago
class mUser extends mBase {
private $obj;
private $tbl;
public function __construct() {
$this->obj = new dUser();
$this->tbl = 'admin_user_list';
}
2 months ago
public function getAdminUserById($id) {
return $this->obj->select($this->tbl, array('sql' => '`id`=?', 'vals' => array($id)));
2 months ago
}
2 months ago
public function getAdminUserByOpenid($openid) {
return $this->obj->select($this->tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
2 months ago
}
2 months ago
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}";
}
}
}
2 months ago
2 months ago
return $this->obj->selectAll($this->tbl, array('sql' => $where, 'vals' => array()), 'id desc', array($offset, $page_size));
2 months ago
}
2 months ago
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}";
}
}
}
2 months ago
2 months ago
return $this->obj->count($this->tbl, array('sql' => $where, 'vals' => array()));
2 months ago
}
2 months ago
2 months ago
public function updateAdminUser($id, $data) {
return $this->obj->update($this->tbl, $data, array('sql' => '`id`=?', 'vals' => array($id)));
2 months ago
}
2 months ago
public function addAdminUser($data) {
return $this->obj->insert($this->tbl, $data);
2 months ago
}
2 months ago
}