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.

82 lines
2.3 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;
private $login_tbl;
public function __construct() {
$this->obj = new dUser();
$this->tbl = 'admin_user_list';
$this->login_tbl = 'login_user_list';
}
public function getAdminUserByOpenid($openid) {
2 months ago
return $this->obj->select($this->tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
2 months ago
}
2 months ago
public function getAdminUserList() {
return $this->obj->selectAll($this->tbl, array(), 'id desc ');
}
public function updateAdminUser($id, $data) {
return $this->obj->update($this->tbl, $data, array('sql' => '`id`=?', 'vals' => array($id)));
}
2 months ago
public function getLoginUserByOpenid($openid) {
2 months ago
return $this->obj->select($this->login_tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
2 months ago
}
2 months ago
public function getLoginUserById($id) {
return $this->obj->select($this->login_tbl, array('sql' => '`id`=?', 'vals' => array($id)));
}
2 months ago
public function addLoginUser($data) {
return $this->obj->insert($this->login_tbl, $data);
}
2 months ago
public function getLoginUserList() {
return $this->obj->selectAll($this->login_tbl, array(), 'id desc ', array(0, 10));
}
public function passLoginUser($id, $aid) {
$login_user = $this->getLoginUserById($id);
if (empty($login_user)) {
$this->setError('用户不存在');
return false;
}
$admin_user = $this->getAdminUserByOpenid($login_user['openid']);
if (!empty($admin_user)) {
$this->setError('审核员已存在');
return false;
}
$data = array(
'aid' => $aid,
'nickname' => $login_user['nickname'],
'openid' => $login_user['openid'],
'status' => 1,
);
$res = $this->obj->insert($this->tbl, $data);
if (!$res) {
$this->setError('添加失败');
return false;
}
$res = $this->obj->delete($this->login_tbl, array('sql' => 'id=?', 'vals' => array($id)));
if (!$res) {
$this->setError('删除申请失败');
return false;
}
return true;
}
2 months ago
}