添加文档信息和修复主页的bug

This commit is contained in:
yumo 2023-12-14 18:30:24 +08:00
parent e25404ee2f
commit 16cfdb89b6
7 changed files with 249 additions and 5 deletions

View File

@ -225,7 +225,8 @@ class Admin extends AuthController
*/
public function profile(): string
{
$this->assign("info", aModel::find($this->adminId));
$this->assign("info", (new \app\admin\model\Admin)->find($this->adminId));
// dd((new \app\admin\model\Admin)->find($this->adminId));
return $this->fetch();
}

View File

@ -97,7 +97,7 @@
<div class="card">
<div class="card-body">
<div class="edit-avatar">
<img src="{$info.avatar}" alt="{$info.name}" class="img-avatar">
<img src="{$info.avatar}" alt="{$info.nickname}" class="img-avatar">
<div class="avatar-divider"></div>
<div class="edit-avatar-content">
<button class="btn btn-default trigger-btn">修改头像</button>
@ -109,7 +109,7 @@
<input type="hidden" class="form-control" name="avatar" id="avatar" value="{$info.avatar}"/>
<div class="form-group">
<label for="name">用户名</label>
<input type="text" class="form-control" name="name" id="name" value="{$info.name}"
<input type="text" class="form-control" name="username" id="username" value="{$info.username}"
disabled="disabled"/>
</div>
<div class="form-group">

View File

@ -34,8 +34,8 @@ return [
// 异常页面的模板文件
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => root_path(). 'app/common/tpl/dispatch_jump.tpl',
'dispatch_error_tmpl' => root_path(). 'app/common/tpl/dispatch_jump.tpl',
'dispatch_success_tmpl' => public_path() . '/tpl/dispatch_jump.tpl',
'dispatch_error_tmpl' => public_path() . '/tpl/dispatch_jump.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',

120
public/doc/安装教程.md Normal file
View File

@ -0,0 +1,120 @@
# 安装教程
#### 一、ape博客推荐你使用阿里云和腾讯云服务器
阿里云服务器官方长期折扣优惠地址:
点击访问,([https://www.aliyun.com/daily-act/ecs/activity_selection?userCode=dery8ymr](https://www.aliyun.com/daily-act/ecs/activity_selection?userCode=dery8ymr))
腾讯云服务器官方长期折扣优惠地址:
点击访问,([https://curl.qcloud.com/G8kYi1YB](https://curl.qcloud.com/G8kYi1YB))
服务器最低配置:
```auto
1核CPU (建议2核+)
2G内存 (建议4G+)
2M带宽 (建议5M+)
```
#### 二、服务器运行环境要求
```auto
PHP >= 7.1
Mysql >= 5.5.0 (需支持innodb引擎)
Apache 或 Nginx
PDO PHP Extension
MBstring PHP Extension
CURL PHP Extension
Composer (用于管理第三方扩展包)
```
#### 三、系统安装
**方式一:完整包安装**
第一步:前往官网博客下载页面 ([https://gitee.com/muziys/apeblog/releases](https://gitee.com/muziys/apeblog/releases)) 下载完整包解压到你的项目目录
第二步添加虚拟主机并绑定到项目的public目录
第三步:访问 [http://www.yoursite.com/install/index](http://www.yoursite.com/install/index) 进行安装
**方式二:命令行安装(推荐)**
推荐使用命令行安装因为采用命令行安装的方式可以和勾股blog随时保持更新同步。使用命令行安装请提前准备好`Git`、`Composer`。
**Linux下勾股blog的安装请使用以下命令进行安装**
第一步克隆ape博客到你本地
```shell
git clone https://gitee.com/gougucms/blog.git
```
复制
第二步:进入目录
```shell
cd blog
```
复制
第三步下载PHP依赖包
composer install
第四步添加虚拟主机并绑定到项目的public目录
实际部署中确保绑定域名访问到的是public目录。
第五步:访问 [http://www.yoursite.com/install/index](http://www.yoursite.com/install/index) 进行安装
⚠️ 注意:安装过程中,系统会自动创建数据库,请确保填写的数据库用户的权限可创建数据库,如果权限不足,请先手动创建空的数据库,然后填写刚创建的数据库名称和用户名也可完成安装。
🔺 提醒:安装过程中,如果进度条卡住,一般都是数据库写入权限或者安装环境配置问题,请注意检查。
遇到解决不了的问题请到QQ群反馈24641076群一满46924914群二满,295256660群三
✅ PS如需要重新安装请删除目录里面 config/install.lock 的文件,即可重新安装。
#### 四、伪静态配置
**Nginx**
修改nginx.conf 配置文件 加入下面的语句。
```shell
location /admin/ {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/admin/(.*)$ /admin.php?s=$1;
}
}
location /api/ {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/api/(.*)$ /api.php?s=$1;
}
}
location / {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
```
**Apache**
把下面的内容保存为.htaccess文件放到应用入 public 文件的同级目录下。
```shell
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin/(.*)$ admin.php?s=$1;
RewriteRule ^api/(.*)$ api.php?s=$1;
RewriteRule ^(.*)$ index.php?s=$1 [L]
</IfModule>
```

View File

@ -0,0 +1,72 @@
# 常见问题
1、安装失败可能存在php配置文件禁止了`putenv`和`proc_open`函数。解决方法,查找`php.ini`文件位置,打开`php.ini`,搜索`disable_functions`项,看是否禁用了`putenv` 和`proc_open`函数。如果在禁用列表里,移除`putenv` `proc_open`然后退出重启php即可。
2、如果安装后打开页面提示`404`错误,请检查服务器伪静态配置,如果是宝塔面板,网站伪静态请配置使用`thinkphp规则`。
**伪静态配置如下:**
**Nginx**
修改nginx.conf 配置文件 加入下面的语句。
```shell
location /admin/ {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/admin/(.*)$ /admin.php?s=$1;
}
}
location /api/ {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/api/(.*)$ /api.php?s=$1;
}
}
location / {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
```
**Apache**
把下面的内容保存为.htaccess文件放到应用入 public 文件的同级目录下。
```shell
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin/(.*)$ admin.php?s=$1;
RewriteRule ^api/(.*)$ api.php?s=$1;
RewriteRule ^(.*)$ index.php?s=$1 [L]
</IfModule>
```
3、如果提示当前权限不足无法写入配置文件`config/database.php`,请检查`database.php`是否可读还有可能是当前安装程序无法访问父目录请检查PHP的`open_basedir`配置。
4、如果`composer install`失败,请尝试在命令行进行切换配置到国内源,命令如下:
```shell
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
```
复制
5、如果`composer install`失败请尝试composer降级
```shell
composer self-update
```
复制
6、如果`composer install`失败,请尝试删除项目文件,重新拉取。
7、访问 [http://www.yoursite.com/install/index](http://www.yoursite.com/install/index) ,请注意查看伪静态请配置是否设置了`thinkphp规则`。
8、遇到问题请到QQ**1099438829** 反馈,或者到**Issue**里面反馈,谢谢!

View File

@ -0,0 +1,51 @@
**初始的目录结构如下:**
```auto
www 系统部署目录(或者子目录)
├── app 应用目录
│ ├── admin 后台模块目录
│ │ ├── config 后台配置文件目录
│ │ ├── controller 控制器目录
│ │ ├── extend 拓展目录
│ │ ├── lang 语言文件目录
│ │ ├── model 模型目录
│ │ ├── subscribes 事件目录
│ │ └── view 视图模板目录
│ ├── api
│ │ └── controller 控制器目录
│ ├── common 公共目录
│ │ ├── constant 全局变量目录
│ │ ├── extend 拓展目录
│ │ ├── model 模型目录
│ │ ├── paginator 分页组件
│ │ ├── taglib 模板拓展标签
│ │ └── validate 校验器目录
│ └── index
│ ├── config 配置目录
│ ├── controller 控制器目录
│ ├── route 路由目录
│ └── validate 校验器目录
├── config 配置文件目录
├── public 公共目录
│ ├── doc 文档目录
│ ├── install 安装模块目录(系统安装完后,建议删除)
│ │ ├── css 安装器css
│ │ ├── images 图片资源
│ │ ├── js js资源
│ │ └── templates 模板
│ ├── static 系统静态资源
│ │ ├── admin 后台静态资源
│ │ └── banner banner静态文件
│ ├── storage 文件存储目录
│ │ └── image 图片目录
│ ├── template 主题目录
│ │ └── default 默认主题
│ └── tpl 系统跳转等模板目录
├───route 路由目录
├───vendor 第三方类库目录(Composer依赖库目录)
├───runtime 应用的运行时目录(可写,可定制)
├───composer.json composer 定义文件
├───LICENSE.txt 授权说明文件
├───README.md README 文件
├───think 命令行入口文件
```