|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
include_once(SERVER_ROOT . "/model/mBase.php");
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
return $this->obj->select($this->tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
|
|
|
|
}
|
|
|
|
|
|
|
|
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)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLoginUserByOpenid($openid) {
|
|
|
|
return $this->obj->select($this->login_tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLoginUserById($id) {
|
|
|
|
return $this->obj->select($this->login_tbl, array('sql' => '`id`=?', 'vals' => array($id)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addLoginUser($data) {
|
|
|
|
return $this->obj->insert($this->login_tbl, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|