diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a2f25b7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.vscode
+config/database.ini
diff --git a/2UcNOgLCeM.txt b/2UcNOgLCeM.txt
new file mode 100644
index 0000000..fb7caec
--- /dev/null
+++ b/2UcNOgLCeM.txt
@@ -0,0 +1 @@
+8bec5d05184fa430e594cafd50a68020
\ No newline at end of file
diff --git a/KNix1gprzP.txt b/KNix1gprzP.txt
new file mode 100644
index 0000000..195e0e4
--- /dev/null
+++ b/KNix1gprzP.txt
@@ -0,0 +1 @@
+202ca7f83350f7987b48c24211077c87
\ No newline at end of file
diff --git a/api.php b/api.php
new file mode 100644
index 0000000..b76feca
--- /dev/null
+++ b/api.php
@@ -0,0 +1,170 @@
+beforecheckpara();
+ $this->checkpara();
+ $this->aftercheckpara();
+ $this->action();
+ $this->display();
+ }
+
+ private function beforecheckpara() {
+ }
+
+ private function checkpara() {
+ $argv = trim(trim($_GET['argv']),'/');
+ if(empty($argv)) {
+ $this->control_name = 'weibo';
+ $this->control_func = 'home';
+ } else {
+ $array = explode('/', $argv);
+ $this->control_name = $array[0];
+ $this->control_func = !isset($array[1]) || $array[1]=='' ? 'home' : $array[1];
+
+ if(preg_match('/^(login|loginout).*/', $this->control_name)){
+ $this->control_name = 'index';
+ $this->control_func = $array[0];
+ }
+ }
+
+ // 还原GET
+ if(!empty($array)) {
+ unset($_GET['argv']);
+ unset($array[0]);
+ unset($array[1]);
+
+ $count = count($array);
+ for($i=1;$i<=$count/2;$i++) {
+ $_GET[$array[$i*2]] = $array[$i*2+1];
+ }
+ }
+
+ // 如果URI带有常规传参形式,并入$_GET
+ $pos = strpos($_SERVER['REQUEST_URI'], '?');
+ if($pos!==false) {
+ $new_uri = substr($_SERVER['REQUEST_URI'], $pos+1);
+ $new_uri_arr = explode("&", $new_uri);
+ foreach($new_uri_arr as $v) {
+ $new_para = explode("=", $v);
+ $_GET[$new_para[0]] = $new_para[1];
+ }
+ }
+ }
+
+ private function aftercheckpara() {
+ session_start();
+ session_write_close();
+
+ //登陆检查
+ $needlogin = true;
+ if ($this->control_name == 'index') {
+ if (preg_match('/^(ajax_login).*/', $this->control_func)) {
+ $needlogin = false;
+ }
+ }elseif($this->control_name == 'callback'){
+ $needlogin = false;
+ }
+
+ if($_POST['str'] == FREE_LOGIN_STR){
+ $needlogin = false;
+
+ if($this->control_name !== 'weibo' || $this->control_func == 'home') $this->ajax_json(false, '暂无权限');
+ }
+
+ if ($needlogin) {
+ $data = $this->checkAuth();
+ if (!$data) $this->ajax_json(false, $this->getError());
+
+ $uobj = new mUser();
+ $user_info = $uobj->getAdminUserByOpenid($data['openid']);
+ if(empty($user_info) || $user_info['status'] != 1) $this->ajax_json(false, '登陆失败');
+
+ if($this->control_name == 'weibo' && $user_info['aid'] != 1 && $user_info['is_super_admin'] != 1) $this->ajax_json(false, '暂无权限');
+
+ $this->view['_user_info'] = $this->para['_user_info'] = $user_info;
+ }
+ }
+
+ private function action() {
+ $control_func = empty($this->control_func) ? 'home' : $this->control_func;
+
+ // 判断控制层文件是否存在
+ $control_path = dirname(__FILE__).'/control/'.$this->control_name.'.php';
+ if(!file_exists($control_path)) {
+ die('/'.$this->control_name.'.php not exist.');
+ }
+ include_once ($control_path);
+
+ // 判断控制层方法是否存在
+ $obj = new $this->control_name;
+ ##如下根据情况传递公共变量值##################
+ if (is_array($this->para)) {
+ foreach ($this->para as $k=>$v) {
+ $func = 'set' . $k;
+ $obj->$func($v);
+ }
+ }
+ ##如上根据情况传递公共变量值##################
+ if (method_exists($obj, $control_func)) {
+ $res = $obj->$control_func();
+ } else {
+ die('method '.$this->control_func.' not exist.');
+ }
+
+ if($obj->getViewFormat()=='json' && $res===false) {
+ echo urldecode($obj->getError());
+ exit;
+ }
+
+ $this->view = array_merge($this->view, $obj->getView());
+ $this->viewFormat = $obj->getViewFormat();
+ $this->viewTpl = $obj->getViewTpl();
+ }
+
+ private function display() {
+ if($this->viewFormat=='json') {
+ $display = new DisplayJson();
+ } elseif($this->viewFormat=='string') {
+ $display = new DisplayNone();
+ } else {
+ $tpl_path = $this->viewTpl=='' ? $this->control_name.'/'.$this->control_func.'.html' : $this->viewTpl;
+ if(!file_exists(dirname(__FILE__) . '/view/templates/'.$tpl_path)) { // 判断模板是否存在
+ die("{$tpl_path} not exist.");
+ }
+ $display = new DisplaySmarty($tpl_path);
+ }
+
+ $display->setView($this->view);
+ $display->execute();
+ }
+
+ private function checkAuth() {
+ $auth = $_SERVER['HTTP_AUTHORIZATION'];
+ if (empty($auth)) {
+ $this->setError('token为空');
+ return false;
+ }
+
+ $jwtobj = new mJwt();
+ $data = $jwtobj->getJwtDecode($auth);
+ if (!$data) {
+ $this->setError($jwtobj->getError());
+ return false;
+ }
+ if (time() > $data['exp']) {
+ $this->setError('token过期');
+ return false;
+ }
+
+ return $data;
+ }
+ }
+
+ new run();
+
+
diff --git a/cache/template_c/%%1D^1D0^1D0BA4CE%%footer.html.php b/cache/template_c/%%1D^1D0^1D0BA4CE%%footer.html.php
new file mode 100644
index 0000000..3569539
--- /dev/null
+++ b/cache/template_c/%%1D^1D0^1D0BA4CE%%footer.html.php
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/cache/template_c/%%24^24D^24DFFC2B%%interlocution.html.php b/cache/template_c/%%24^24D^24DFFC2B%%interlocution.html.php
new file mode 100644
index 0000000..6ca23ef
--- /dev/null
+++ b/cache/template_c/%%24^24D^24DFFC2B%%interlocution.html.php
@@ -0,0 +1,712 @@
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/header.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
欢迎使用DeepSeek Chat!开始一个新的对话吧。
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+

+
+
+
+
+
+
+
+
内容由 AI 生成,请仔细甄别
+
+
+
+
+
+
+ // 新对话按钮点击事件
+ // document.querySelector(\'.new-chat-btn\').addEventListener(\'click\', function () {
+ // // 这里可以添加创建新对话的逻辑
+ // alert(\'创建新对话\');
+ // });
+ $(document).ready(function () {
+ var loadFlag = false;
+
+ // 对话数据存储
+ let conversations = {
+ // 示例数据
+ "conversation1": {
+ id: "conversation1",
+ title: "草莓糖的作者最喜欢色设计",
+ messages: [{
+ role: "user",
+ content: "草莓糖的作者是谁?"
+ },
+ {
+ role: "assistant",
+ content: "草莓糖是由皮克斯动画工作室创作的..."
+ }
+ ],
+ timestamp: new Date().getTime(),
+ group: "today"
+ },
+ "conversation2": {
+ id: "conversation2",
+ title: "西瓜考试满分笑话解析",
+ messages: [{
+ role: "user",
+ content: "西瓜考试满分是什么笑话?"
+ },
+ {
+ role: "assistant",
+ content: "这是一个关于西瓜参加考试..."
+ }
+ ],
+ timestamp: new Date().getTime() - 3600000 * 2,
+ group: "today"
+ },
+ "conversation3": {
+ id: "conversation3",
+ title: "Vue子路由配置方法详解",
+ messages: [{
+ role: "user",
+ content: "如何在Vue中配置子路由?"
+ },
+ {
+ role: "assistant",
+ content: "在Vue Router中,你可以使用children属性..."
+ }
+ ],
+ timestamp: new Date().getTime() - 86400000 * 11,
+ group: "7days"
+ }
+ };
+
+ let currentConversationId = null;
+ // 侧边栏状态
+ let sidebarCollapsed = false;
+
+ marked.setOptions({
+ highlight: function (code, lang) {
+ if (hljs.getLanguage(lang)) {
+ return hljs.highlight(lang, code).value;
+ }
+ return hljs.highlightAuto(code).value;
+ }
+ });
+ // 切换侧边栏
+ function toggleSidebar() {
+ sidebarCollapsed = !sidebarCollapsed;
+ $(\'#sidebar\').toggleClass(\'collapsed\', sidebarCollapsed);
+
+ // 更新切换按钮图标
+ const icon = sidebarCollapsed ? \'menu\' : \'close\';
+ // $(\'#toggleSidebar i\').attr(\'class\', \'icon icon-\' + icon);
+
+ // 如果是移动端,处理主内容区域的偏移
+ if (window.innerWidth <= 768) {
+ if (sidebarCollapsed) {
+ $(\'#sidebar\').removeClass(\'collapsed\');
+ $(\'#sidebar\').css(\'transform\', \'translateX(-100%)\');
+ } else {
+ $(\'#sidebar\').css(\'transform\', \'translateX(0)\');
+ }
+ }
+
+ // 保存状态到本地存储
+ localStorage.setItem(\'sidebarCollapsed\', sidebarCollapsed);
+ }
+ $(\'#openMenu, .ds-icon-box\').on(\'click\', function () {
+ // sidebarCollapsed = !sidebarCollapsed;
+ // $(\'#sidebar\').toggleClass(\'collapsed\', sidebarCollapsed);
+ toggleSidebar()
+ })
+
+ // 初始化侧边栏状态
+ function initSidebarState() {
+ const savedState = localStorage.getItem(\'sidebarCollapsed\');
+ if (savedState !== null) {
+ sidebarCollapsed = savedState === \'true\';
+ $(\'#sidebar\').toggleClass(\'collapsed\', sidebarCollapsed);
+
+ const icon = sidebarCollapsed ? \'expand\' : \'retract\';
+ // $(\'#toggleSidebar\').attr(\'src\', `{$smarty.const.CSS_URL}/images/${icon}.svg`);
+
+ if (window.innerWidth <= 768 && !sidebarCollapsed) {
+ $(\'#sidebar\').css(\'transform\', \'translateX(-100%)\');
+ }
+ }
+ }
+ // 绑定事件
+ $(\'#toggleSidebar\').click(toggleSidebar);
+ $(\'#mobileMenuToggle\').click(function () {
+ if (window.innerWidth <= 768) {
+ $(\'#sidebar\').css(\'transform\', \'translateX(0)\');
+ } else {
+ toggleSidebar();
+ }
+ });
+
+
+ $(\'.conversation-list\').on(\'click\', \'.conversation-item\', function () {
+ $(\'.conversation-list .conversation-item\').removeClass(\'b64fb9ae\')
+ $(this).addClass(\'b64fb9ae\')
+ })
+
+ $(\'.ds-button--primary\').click(function () {
+ if ($(this).hasClass(\'ds-button--primary-active\')) {
+ $(this).removeClass(\'ds-button--primary-active\')
+ } else {
+ $(this).addClass(\'ds-button--primary-active\')
+ }
+ })
+
+ // 初始化对话列表
+ function renderConversationList() {
+ const $list = $(\'#conversationList\');
+ $list.empty();
+
+ // 分组对话
+ const today = [];
+ const last7Days = [];
+ const last30Days = [];
+ const now = new Date().getTime();
+
+ Object.values(conversations).forEach(conv => {
+ const diff = now - conv.timestamp;
+ // console.log(diff, \'diff---\');
+ if (diff < 86400000) {
+ today.push(conv);
+ } else if (diff < 86400000 * 7) {
+ last7Days.push(conv);
+ } else {
+ last30Days.push(conv);
+ }
+ });
+
+ // 渲染今天
+ if (today.length > 0) {
+ $list.append(\'
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/header.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+ - class="active">选中评论
+ - class="active">剔除评论
+ - class="active">全部评论
+
+
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/footer.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/header.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
预览
+

+
×
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+ const maxLength = 100; // 设置最大字数限制
+ $(\'.normal-input\').on(\'input\', function () {
+ var currentLength = $(this).val().length;
+ $(\'.char-count\').text(currentLength + \'/\' + maxLength);
+ if (currentLength > maxLength) {
+ $(\'.normal-input\').val($(\'.normal-input\').val().slice(0, maxLength))
+ $(\'.char-count\').text(maxLength + \'/\' + maxLength);
+ }
+ });
+ $(\'.answer-input\').on(\'input\', function () {
+ var currentLength = $(this).val().length;
+ $(\'.char-count1\').text(currentLength + \'/\' + maxLength);
+ if (currentLength > maxLength) {
+ $(\'.answer-input\').val($(\'.answer-input\').val().slice(0, maxLength))
+ $(\'.char-count1\').text(maxLength + \'/\' + maxLength);
+ }
+ });
+
+ '; ?>
+
+
+
+
+
+
+
+
+
+
支持 jpg、png、mp4 格式,单个文件不超过 10MB
+
+
+
+
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/footer.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/cache/template_c/%%74^74D^74D2651F%%user_list.html.php b/cache/template_c/%%74^74D^74D2651F%%user_list.html.php
new file mode 100644
index 0000000..4c2136f
--- /dev/null
+++ b/cache/template_c/%%74^74D^74D2651F%%user_list.html.php
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/header.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
子账号管理
+
+
+
+
+
+ _tpl_vars['_user_info']['aid'] == 0): ?>
+ AID |
+
+ 账号昵称 |
+ 姓名 |
+ 添加时间 |
+ 启用状态 |
+
+
+
+
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增子账号
+ _tpl_vars['bind_user_info']): ?>
+

+
+
+
+ var obj = new WxLogin({
+ id: "login_container",
+ appid: "'; ?>
+_tpl_vars['appid']; ?>
+
+_tpl_vars['redirect_uri']; ?>
+
+_tpl_vars['state']; ?>
+
+ '; ?>
+
+
+
+
+

+
_tpl_vars['bind_user_info']['nickname']; ?>
+,扫码成功
+
+
+
+ 微信扫码,绑定子账号
+
+
+
+

+ 姓名
+
+
+
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/footer.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/cache/template_c/%%91^91E^91E815D2%%show_detail.html.php b/cache/template_c/%%91^91E^91E815D2%%show_detail.html.php
new file mode 100644
index 0000000..4403210
--- /dev/null
+++ b/cache/template_c/%%91^91E^91E815D2%%show_detail.html.php
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/header.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
预览
+

+
×
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+ const maxLength = 100; // 设置最大字数限制
+ $(\'.normal-input\').on(\'input\', function () {
+ var currentLength = $(this).val().length;
+ $(\'.char-count\').text(currentLength + \'/\' + maxLength);
+ if (currentLength > maxLength) {
+ $(\'.normal-input\').val($(\'.normal-input\').val().slice(0, maxLength))
+ $(\'.char-count\').text(maxLength + \'/\' + maxLength);
+ }
+ });
+ $(\'.answer-input\').on(\'input\', function () {
+ var currentLength = $(this).val().length;
+ $(\'.char-count1\').text(currentLength + \'/\' + maxLength);
+ if (currentLength > maxLength) {
+ $(\'.answer-input\').val($(\'.answer-input\').val().slice(0, maxLength))
+ $(\'.char-count1\').text(maxLength + \'/\' + maxLength);
+ }
+ });
+
+ '; ?>
+
+
+
+
+
+
+
+
+
+
支持 jpg、png、mp4 格式,单个文件不超过 10MB
+
+
+
+
+
+
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/footer.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cache/template_c/%%EC^EC2^EC26F5B8%%header.html.php b/cache/template_c/%%EC^EC2^EC26F5B8%%header.html.php
new file mode 100644
index 0000000..2f7b968
--- /dev/null
+++ b/cache/template_c/%%EC^EC2^EC26F5B8%%header.html.php
@@ -0,0 +1,44 @@
+
+
+
+ $(\'.dropdown-toggle\').click(function () {
+ const dropdownPanel = document.querySelector(\'.dropdown-panel\');
+ const icon = document.querySelector(\'.icon\');
+ // 切换面板的显示/隐藏
+ if (dropdownPanel.style.display === \'block\') {
+ dropdownPanel.style.display = \'none\';
+ icon.classList.remove(\'rotate\'); // 移除旋转效果
+ } else {
+ dropdownPanel.style.display = \'block\';
+ icon.classList.add(\'rotate\'); // 添加旋转效果
+ }
+ })
+
+'; ?>
\ No newline at end of file
diff --git a/cache/template_c/%%EF^EF7^EF70A257%%login.html.php b/cache/template_c/%%EF^EF7^EF70A257%%login.html.php
new file mode 100644
index 0000000..2e7f1b6
--- /dev/null
+++ b/cache/template_c/%%EF^EF7^EF70A257%%login.html.php
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+

+
私有云知识库
+
+
+
+ var obj = new WxLogin({
+ id: "login_container",
+ appid: "'; ?>
+_tpl_vars['appid']; ?>
+
+_tpl_vars['redirect_uri']; ?>
+
+_tpl_vars['state']; ?>
+
+ '; ?>
+
+
+
+

+
点击刷新
+
+
+
+

+
+
+
+ 扫码后请在手机上确认登录
+
+
+
+
+ _tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "include/footer.html", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 3655716..775e61d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,6 @@
{
"require": {
- "firebase/php-jwt": "^6.0"
+ "firebase/php-jwt": "^6.0",
+ "elasticsearch/elasticsearch": "^5.5"
}
}
diff --git a/composer.lock b/composer.lock
index e0aeaf3..2c3c815 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,9 +4,68 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "0f2c3a727a6da4acd150a914dd810575",
+ "content-hash": "67d1a482855231a4755a2b557ff31331",
"packages": [
{
+ "name": "elasticsearch/elasticsearch",
+ "version": "v5.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/elastic/elasticsearch-php.git",
+ "reference": "48b8a90e2b97b4d69ce42851c1b9e59f8054661a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/48b8a90e2b97b4d69ce42851c1b9e59f8054661a",
+ "reference": "48b8a90e2b97b4d69ce42851c1b9e59f8054661a",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/ringphp": "~1.0",
+ "php": "^5.6|^7.0",
+ "psr/log": "~1.0"
+ },
+ "require-dev": {
+ "cpliakas/git-wrapper": "~1.0",
+ "doctrine/inflector": "^1.1",
+ "mockery/mockery": "0.9.4",
+ "phpunit/phpunit": "^4.7|^5.4",
+ "sami/sami": "~3.2",
+ "symfony/finder": "^2.8",
+ "symfony/yaml": "^2.8"
+ },
+ "suggest": {
+ "ext-curl": "*",
+ "monolog/monolog": "Allows for client-level logging and tracing"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Elasticsearch\\": "src/Elasticsearch/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Zachary Tong"
+ }
+ ],
+ "description": "PHP Client for Elasticsearch",
+ "keywords": [
+ "client",
+ "elasticsearch",
+ "search"
+ ],
+ "support": {
+ "issues": "https://github.com/elastic/elasticsearch-php/issues",
+ "source": "https://github.com/elastic/elasticsearch-php/tree/v5.5.0"
+ },
+ "time": "2019-07-18T15:11:30+00:00"
+ },
+ {
"name": "firebase/php-jwt",
"version": "v6.0.0",
"source": {
@@ -62,6 +121,239 @@
"source": "https://github.com/firebase/php-jwt/tree/v6.0.0"
},
"time": "2022-01-24T15:18:34+00:00"
+ },
+ {
+ "name": "guzzlehttp/ringphp",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/RingPHP.git",
+ "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b",
+ "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/streams": "~3.0",
+ "php": ">=5.4.0",
+ "react/promise": "~2.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "ext-curl": "Guzzle will use specific adapters if cURL is present"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Ring\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
+ "support": {
+ "issues": "https://github.com/guzzle/RingPHP/issues",
+ "source": "https://github.com/guzzle/RingPHP/tree/1.1.1"
+ },
+ "abandoned": true,
+ "time": "2018-07-31T13:22:33+00:00"
+ },
+ {
+ "name": "guzzlehttp/streams",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/streams.git",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Stream\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple abstraction over streams of data",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "Guzzle",
+ "stream"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/streams/issues",
+ "source": "https://github.com/guzzle/streams/tree/master"
+ },
+ "abandoned": true,
+ "time": "2014-10-12T19:18:40+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/1.1.4"
+ },
+ "time": "2021-05-03T11:20:27+00:00"
+ },
+ {
+ "name": "react/promise",
+ "version": "v2.11.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/reactphp/promise.git",
+ "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/reactphp/promise/zipball/1a8460931ea36dc5c76838fec5734d55c88c6831",
+ "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "React\\Promise\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Sorgalla",
+ "email": "jsorgalla@gmail.com",
+ "homepage": "https://sorgalla.com/"
+ },
+ {
+ "name": "Christian Lück",
+ "email": "christian@clue.engineering",
+ "homepage": "https://clue.engineering/"
+ },
+ {
+ "name": "Cees-Jan Kiewiet",
+ "email": "reactphp@ceesjankiewiet.nl",
+ "homepage": "https://wyrihaximus.net/"
+ },
+ {
+ "name": "Chris Boden",
+ "email": "cboden@gmail.com",
+ "homepage": "https://cboden.dev/"
+ }
+ ],
+ "description": "A lightweight implementation of CommonJS Promises/A for PHP",
+ "keywords": [
+ "promise",
+ "promises"
+ ],
+ "support": {
+ "issues": "https://github.com/reactphp/promise/issues",
+ "source": "https://github.com/reactphp/promise/tree/v2.11.0"
+ },
+ "funding": [
+ {
+ "url": "https://opencollective.com/reactphp",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2023-11-16T16:16:50+00:00"
}
],
"packages-dev": [],
diff --git a/config/define.php b/config/define.php
index 75a3bfb..ed6f55b 100644
--- a/config/define.php
+++ b/config/define.php
@@ -53,6 +53,7 @@
define('WEIBO_LOGIN_COOKIE', '_2A25FMHeEDeRhGeFH41MV8ibNyjSIHXVmTPVMrDV8PUNbmtAYLWLlkW9NekLV22uXkAnuAlCngnjVjozSXR5mujv7');
define('_RQ_SPIDER_WEIBO_BEHAVIOR', 'rq_spider_weibo_behavior');
+ define('_RQ_SPIDER_WEIBO_COMMENT', 'rq_spider_weibo_comment');
define('WEIBO_DETAIL_URL', 'https://weibo.yizherenxin.cn/detail/%s?v=1');
@@ -78,3 +79,28 @@
define('BEHAVIOR_TYPE_COMMENTS', 1);
define('BEHAVIOR_TYPE_ATTITUDES', 2);
+ define('ZHISHIKU_SPIDER_LOG', 'zhishiku_spider_log');
+ define('ZHISHIKU_SPIDER_COMMENT', 'zhishiku_spider_comment.log');
+
+ define('ZHISHIKU_SPIDER_TEMP_PATH', DATACENTER_ROOT.'/zhishiku_spider_temp/');
+ define('ZHISHIKU_SPIDER_COMMENT_PATH', ZHISHIKU_SPIDER_TEMP_PATH.'/spider_comment/%s/%s.log');
+
+ // 采集评论状态 0=未采集 1=采集时出现错误中断 2=采集成功
+ define('SPIDER_COMMENT_STATUS_NO', 0);
+ define('SPIDER_COMMENT_STATUS_ERROR', 1);
+ define('SPIDER_COMMENT_STATUS_SUCCESS', 2);
+
+ define('_RS_SPIDER_WEIBO_COMMENT', 'rs_spider_weibo_comment');
+ define('_RC_WEIBO_COMMENT_LOGIN_COOKIE2', 'rc_weibo_comment_login_cookie2');
+
+ define('WEIBO_LOGIN_COOKIE2', '_2A25FdJmRDeRhGeFG71sY9CbOyDuIHXVmC5NZrDV8PUNbmtAYLUj1kW9NeUknrDj_DFv7tUuAQqx1kWSg_y3B4Qe3');
+
+ //该条评论是否能被搜索 -1=未处理 0=否 1=是
+ define('SPIDER_COMMENT_SEARCH_STATUS_WAIT', -1);
+ define('SPIDER_COMMENT_SEARCH_STATUS_NO', 0);
+ define('SPIDER_COMMENT_SEARCH_STATUS_YES', 1);
+ $GLOBALS['SPIDER_COMMENT_SEARCH_STATUS_LIST'] = array(
+ SPIDER_COMMENT_SEARCH_STATUS_WAIT => '待筛选',
+ SPIDER_COMMENT_SEARCH_STATUS_NO => '已剔除',
+ SPIDER_COMMENT_SEARCH_STATUS_YES => '筛选通过',
+ );
diff --git a/control/index.php b/control/index.php
index 20027b9..e8fc1cd 100644
--- a/control/index.php
+++ b/control/index.php
@@ -95,6 +95,7 @@ class index extends publicBase {
$this->ajax_json(true, '设置成功');
}
+
public function interlocution() {
}
diff --git a/control/weibo.php b/control/weibo.php
index 5bd6a6e..92467e4 100644
--- a/control/weibo.php
+++ b/control/weibo.php
@@ -9,13 +9,63 @@ class weibo extends publicBase {
public function home() {}
+ public function comments() {}
+
+ public function comment_detail() {
+ $id = $this->get('id') + 0;
+
+ $obj = new mWeibo();
+ $weibo = $obj->getWeiboDetailById($id);
+ if (empty($weibo)) $this->show_message('微博不存在', 'goback');
+
+ $this->view['data'] = $weibo;
+
+ $cur_page = $this->get('page')+0 > 0 ? $this->get('page')+0 : 1;
+ $page_size = $this->get('size')+0 > 0 ? $this->get('size')+0 : 20;
+
+ $cond = array();
+ $is_search = $this->get('search_type') + 0;
+ if(isset($_GET['search_type']) && $is_search >= 0) $cond['is_search'] = $is_search;
+
+ $mobj = new mWeiboComments();
+
+ $total = $mobj->getCommentCountByWeiboId($id, $cond);
+ $this->view['last_page'] = ceil($total / $page_size);
+
+ $cur_page = $cur_page > $this->view['last_page'] ? $this->view['last_page'] : $cur_page;
+ $this->view['total'] = $total;
+ $this->view['per_page'] = $page_size;
+ $this->view['cur_page'] = $cur_page;
+
+ $comment_list = $mobj->getCommentByWeiboId($id, $cur_page, $page_size, 'id asc', $cond);
+ if(!empty($comment_list)) {
+ foreach ($comment_list as $k => $v) {
+ $comment_save_path = sprintf(ZHISHIKU_SPIDER_COMMENT_PATH, $weibo['wid'], $v['weibo_data_id']);
+ if(!file_exists($comment_save_path)) $this->show_message('评论数据文件不存在', 'goback');
+ $cdata = json_decode(file_get_contents($comment_save_path), true);
+ $comment_list[$k]['comment_time'] = date('Y-m-d H:i:s', strtotime($cdata['created_at']));
+ $comment_list[$k]['source'] = $cdata['source'];
+ $comment_list[$k]['screen_name'] = $cdata['user']['screen_name'];
+ }
+
+ $this->view['comment_list'] = $comment_list;
+ $this->view['search_status_list'] = $GLOBALS['SPIDER_COMMENT_SEARCH_STATUS_LIST'];
+ }
+ }
+
public function ajax_weibo_list() {
$status = $this->post('status') + 0;
+ $spider_comment_status = $this->post('spider_comment_status') + 0;
$cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1;
$page_size = $this->post('pageSize') ? $this->post('pageSize') : 20;
$condition = array();
- $condition['status'] = $status;
+ if ($spider_comment_status) {
+ $condition['spider_comment_status'] = $spider_comment_status;
+ $condition['uid'] = WEIBO_USER_ZHANG;
+ }else{
+ $condition['status'] = $status;
+ }
$obj = new mWeibo();
$total = $obj->getWeiboTotal($condition);
diff --git a/data/dBase.php b/data/dBase.php
index 367bae5..29f54dc 100644
--- a/data/dBase.php
+++ b/data/dBase.php
@@ -68,7 +68,7 @@ class dBase extends publicBase {
try {
$conn[PDO::ATTR_TIMEOUT] = 3;
if($GLOBALS['pconnect_db']===true) $conn[PDO::ATTR_PERSISTENT] = true;
- $conn[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES UTF8;";
+ $conn[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8mb4;";
$db = new PDO('mysql:host='.$cnf['host'].';port='.$cnf['port'].';dbname='.$cnf['db'],$cnf['user'],$cnf['pwd'], $conn);
} catch(PDOException $e) {
//error_log('['.date('Y-m-d H:i:s').'][first-fail]'.implode('|', $cnf).':'.$e->getMessage()."\n", 3, LOG_PATH_BASE.'/mysql/stat_todb_'.date('Y-m-d').'.log');
@@ -76,7 +76,7 @@ class dBase extends publicBase {
try {
$conn[PDO::ATTR_TIMEOUT] = 3;
if($GLOBALS['pconnect_db']===true) $conn[PDO::ATTR_PERSISTENT] = true;
- $conn[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES UTF8;";
+ $conn[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8mb4;";
$db = new PDO('mysql:host='.$cnf['host'].';port='.$cnf['port'].';dbname='.$cnf['db'],$cnf['user'],$cnf['pwd'], $conn);
} catch(PDOException $e) {
//error_log('['.date('Y-m-d H:i:s').'][second-fail]'.implode('|', $cnf).':'.$e->getMessage()."\n", 3, LOG_PATH_BASE.'/mysql/stat_todb_'.date('Y-m-d').'.log');
@@ -124,6 +124,40 @@ class dBase extends publicBase {
}
}
+ /*
+ * 数据库事务操作
+ * 封装标准方法
+ * @param string $sqls sql语句数组 array(0 =>array('sql'=>$sql, 'val'=>$val), 1 =>array('sql'=>$sql, 'val'=>$val))
+ * 将根据sql数组index顺序执行,执行SQL的表必须是innodb
+ */
+ public function execTrans2($sqls) {
+ $this->ismaster = true;
+ self::getInstance();
+
+ try {
+ self::$link->beginTransaction(); // 开启事务处
+
+ foreach ($sqls as $sqlval) {
+ if(trim($sqlval['sql'])=='') continue;
+
+ $st = self::$link->prepare($sqlval['sql']);
+ $res = $st->execute($sqlval['vals']);
+ if(!$res) {
+ error_log(date('Y-m-d H:i:s').'|'.$sqlval['sql'].':'.json_encode($st->errorInfo())."\n", 3, LOG_PATH_BASE.'/mysql/execTrans_zhishiku_'.date('Y-m-d').'.log');
+ self::$link->rollBack();
+ return false;
+ }
+ $st->closeCursor();
+ }
+
+ self::$link->commit(); // 事务处理结束
+
+ } catch(PDOException $e) {
+ return false;
+ }
+ return true;
+ }
+
/**
* 批量插入
* 封装标准方法
@@ -746,6 +780,7 @@ class dBase extends publicBase {
$st = self::$link->prepare($sql);
$res = $st->execute();
if(!$res) {
+ error_log(date('Y-m-d H:i:s').'|'.$sql.':'.json_encode($st->errorInfo())."\n", 3, LOG_PATH_BASE.'/mysql/execTrans_zhishiku_'.date('Y-m-d').'.log');
self::$link->rollBack();
return false;
}
diff --git a/data/dWeibo.php b/data/dWeibo.php
index 8afde58..fcd99d0 100644
--- a/data/dWeibo.php
+++ b/data/dWeibo.php
@@ -24,6 +24,7 @@ class dWeibo extends dBase {
'comments_count',
'attitudes_count',
'status',
+ 'spider_comment_status'
),
);
diff --git a/data/dWeiboComments.php b/data/dWeiboComments.php
new file mode 100644
index 0000000..b07326c
--- /dev/null
+++ b/data/dWeiboComments.php
@@ -0,0 +1,23 @@
+ array(
+ 'id',
+ 'weibo_id',
+ 'content',
+ 'weibo_data_id',
+ 'is_search',
+ 'comment_time',
+ 'create_time',
+ )
+ );
+
+ protected $primary_keys = array(
+ );
+}
+
diff --git a/images/67d93962abf73.jpg b/images/67d93962abf73.jpg
new file mode 100644
index 0000000..207c585
Binary files /dev/null and b/images/67d93962abf73.jpg differ
diff --git a/images/67d939894cdf7.jpg b/images/67d939894cdf7.jpg
new file mode 100644
index 0000000..207c585
Binary files /dev/null and b/images/67d939894cdf7.jpg differ
diff --git a/images/67d939cb74eda.jpg b/images/67d939cb74eda.jpg
new file mode 100644
index 0000000..4bae9f0
Binary files /dev/null and b/images/67d939cb74eda.jpg differ
diff --git a/login.html b/login.html
new file mode 100644
index 0000000..7c5c15b
--- /dev/null
+++ b/login.html
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+ ` + item.source + `
+ ${item.question ? `${item.question}` :''}
+ ` + item.name + `
+ 录入:` + item.lurutime + `
+
+ ${
+ tabActive == '1' ? `

编辑
` :''
+ }
+
+
+
+ ${item.desc}
+
+
+
+ ${imagesHTML}
+
+
+ ${tabActive == '1' || tabActive == '2' ? '' : ''}
+ ${tabActive == '1' ? '' : ''}
+ ${tabActive == '3' || tabActive == '2' ? '' : ''}
+
+
`
+ $('#data-list').html(html1);
+ });
+
+ // 渲染分页按钮
+ renderPagination();
+ }
+
+ // 渲染分页按钮
+ function renderPagination() {
+ const pageNumbers = $('#page-numbers');
+ pageNumbers.empty();
+
+ // 总页数小于等于 7 时,显示所有页码
+ if (totalPages <= 7) {
+ for (let i = 1; i <= totalPages; i++) {
+ pageNumbers.append(`