Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
95d2d61f
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
17
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
95d2d61f
编写于
9月 09, 2019
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fecmall界面安装appinstall入口
上级
ec3a6e0d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
160 addition
and
85 deletion
+160
-85
app/appinstall/config/appinstall.php
app/appinstall/config/appinstall.php
+5
-5
app/appinstall/config/modules/Database.php
app/appinstall/config/modules/Database.php
+8
-4
app/appinstall/config/params.php
app/appinstall/config/params.php
+7
-7
app/appinstall/modules/Database/Module.php
app/appinstall/modules/Database/Module.php
+4
-5
app/appinstall/modules/Database/controllers/ConfigController.php
...install/modules/Database/controllers/ConfigController.php
+64
-62
app/appinstall/modules/Database/controllers/ErrorController.php
...pinstall/modules/Database/controllers/ErrorController.php
+32
-0
app/appinstall/modules/Database/views/error/index.php
app/appinstall/modules/Database/views/error/index.php
+29
-0
app/appinstall/modules/Database/views/layouts/main.php
app/appinstall/modules/Database/views/layouts/main.php
+11
-2
未找到文件。
app/appinstall/config/appinstall.php
浏览文件 @
95d2d61f
<?php
/**
* Fec
Shop
file.
* Fec
Mall
file.
*
* @link http://www.fec
shop
.com/
* @copyright Copyright (c) 2016 Fec
Shop
Software LLC
* @license http://www.fec
shop
.com/license/
* @link http://www.fec
mall
.com/
* @copyright Copyright (c) 2016 Fec
Mall
Software LLC
* @license http://www.fec
mall
.com/license/
*/
/**
* 本文件在@appfront/web/index.php 处,会被引入。
...
...
@@ -25,7 +25,7 @@ $config = [
'components'
=>
[
// 404页面对应的url key
'errorHandler'
=>
[
'errorAction'
=>
'
site/helper/error
'
,
'errorAction'
=>
'
database/error/index
'
,
],
// 首页对应的url key
'urlManager'
=>
[
...
...
app/appinstall/config/modules/Database.php
浏览文件 @
95d2d61f
<?php
/**
* Fec
Shop
file.
* Fec
Mall
file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
* @link http://www.fecmall.com/
* @copyright Copyright (c) 2016 FecMall Software LLC
* @license http://www.fecmall.com/license/
*/
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
return
[
/**
...
...
app/appinstall/config/params.php
浏览文件 @
95d2d61f
<?php
/**
* Fec
Shop
file.
* Fec
Mall
file.
*
* @link http://www.fec
shop
.com/
* @copyright Copyright (c) 2016 Fec
Shop
Software LLC
* @license http://www.fec
shop
.com/license/
* @link http://www.fec
mall
.com/
* @copyright Copyright (c) 2016 Fec
Mall
Software LLC
* @license http://www.fec
mall
.com/license/
*/
return
[
/**
* 模板路径配置部分
*/
'appinstallBaseTheme'
=>
'@fecshop/app/appinstall/theme'
,
//
'appinstallBaseTheme' => '@fecshop/app/appinstall/theme',
/**
* 模板默认的layout文件,也就是模板路径下面的layout文件夹下的文件,
* 对于上面的模板路径的配置,也就是文件:@fecshop/app/appfront/theme/base/front/layouts/main.php
*/
'appfrontBaseLayoutName'
=>
'main.php'
,
//
'appfrontBaseLayoutName'=> 'main.php',
/**
* 入口的名字,这个对应入口的文件夹命名。
*/
'appName'
=>
'appinstall'
,
//
'appName' => 'appinstall',
];
app/appinstall/modules/Database/Module.php
浏览文件 @
95d2d61f
<?php
/**
* Fec
Shop
file.
* Fec
Mall
file.
*
* @link http://www.fec
shop
.com/
* @copyright Copyright (c) 2016 Fec
Shop
Software LLC
* @license http://www.fec
shop
.com/license/
* @link http://www.fec
mall
.com/
* @copyright Copyright (c) 2016 Fec
Mall
Software LLC
* @license http://www.fec
mall
.com/license/
*/
namespace
fecshop\app\appinstall\modules\Database
;
...
...
@@ -14,7 +14,6 @@ use Yii;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
* Catalog Module 模块
*/
class
Module
extends
\
yii\base\Module
{
...
...
app/appinstall/modules/Database/controllers/ConfigController.php
浏览文件 @
95d2d61f
<?php
/**
* FecMall file.
*
* @link http://www.fecmall.com/
* @copyright Copyright (c) 2016 FecMall Software LLC
* @license http://www.fecmall.com/license/
*/
namespace
fecshop\app\appinstall\modules\Database\controllers
;
use
Yii
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
ConfigController
extends
\
yii\web\Controller
{
public
function
init
()
...
...
@@ -13,12 +22,30 @@ class ConfigController extends \yii\web\Controller
public
$_migrateLog
=
''
;
// 数据库管理
// 安装默认第一步页面
public
function
actionIndex
()
{
$editForm
=
Yii
::
$app
->
request
->
post
(
'editForm'
);
if
(
$editForm
&&
$this
->
checkDatabaseData
(
$editForm
)
&&
$this
->
updateDatabase
(
$editForm
))
{
Yii
::
$app
->
session
->
setFlash
(
'database-success'
,
'mysql config set success, mysql config file path: @common/config/main-local.php'
);
// 进行跳转
$homeUrl
=
Yii
::
$app
->
homeUrl
;
return
$this
->
redirect
(
$homeUrl
.
'/database/config/migrate'
);
}
$errorInfo
=
Yii
::
$app
->
session
->
getFlash
(
'database-errors'
);
$errorInfo
=
$this
->
getErrorHtml
(
$errorInfo
);
return
$this
->
render
(
$this
->
action
->
id
,
[
'errorInfo'
=>
$errorInfo
,
'editForm'
=>
$editForm
,
]);
}
// 数据库migrate页面
public
function
actionMigrate
()
{
$successInfo
=
Yii
::
$app
->
session
->
getFlash
(
'database-success'
);
$successInfo
=
$this
->
getSuccessHtml
(
$successInfo
);
$errorInfo
=
Yii
::
$app
->
session
->
getFlash
(
'migrate-errors'
);
$errorInfo
=
$this
->
getErrorHtml
(
$errorInfo
);
...
...
@@ -31,17 +58,6 @@ class ConfigController extends \yii\web\Controller
]);
}
public
function
actionComplete
()
{
// 执行 chmod 644 @common/config/main-local
// 删除掉install.php文件
return
$this
->
render
(
$this
->
action
->
id
,
[
]);
}
// 进行测试数据sql的安装和测试图片的复制
public
function
actionAddtestdata
()
{
$errorInfo
=
Yii
::
$app
->
session
->
getFlash
(
'add-test-errors'
);
...
...
@@ -55,7 +71,7 @@ class ConfigController extends \yii\web\Controller
]);
}
// 进行sql migrate ,产品图片的复制
public
function
actionAddtestdatainit
()
{
// 1. 图片的复制
...
...
@@ -63,7 +79,6 @@ class ConfigController extends \yii\web\Controller
//$sourcePath = Yii::getAlias('@fectmelani/app/appimage');
$targetPath
=
Yii
::
getAlias
(
'@appimage'
);
$this
->
copyDir
(
$sourcePath
,
$targetPath
);
// 2. sql文件的执行
$sqlFile
=
dirname
(
Yii
::
getAlias
(
'@common'
))
.
'/environments/test_data/fecshop.sql'
;
$sqlStr
=
file_get_contents
(
$sqlFile
);
...
...
@@ -74,56 +89,40 @@ class ConfigController extends \yii\web\Controller
$innerTransaction
->
commit
();
echo
json_encode
([
'status'
=>
'success'
,
]);
exit
;
]);
exit
;
}
catch
(
\
Exception
$e
)
{
$innerTransaction
->
rollBack
();
$message
=
$e
->
getMessage
();
echo
json_encode
([
'status'
=>
'fail'
,
'info'
=>
$message
,
]);
exit
;
]);
exit
;
}
echo
json_encode
([
'status'
=>
'fail'
,
'info'
=>
'error'
,
]);
'status'
=>
'fail'
,
'info'
=>
'error'
,
]);
exit
;
}
// 进行数据库的migrate操作
// 进行数据库的migrate操作(ajax)
public
function
actionMigrateprocess
()
{
$this
->
runMigrate
();
exit
;
}
// 安装默认第一步页面
public
function
actionIndex
()
// 完成页面
public
function
actionComplete
()
{
$editForm
=
Yii
::
$app
->
request
->
post
(
'editForm'
);
if
(
$editForm
&&
$this
->
checkDatabaseData
(
$editForm
)
&&
$this
->
updateDatabase
(
$editForm
))
{
Yii
::
$app
->
session
->
setFlash
(
'database-success'
,
'mysql config set success, mysql config file path: @common/config/main-local.php'
);
// 进行跳转
$homeUrl
=
Yii
::
$app
->
homeUrl
;
return
$this
->
redirect
(
$homeUrl
.
'/database/config/migrate'
);
}
$errorInfo
=
Yii
::
$app
->
session
->
getFlash
(
'database-errors'
);
$errorInfo
=
$this
->
getErrorHtml
(
$errorInfo
);
return
$this
->
render
(
$this
->
action
->
id
,
[
'errorInfo'
=>
$errorInfo
,
'editForm'
=>
$editForm
,
]);
return
$this
->
render
(
$this
->
action
->
id
,
[]);
}
// 进行数据库的信息的检查,以及将数据库信息写入文件
public
function
updateDatabase
(
$editForm
)
{
...
...
@@ -156,13 +155,15 @@ class ConfigController extends \yii\web\Controller
return
false
;
}
// 得到文件的内容
$mainLocalInfo
=
file_get_contents
(
$mainLocalFile
);
//$mainLocalInfo = require($mainLocalFile);
// 进行文件替换
$mainLocalInfo
=
str_replace
(
'{mysql_host}'
,
$host
,
$mainLocalInfo
);
$mainLocalInfo
=
str_replace
(
'{mysql_database}'
,
$database
,
$mainLocalInfo
);
$mainLocalInfo
=
str_replace
(
'{mysql_user}'
,
$user
,
$mainLocalInfo
);
$mainLocalInfo
=
str_replace
(
'{mysql_password}'
,
$password
,
$mainLocalInfo
);
//
var_dump($mainLocalInfo);exit;
//
写入配置文件
if
(
@
file_put_contents
(
$mainLocalFile
,
$mainLocalInfo
)
===
false
)
{
$errors
=
'Unable to write the file '
.
$mainLocalFile
;
Yii
::
$app
->
session
->
setFlash
(
'database-errors'
,
$errors
);
...
...
@@ -218,24 +219,27 @@ class ConfigController extends \yii\web\Controller
</div>
'
;
}
return
''
;
}
public
function
getErrorHtml
(
$errorInfo
){
if
(
$errorInfo
)
{
return
'
<div class="fecshop_message">
<div class="error-msg">
<div>'
.
$errorInfo
.
'</div>
</div>
</div>
<div class="fecshop_message">
<div class="error-msg">
<div>'
.
$errorInfo
.
'</div>
</div>
</div>
'
;
}
return
''
;
}
/**
* 在yii web环境,执行console中的命令,
* 该函数,相当于执行console命令行 `./yii migrate --interactive=0 --migrationPath=@fecshop/migrations/mysqldb`
*/
public
function
runMigrate
()
{
$oldApp
=
\
Yii
::
$app
;
...
...
@@ -246,10 +250,10 @@ class ConfigController extends \yii\web\Controller
'db'
=>
$oldApp
->
db
,
],
]);
$
dd
=
\
Yii
::
$app
->
runAction
(
'migrate/up'
,
[
'migrationPath'
=>
'@fecshop/migrations/mysqldb'
,
'interactive'
=>
false
]);
$
runResult
=
\
Yii
::
$app
->
runAction
(
'migrate/up'
,
[
'migrationPath'
=>
'@fecshop/migrations/mysqldb'
,
'interactive'
=>
false
]);
\
Yii
::
$app
=
$oldApp
;
return
$
dd
;
return
$
runResult
;
}
/*
...
...
@@ -275,9 +279,8 @@ class ConfigController extends \yii\web\Controller
}
*/
public
function
dir_mkdir
(
$path
=
''
,
$mode
=
0777
,
$recursive
=
true
)
// 创建文件夹,在图片文件复制的过程中使用。
public
function
dirMkdir
(
$path
=
''
,
$mode
=
0777
,
$recursive
=
true
)
{
clearstatcache
();
if
(
!
is_dir
(
$path
))
...
...
@@ -289,7 +292,7 @@ class ConfigController extends \yii\web\Controller
return
true
;
}
/**
* 文件夹文件拷贝
* 文件夹文件拷贝
(递归)
*
* @param string $sourcePath 来源文件夹
* @param string $targetPath 目的地文件夹
...
...
@@ -302,9 +305,8 @@ class ConfigController extends \yii\web\Controller
{
return
false
;
}
$dir
=
opendir
(
$sourcePath
);
$this
->
dir
_m
kdir
(
$targetPath
);
$this
->
dir
M
kdir
(
$targetPath
);
while
(
false
!==
(
$file
=
readdir
(
$dir
)))
{
if
((
$file
!=
'.'
)
&&
(
$file
!=
'..'
))
{
...
...
app/appinstall/modules/Database/controllers/ErrorController.php
0 → 100644
浏览文件 @
95d2d61f
<?php
/**
* FecMall file.
*
* @link http://www.fecmall.com/
* @copyright Copyright (c) 2016 FecMall Software LLC
* @license http://www.fecmall.com/license/
*/
namespace
fecshop\app\appinstall\modules\Database\controllers
;
use
fecshop\app\appfront\modules\AppfrontController
;
use
Yii
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
ErrorController
extends
\
yii\web\Controller
{
public
function
actions
()
{
return
[
'index'
=>
[
'class'
=>
'yii\web\ErrorAction'
,
],
//'captcha' => [
// 'class' => 'yii\captcha\CaptchaAction',
// 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
//],
];
}
}
app/appinstall/modules/Database/views/error/index.php
0 → 100644
浏览文件 @
95d2d61f
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
?>
<?php
/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */
use
yii\helpers\Html
;
$this
->
title
=
$name
;
?>
<div
class=
"main container one-column"
>
<div
class=
"col-main"
>
<div
class=
"content-404 text-center"
>
<h1><b>
OPPS! 404
</b>
We Couldn’t Find this Page
</h1>
<p>
Please contact us if you think this is a server error, Thank you.
</p>
<h2><a
href=
"
<?=
Yii
::
$app
->
homeUrl
;
?>
"
>
Bring me back Home
</a></h2>
</div>
</div>
</div>
app/appinstall/modules/Database/views/layouts/main.php
浏览文件 @
95d2d61f
<?php
/**
* FecMall file.
*
* @link http://www.fecmall.com/
* @copyright Copyright (c) 2016 FecMall Software LLC
* @license http://www.fecmall.com/license/
*/
/* @var $this \yii\web\View */
/* @var $content string */
...
...
@@ -9,7 +15,10 @@ use yii\bootstrap\NavBar;
use
yii\widgets\Breadcrumbs
;
use
fecshop\app\appinstall\assets\AppAsset
;
use
common\widgets\Alert
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
AppAsset
::
register
(
$this
);
?>
<?php
$this
->
beginPage
()
?>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录