Typecho Joe主题开启并修复壁纸相册不显示问题

Typecho Joe主题开启并修复壁纸相册不显示问题

admin
2025-05-24 / 0 评论 / 6 阅读 / 正在检测是否收录...

Joe主题本身支持“壁纸”功能,其实就是相册。
进入后台,创建独立页面,标题随便填,
最关键的是模板要选“壁纸”,直接发布页面即可
此时你会看到一直在转圈圈,你也不知道如何去添加图片

修复显示

进入路径:/usr/themes/Joe-master/core/
打开route.php,直接替换里面的两个函数

function _getWallpaperType($self) 改成
    /* 获取壁纸分类 已测试 √ */
function _getWallpaperType($self)
{
    header('Content-Type: application/json');

    $self->response->setStatus(200);
    $json = file_get_contents("http://cdn.apc.360.cn/index.php?c=WallPaper&a=getAllCategoriesV2&from=360chrome");
    $res = json_decode($json, TRUE);
    if ($res['errno'] == 0) {
        $self->response->throwJson([
            "code" => 1,
            "data" => $res['data']
        ]);
    } else {
        $self->response->throwJson([
            "code" => 0,
            "data" => null
        ]);
    }
}

function _getWallpaperList($self) 改成
/* 获取壁纸列表 已测试 √ */
function _getWallpaperList($self)
{
    header('Content-Type: application/json');

    $self->response->setStatus(200);
    $cid = $self->request->cid;
    $start = $self->request->start;
    $count = $self->request->count;
    $json = file_get_contents("http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid={$cid}&start={$start}&count={$count}&from=360chrome");
    $res = json_decode($json, TRUE);
    if ($res['errno'] == 0) {
        // 数据总数
        $total = $res['total'];
        $self->response->throwJson([
            "code" => 1,
            "data" => $res['data'],
            "total" => $total
        ]);
    } else {
        $self->response->throwJson([
            "code" => 0,
            "data" => null
        ]);
    }
    
}

保存后刷新页面,就可以惊喜的发现能成功显示360壁纸了

0

评论 (0)

取消