配置优化 #3

Merged
pengda merged 1 commits from wpd_config into master 2 months ago
  1. 6
      control/callback.php
  2. 11
      control/index.php
  3. 8
      model/mManage.php
  4. 14
      model/mSpider.php
  5. 6
      model/mUser.php
  6. 6
      model/mWeibo.php
  7. 2
      model/mWeixinOpen.php
  8. 2
      view/templates/weibo/home.html

6
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;

11
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();
}
}

8
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");

14
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'];

6
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) {

6
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;
}

2
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 {

2
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>

Loading…
Cancel
Save