From 2b1adaa87f0ed60559af88b96903e294004d2989 Mon Sep 17 00:00:00 2001
From: pengda <10266652509@qq.com>
Date: Fri, 21 Mar 2025 16:31:46 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 control/callback.php           |  6 +++---
 control/index.php              | 11 ++++++++---
 model/mManage.php              |  8 ++++----
 model/mSpider.php              | 14 +++++++-------
 model/mUser.php                |  6 +++---
 model/mWeibo.php               |  6 +++---
 model/mWeixinOpen.php          |  2 +-
 view/templates/weibo/home.html |  2 +-
 8 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/control/callback.php b/control/callback.php
index 3f48fbb..cd25f47 100644
--- a/control/callback.php
+++ b/control/callback.php
@@ -3,12 +3,12 @@
  *
  */
 
-include_once(dirname(dirname(__FILE__))."/library/publicBase.php");
+include_once(dirname(dirname(__FILE__)) . "/library/publicBase.php");
 
 class callback extends publicBase {
 
     public function wxlogin() {
-        if(empty($this->get('code'))) $this->show_message('登录失败,请重新登录','goback');
+        if (empty($this->get('code'))) $this->show_message('登录失败,请重新登录', 'goback');
 
         $state = explode('-', $this->get('state'));
         if ($state[0] == CALLBACK_KNOWLEDGE_LOGIN) {
@@ -22,7 +22,7 @@ class callback extends publicBase {
             $_SESSION['token'] = $res['jwttoken'];
             session_write_close();
 
-            header('Location:'.urldecode($state[1]));
+            header('Location:' . urldecode($state[1]));
             exit;
         }
         exit;
diff --git a/control/index.php b/control/index.php
index fea1ade..fd56b4b 100644
--- a/control/index.php
+++ b/control/index.php
@@ -3,7 +3,7 @@
  *
  */
 
-include_once(dirname(dirname(__FILE__))."/library/publicBase.php");
+include_once(dirname(dirname(__FILE__)) . "/library/publicBase.php");
 
 class index extends publicBase {
 
@@ -11,9 +11,14 @@ class index extends publicBase {
         $this->login();
     }
 
-    public function login() {
-    }
+    public function login() {}
 
     public function loginout() {
+        session_start();
+        session_destroy();
+        session_write_close();
+
+        header('location:/');
+        exit();
     }
 }
diff --git a/model/mManage.php b/model/mManage.php
index 21c88a7..a34b26b 100644
--- a/model/mManage.php
+++ b/model/mManage.php
@@ -2,7 +2,7 @@
 /**
  *
  */
-include_once(SERVER_ROOT."/model/mBase.php");
+include_once(SERVER_ROOT . "/model/mBase.php");
 
 
 class mManage extends mBase {
@@ -43,9 +43,9 @@ class mManage extends mBase {
         $agent_login_info = $uobj->getAdminUserByOpenid($res['openid']);
         if (empty($agent_login_info)) {
             $login_user_info = $uobj->getLoginUserByOpenid($res['openid']);
-            if(empty($login_user_info)) $login_user_info = $uobj->addLoginUser(array('openid' => $res['openid']));
+            if (empty($login_user_info)) $login_user_info = $uobj->addLoginUser(array('openid' => $res['openid']));
 
-            if(empty($login_user_info)){
+            if (empty($login_user_info)) {
                 $this->setError("注册失败");
                 return false;
             }
@@ -75,7 +75,7 @@ class mManage extends mBase {
 
     private function getJwtToken($jwtdata) {
         $jwtobj = new mJwt();
-        $jwtobj->expire = 30*24*60*60;
+        $jwtobj->expire = 30 * 24 * 60 * 60;
         $jwttoken = $jwtobj->getJwtEncode($jwtdata);
         if (empty($jwttoken)) {
             $this->setError("登录失败|jwt");
diff --git a/model/mSpider.php b/model/mSpider.php
index 6918e90..9e3af5d 100644
--- a/model/mSpider.php
+++ b/model/mSpider.php
@@ -2,7 +2,7 @@
 /**
  *
  */
-include_once(SERVER_ROOT."/model/mBase.php");
+include_once(SERVER_ROOT . "/model/mBase.php");
 
 
 class mSpider extends mBase {
@@ -14,10 +14,10 @@ class mSpider extends mBase {
 
     public function getZmhttpIp($task_key) {
         $rdobj = $this->initRedis();
-        $aa = $rdobj->get('aaa');
-        if($aa) return false;
+        $ip_request = $rdobj->get('ip_request');
+        if ($ip_request) return false;
 
-        $rdobj->setex('aaa', 60, 1);
+        $rdobj->setex('ip_request', 60, 1);
 
         $url = "http://proxy.siyetian.com/apis_get.html?token=AesJWLNp2a65kaJdXTqFFeNpWT35ERNpnTn1STqFUeORUR31kaNh3TUl0dPRUQy4ERJdXT6lVN.QMxkTO0MjM0cTM&limit=1&type=1&time=&data_format=json&showTimeEnd=true";
         $jsoninfo = $this->getCUrl($url);
@@ -124,7 +124,7 @@ class mSpider extends mBase {
         $html = $this->getRequest($url, $headers);
         if (!$html) {
             $this->setError($this->curl_err);
-            $this->writeLog('spider', 'curl_error.log', $this->curl_err."|".$url."|".$html);
+            $this->writeLog('spider', 'curl_error.log', $this->curl_err . "|" . $url . "|" . $html);
             return false;
         }
 
@@ -138,7 +138,7 @@ class mSpider extends mBase {
                 $content = $data[0]['status'];
             }
         }
-        if(empty($content)) {
+        if (empty($content)) {
             $this->setError($html);
             return 'error';
         }
@@ -163,7 +163,7 @@ class mSpider extends mBase {
         $return['comments_count'] = $content['comments_count'];
         $return['attitudes_count'] = $content['attitudes_count'];
 
-        if($content['retweeted_status']){
+        if ($content['retweeted_status']) {
             $return['retweeted_status'] = array();
 
             $return['retweeted_status']['wid'] = $content['retweeted_status']['id'];
diff --git a/model/mUser.php b/model/mUser.php
index 39e8add..a9d1ab4 100644
--- a/model/mUser.php
+++ b/model/mUser.php
@@ -2,7 +2,7 @@
 /**
  *
  */
-include_once(SERVER_ROOT."/model/mBase.php");
+include_once(SERVER_ROOT . "/model/mBase.php");
 
 
 class mUser extends mBase {
@@ -18,11 +18,11 @@ class mUser extends mBase {
     }
 
     public function getAdminUserByOpenid($openid) {
-        return $this->obj->select($this->tbl, array('sql'=>'`openid`=?', 'vals'=>array($openid)));
+        return $this->obj->select($this->tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
     }
 
     public function getLoginUserByOpenid($openid) {
-        return $this->obj->select($this->login_tbl, array('sql'=>'`openid`=?', 'vals'=>array($openid)));
+        return $this->obj->select($this->login_tbl, array('sql' => '`openid`=?', 'vals' => array($openid)));
     }
 
     public function addLoginUser($data) {
diff --git a/model/mWeibo.php b/model/mWeibo.php
index 1025acb..e8498f1 100644
--- a/model/mWeibo.php
+++ b/model/mWeibo.php
@@ -34,8 +34,8 @@ class mWeibo extends mBase {
 
         foreach ($list as &$v) {
             $v['name'] = '微博粉丝';
-            if($v['uid'] == 2282201403) $v['name'] = '张宝旬';
-            if($v['uid'] == 1) $v['name'] = '管理员';
+            if ($v['uid'] == 2282201403) $v['name'] = '张宝旬';
+            if ($v['uid'] == 1) $v['name'] = '管理员';
 
             $pic_ids = json_decode($v['pic_ids'], 1);
             $pic_arr = array();
@@ -77,7 +77,7 @@ class mWeibo extends mBase {
             $data['pic_arr'][] = $this->getPicOssUrl($pic_id, $data['created_at']);
         }
         if ($data['video_url']) $data['video_url'] = $this->getVideoOssUrl($data['wid'], $data['created_at']);
-        if ($data['video_cover'])  $data['video_cover'] = $this->getPicOssUrl($data['wid'], $data['created_at']);
+        if ($data['video_cover']) $data['video_cover'] = $this->getPicOssUrl($data['wid'], $data['created_at']);
 
         return $data;
     }
diff --git a/model/mWeixinOpen.php b/model/mWeixinOpen.php
index db6ab1a..062513d 100644
--- a/model/mWeixinOpen.php
+++ b/model/mWeixinOpen.php
@@ -2,7 +2,7 @@
 /**
  * 微信开放平台
  */
-include_once(SERVER_ROOT."/model/mBase.php");
+include_once(SERVER_ROOT . "/model/mBase.php");
 
 class mWeixinOpen extends mBase {
 
diff --git a/view/templates/weibo/home.html b/view/templates/weibo/home.html
index 4bc2c3f..c7edc9d 100644
--- a/view/templates/weibo/home.html
+++ b/view/templates/weibo/home.html
@@ -4,7 +4,7 @@
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Document</title>
+    <title>知识库</title>
     <link rel="stylesheet" href="{$smarty.const.CSS_URL}/css/common.css?v={$smarty.const.CSS_JS_VERSION}">
     <link rel="stylesheet" href="{$smarty.const.CSS_URL}/css/index.css?v={$smarty.const.CSS_JS_VERSION}">
     <script src="{$smarty.const.CSS_URL}/js/jquery-3.6.0.min.js"></script>
-- 
1.8.3.1