From c17ad4914be2747f6389b5627343f5f01bf1cd90 Mon Sep 17 00:00:00 2001
From: pengda <10266652509@qq.com>
Date: Fri, 21 Mar 2025 18:05:45 +0800
Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/define.php | 2 +-
control/index.php | 31 +++++++
index.php | 13 +++
model/mUser.php | 51 +++++++++++
view/css/index.css | 6 ++
view/templates/index/user_list.html | 172 ++++++++++++++++++++++++++++++++++++
6 files changed, 274 insertions(+), 1 deletion(-)
create mode 100644 view/templates/index/user_list.html
diff --git a/config/define.php b/config/define.php
index a63a5c4..c43abbf 100644
--- a/config/define.php
+++ b/config/define.php
@@ -28,7 +28,7 @@
define('CSS_URL', '//zhishiku.yizherenxin.cn');
//css/js版本
- define('CSS_JS_VERSION', '1.0.0000001');
+ define('CSS_JS_VERSION', '1.0.0000002');
define('ALIYUN_OSS_ACCESS_KEY_ID', 'LTAI5tRBq7yr1vcdvhqNMb7P');
define('ALIYUN_OSS_ACCESS_KEY_SECRET', 'E4No4AjlWGrHSULsR8apZkTAC8DMw6');
diff --git a/control/index.php b/control/index.php
index fd56b4b..ce00d26 100644
--- a/control/index.php
+++ b/control/index.php
@@ -21,4 +21,35 @@ class index extends publicBase {
header('location:/');
exit();
}
+
+ public function user_list() {
+ $user_info = $this->get_user_info();
+ if (!$user_info['is_super_admin']) $this->show_message('您没有权限', 'goback');
+
+ $uobj = new mUser();
+ $this->view['user_list'] = $uobj->getAdminUserList();
+ $this->view['login_list'] = $uobj->getLoginUserList();
+ }
+
+ public function ajax_change_user_status() {
+ $id = $this->post('id') + 0;
+ $status = $this->post('status') + 0;
+
+ $uobj = new mUser();
+ $res = $uobj->updateAdminUser($id, array('status' => $status));
+ if (!$res) $this->ajax_json(false, '设置失败');
+
+ $this->ajax_json(true, '设置成功');
+ }
+
+ public function ajax_pass_user() {
+ $id = $this->post('id') + 0;
+ $aid = 1; //当前默认aid为1
+
+ $uobj = new mUser();
+ $res = $uobj->passLoginUser($id, $aid);
+ if (!$res) $this->ajax_json(false, $uobj->getError());
+
+ $this->ajax_json(true, '设置成功');
+ }
}
diff --git a/index.php b/index.php
index 8aa862e..2b2ac0e 100644
--- a/index.php
+++ b/index.php
@@ -80,6 +80,19 @@ error_reporting(E_ERROR); // 记录所有级别的错误
header("Location: /login?url=".$_SERVER['REQUEST_URI']);
exit();
}
+
+ $uobj = new mUser();
+ $user_info = $uobj->getAdminUserByOpenid($_SESSION['openid']);
+ if(empty($user_info)){
+ header("Location: /login?url=".$_SERVER['REQUEST_URI']);
+ exit();
+ }
+
+ if($this->control_name == 'weibo' && $user_info['aid'] != 1 && $user_info['is_super_admin'] != 1){
+ exit('No permission 暂无权限,请联系管理员');
+ }
+
+ $this->view['_user_info'] = $this->para['_user_info'] = $user_info;
}
}
diff --git a/model/mUser.php b/model/mUser.php
index a9d1ab4..ae459d5 100644
--- a/model/mUser.php
+++ b/model/mUser.php
@@ -21,11 +21,62 @@ class mUser extends mBase {
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;
+ }
}
\ No newline at end of file
diff --git a/view/css/index.css b/view/css/index.css
index 30ab633..f45a6e5 100644
--- a/view/css/index.css
+++ b/view/css/index.css
@@ -462,6 +462,12 @@ button:hover {
border: none;
}
+.button-danger {
+ background: #cc0303;
+ color: #FFFFFF;
+ border: none;
+}
+
.button-normal {}
.button.checkBtn{
width: 119px !important;
diff --git a/view/templates/index/user_list.html b/view/templates/index/user_list.html
new file mode 100644
index 0000000..3ccd1e3
--- /dev/null
+++ b/view/templates/index/user_list.html
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+ 知识库
+
+
+
+
+{literal}
+
+{/literal}
+
+
+
+
+
+ 审核员列表
+
+ ID |
+ 昵称 |
+ 真实姓名 |
+ 操作 |
+
+ {foreach from=$user_list key=key item=item}
+
+ {$item.id} |
+ {$item.nickname} |
+ {$item.real_name} |
+
+ {if $item.is_super_admin == 0}
+
+ {/if}
+ |
+
+ {/foreach}
+
+
+ {if $login_list}
+
+ 申请列表
+
+ ID |
+ 昵称 |
+ 登陆时间 |
+ 操作 |
+
+ {foreach from=$login_list key=key item=item}
+
+ {$item.id} |
+ {$item.nickname} |
+ {$item.addtime} |
+
+
+ |
+
+ {/foreach}
+
+ {/if}
+
+
+
+
+{literal}
+
+{/literal}
+
+
\ No newline at end of file