|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once(dirname(dirname(__FILE__)) . "/library/publicBase.php");
|
|
|
|
|
|
|
|
class index extends publicBase {
|
|
|
|
|
|
|
|
public function home() {
|
|
|
|
$this->login();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function login() {
|
|
|
|
$this->view['appid'] = WEIXIN_OPEN_APPID;
|
|
|
|
$this->view['redirect_uri'] = urlencode(CALLBACK_KNOWLEDGE_LOGIN_REDIRECT);
|
|
|
|
$this->view['state'] = CALLBACK_KNOWLEDGE_LOGIN . "-" . $this->get('url');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loginout() {
|
|
|
|
session_start();
|
|
|
|
session_destroy();
|
|
|
|
session_write_close();
|
|
|
|
|
|
|
|
header('location:/');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down_mp_article() {
|
|
|
|
$aliobj = new mAliyunOSS();
|
|
|
|
$ossUrl = $aliobj->getFileUrl('mp-articles', 'mp_article.zip', 180);
|
|
|
|
|
|
|
|
// 初始化 cURL
|
|
|
|
$ch = curl_init($ossUrl);
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); // 直接输出
|
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
|
|
|
|
|
|
|
// 设置 HTTP Headers,告诉浏览器这是一个下载文件
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
|
|
header('Content-Disposition: attachment; filename="公众号文章.zip"');
|
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
header('Expires: 0');
|
|
|
|
header('Cache-Control: must-revalidate');
|
|
|
|
header('Pragma: public');
|
|
|
|
|
|
|
|
// 打开输出缓冲
|
|
|
|
flush();
|
|
|
|
|
|
|
|
// 执行 cURL 下载并直接输出给客户端
|
|
|
|
curl_exec($ch);
|
|
|
|
|
|
|
|
if (curl_errno($ch)) {
|
|
|
|
http_response_code(500);
|
|
|
|
echo "下载失败: " . curl_error($ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
echo '<script>window.close();</script>';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user_list() {
|
|
|
|
$user_info = $this->get_user_info();
|
|
|
|
if (!$user_info['is_super_admin']) $this->show_message(false, '您还有此权限');
|
|
|
|
|
|
|
|
$uobj = new mUser();
|
|
|
|
$pageid = trim($this->get('pageid'));
|
|
|
|
|
|
|
|
if (!empty($pageid)) {
|
|
|
|
$rdobj = $uobj->initRedis();
|
|
|
|
$sub_user_id = $rdobj->get(sprintf(_RC_KNOWLEDGE_BIND_USER_INFO, $user_info['aid'], $pageid));
|
|
|
|
if (!$sub_user_id) $this->show_message(false, '扫码失败,请刷新重试');
|
|
|
|
|
|
|
|
$bind_user_info = $uobj->getAdminUserById($sub_user_id);
|
|
|
|
if (!$bind_user_info) $this->show_message(false, '绑定失败');
|
|
|
|
|
|
|
|
$this->view['bind_user_info'] = $bind_user_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view['pageid'] = $pageid;
|
|
|
|
$this->view['appid'] = WEIXIN_OPEN_APPID;
|
|
|
|
$this->view['redirect_uri'] = urlencode(CALLBACK_KNOWLEDGE_LOGIN_REDIRECT);
|
|
|
|
$this->view['state'] = CALLBACK_KNOWLEDGE_BIND . "-" . $user_info['aid'] . "-" . $uobj->genPasswd(16);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_user_list() {
|
|
|
|
$user_info = $this->get_user_info();
|
|
|
|
if (!$user_info['is_super_admin']) $this->ajax_json(false, '您还有此权限');
|
|
|
|
|
|
|
|
$condition = array('aid'=>$user_info['aid']);
|
|
|
|
if ($user_info['aid'] == 0) $condition = array();
|
|
|
|
|
|
|
|
$cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1;
|
|
|
|
$page_size = $this->post('pageSize') ? $this->post('pageSize') : 20;
|
|
|
|
|
|
|
|
$uobj = new mUser();
|
|
|
|
$total = $uobj->getAdminUserTotal($condition);
|
|
|
|
$user_list = $uobj->getAdminUserList($condition, $cur_page, $page_size);
|
|
|
|
|
|
|
|
$rdata = array(
|
|
|
|
'total' => $total,
|
|
|
|
'per_page' => $page_size,
|
|
|
|
'last_page' => ceil($total / $page_size),
|
|
|
|
'cur_page' => $cur_page,
|
|
|
|
'list' => $user_list,
|
|
|
|
'aid' => $user_info['aid'],
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $rdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_change_user() {
|
|
|
|
$user_info = $this->get_user_info();
|
|
|
|
if (!$user_info['is_super_admin']) $this->ajax_json(false, '您还有此权限');
|
|
|
|
|
|
|
|
$id = $this->post('id') + 0;
|
|
|
|
$status = $this->post('status') + 0;
|
|
|
|
$realname = trim($this->post('realname'));
|
|
|
|
if (mb_strlen($realname, 'UTF-8') > 10) $this->ajax_json(false, '字数太多啦');
|
|
|
|
|
|
|
|
$data = array();
|
|
|
|
if ($status > 0) $data['status'] = $status;
|
|
|
|
if (!empty($realname)) $data['realname'] = $realname;
|
|
|
|
|
|
|
|
$uobj = new mUser();
|
|
|
|
$res = $uobj->updateAdminUser($id, $data);
|
|
|
|
if (!$res) $this->ajax_json(false, '设置失败');
|
|
|
|
|
|
|
|
$this->ajax_json(true, '设置成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function interlocution() {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|