Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
5891faab
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
18
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,发现更多精彩内容 >>
提交
5891faab
编写于
7月 19, 2017
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加分类是否在菜单中显示选项
上级
a6e149fd
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
102 addition
and
13 deletion
+102
-13
app/appadmin/modules/Catalog/block/category/Index.php
app/appadmin/modules/Catalog/block/category/Index.php
+14
-0
app/appfront/modules/Catalog/block/category/Index.php
app/appfront/modules/Catalog/block/category/Index.php
+16
-2
app/appfront/modules/Catalog/controllers/CategoryController.php
...pfront/modules/Catalog/controllers/CategoryController.php
+4
-3
app/apphtml5/modules/Catalog/block/category/Index.php
app/apphtml5/modules/Catalog/block/category/Index.php
+15
-1
app/apphtml5/modules/Catalog/controllers/CategoryController.php
...phtml5/modules/Catalog/controllers/CategoryController.php
+4
-3
models/mongodb/Category.php
models/mongodb/Category.php
+9
-0
services/Category.php
services/Category.php
+12
-0
services/Url.php
services/Url.php
+9
-0
services/category/CategoryMongodb.php
services/category/CategoryMongodb.php
+14
-2
services/category/Menu.php
services/category/Menu.php
+3
-0
services/email/views/order/create/guest/body_en.php
services/email/views/order/create/guest/body_en.php
+1
-1
services/email/views/order/create/logined/body_en.php
services/email/views/order/create/logined/body_en.php
+1
-1
未找到文件。
app/appadmin/modules/Catalog/block/category/Index.php
浏览文件 @
5891faab
...
...
@@ -253,6 +253,20 @@ class Index extends AppadminbaseBlockEdit implements AppadminbaseBlockEditInterf
'default'
=>
1
,
],
[
'label'
=>
'Menu是否显示'
,
'name'
=>
'menu_show'
,
'display'
=>
[
'type'
=>
'select'
,
'data'
=>
[
1
=>
'菜单中显示'
,
2
=>
'菜单中不显示'
,
],
],
'require'
=>
1
,
'default'
=>
1
,
],
[
'label'
=>
'Url Key'
,
'name'
=>
'url_key'
,
...
...
app/appfront/modules/Catalog/block/category/Index.php
浏览文件 @
5891faab
...
...
@@ -53,7 +53,10 @@ class Index
// 这样是为了防止恶意攻击,也就是发送很多不同的页面个数的链接,绕开缓存。
$this
->
getNumPerPage
();
//echo Yii::$service->page->translate->__('fecshop,{username}', ['username' => 'terry']);
$this
->
initCategory
();
if
(
!
$this
->
initCategory
()){
Yii
::
$service
->
url
->
redirect404
();
return
;
}
// change current layout File.
//Yii::$service->page->theme->layoutFile = 'home.php';
...
...
@@ -471,6 +474,16 @@ class Index
$primaryVal
=
Yii
::
$app
->
request
->
get
(
$primaryKey
);
$this
->
_primaryVal
=
$primaryVal
;
$category
=
Yii
::
$service
->
category
->
getByPrimaryKey
(
$primaryVal
);
if
(
$category
)
{
$enableStatus
=
Yii
::
$service
->
category
->
getCategoryEnableStatus
();
if
(
$category
[
'status'
]
!=
$enableStatus
){
return
false
;
}
}
else
{
return
false
;
}
$this
->
_category
=
$category
;
Yii
::
$app
->
view
->
registerMetaTag
([
'name'
=>
'keywords'
,
...
...
@@ -486,6 +499,7 @@ class Index
$this
->
_title
=
$this
->
_title
?
$this
->
_title
:
$name
;
Yii
::
$app
->
view
->
title
=
$this
->
_title
;
$this
->
_where
=
$this
->
initWhere
();
return
true
;
}
// 面包屑导航
...
...
app/appfront/modules/Catalog/controllers/CategoryController.php
浏览文件 @
5891faab
...
...
@@ -24,13 +24,14 @@ class CategoryController extends AppfrontController
Yii
::
$service
->
page
->
theme
->
layoutFile
=
'category_view.php'
;
}
//
网站信息管理
//
分类页面。
public
function
actionIndex
()
{
$data
=
$this
->
getBlock
()
->
getLastData
();
if
(
is_array
(
$data
)){
return
$this
->
render
(
$this
->
action
->
id
,
$data
);
}
}
/**
* Yii2 behaviors 可以参看地址:http://www.yiichina.com/doc/guide/2.0/concept-behaviors
* 这里的行为的作用为添加page cache(整页缓存)。
...
...
app/apphtml5/modules/Catalog/block/category/Index.php
浏览文件 @
5891faab
...
...
@@ -54,7 +54,10 @@ class Index
// 这样是为了防止恶意攻击,也就是发送很多不同的页面个数的链接,绕开缓存。
$this
->
getNumPerPage
();
//echo Yii::$service->page->translate->__('fecshop,{username}', ['username' => 'terry']);
$this
->
initCategory
();
if
(
!
$this
->
initCategory
()){
Yii
::
$service
->
url
->
redirect404
();
return
;
}
// change current layout File.
//Yii::$service->page->theme->layoutFile = 'home.php';
...
...
@@ -483,6 +486,16 @@ class Index
$primaryVal
=
Yii
::
$app
->
request
->
get
(
$primaryKey
);
$this
->
_primaryVal
=
$primaryVal
;
$category
=
Yii
::
$service
->
category
->
getByPrimaryKey
(
$primaryVal
);
if
(
$category
)
{
$enableStatus
=
Yii
::
$service
->
category
->
getCategoryEnableStatus
();
if
(
$category
[
'status'
]
!=
$enableStatus
){
return
false
;
}
}
else
{
return
false
;
}
$this
->
_category
=
$category
;
Yii
::
$app
->
view
->
registerMetaTag
([
'name'
=>
'keywords'
,
...
...
@@ -498,6 +511,7 @@ class Index
$this
->
_title
=
$this
->
_title
?
$this
->
_title
:
$name
;
Yii
::
$app
->
view
->
title
=
$this
->
_title
;
$this
->
_where
=
$this
->
initWhere
();
return
true
;
}
// 面包屑导航
...
...
app/apphtml5/modules/Catalog/controllers/CategoryController.php
浏览文件 @
5891faab
...
...
@@ -24,13 +24,14 @@ class CategoryController extends AppfrontController
Yii
::
$service
->
page
->
theme
->
layoutFile
=
'category_view.php'
;
}
//
网站信息管理
//
分类页面。
public
function
actionIndex
()
{
$data
=
$this
->
getBlock
()
->
getLastData
();
if
(
is_array
(
$data
)){
return
$this
->
render
(
$this
->
action
->
id
,
$data
);
}
}
public
function
behaviors
()
{
...
...
models/mongodb/Category.php
浏览文件 @
5891faab
...
...
@@ -17,6 +17,14 @@ use yii\mongodb\ActiveRecord;
*/
class
Category
extends
ActiveRecord
{
const
MENU_SHOW
=
1
;
const
MENU_NOT_SHOW
=
2
;
const
STATUS_ENABLE
=
1
;
const
STATUS_DISABLE
=
2
;
/**
* mongodb collection 的名字,相当于mysql的table name
*/
...
...
@@ -35,6 +43,7 @@ class Category extends ActiveRecord
'parent_id'
,
'name'
,
'status'
,
'menu_show'
,
'url_key'
,
'level'
,
'thumbnail_image'
,
...
...
services/Category.php
浏览文件 @
5891faab
...
...
@@ -36,6 +36,18 @@ class Category extends Service
}
}
protected
function
actionGetCategoryEnableStatus
()
{
return
$this
->
_category
->
getCategoryEnableStatus
();
}
protected
function
actionGetCategoryMenuShowStatus
()
{
return
$this
->
_category
->
getCategoryMenuShowStatus
();
}
/**
* 得到当前的category service 对应的主键名称,譬如如果是mongo,返回的是 _id.
*/
...
...
services/Url.php
浏览文件 @
5891faab
...
...
@@ -423,4 +423,13 @@ class Url extends Service
//header("Location: $homeUrl");
}
}
protected
function
actionRedirect404
()
{
$error404UrlKey
=
Yii
::
$app
->
errorHandler
->
errorAction
;
$error404Url
=
$this
->
getUrl
(
$error404UrlKey
);
if
(
$error404Url
)
{
Yii
::
$app
->
getResponse
()
->
redirect
(
$error404Url
)
->
send
();
}
}
}
services/category/CategoryMongodb.php
浏览文件 @
5891faab
...
...
@@ -27,7 +27,18 @@ class CategoryMongodb implements CategoryInterface
{
return
'_id'
;
}
/**
* 得到分类激活状态的值
*/
public
function
getCategoryEnableStatus
(){
return
Category
::
STATUS_ENABLE
;
}
/**
* 得到分类在menu中显示的状态值
*/
public
function
getCategoryMenuShowStatus
(){
return
Category
::
MENU_SHOW
;
}
/**
* 通过主键,得到Category对象。
*/
...
...
@@ -112,7 +123,8 @@ class CategoryMongodb implements CategoryInterface
}
$model
->
updated_at
=
time
();
unset
(
$one
[
'_id'
]);
$one
[
'status'
]
=
(
int
)
$one
[
'status'
];
$one
[
'menu_show'
]
=
(
int
)
$one
[
'menu_show'
];
$saveStatus
=
Yii
::
$service
->
helper
->
ar
->
save
(
$model
,
$one
);
$originUrl
=
$originUrlKey
.
'?'
.
$this
->
getPrimaryKey
()
.
'='
.
$primaryVal
;
$originUrlKey
=
isset
(
$one
[
'url_key'
])
?
$one
[
'url_key'
]
:
''
;
...
...
services/category/Menu.php
浏览文件 @
5891faab
...
...
@@ -26,6 +26,7 @@ class Menu extends Service
*/
protected
function
actionGetCategoryMenuArr
(
$parentId
=
''
)
{
$arr
=
[];
if
(
!
$parentId
)
{
$parentId
=
$this
->
rootCategoryId
;
...
...
@@ -34,6 +35,8 @@ class Menu extends Service
'_id'
,
'parent_id'
,
'name'
,
'url_key'
,
'menu_custom'
,
])
->
where
([
'parent_id'
=>
$parentId
,
'status'
=>
Category
::
STATUS_ENABLE
,
'menu_show'
=>
Category
::
MENU_SHOW
,
])
->
all
();
if
(
is_array
(
$data
)
&&
!
empty
(
$data
))
{
foreach
(
$data
as
$category
)
{
...
...
services/email/views/order/create/guest/body_en.php
浏览文件 @
5891faab
...
...
@@ -55,7 +55,7 @@ use fecshop\app\appfront\helper\Format;
<td>
</td>
<td
valign=
"top"
style=
"padding:7px 9px 9px;font-size:12px;border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-style:solid;border-bottom-style:solid;border-left-style:solid"
>
<p><b>
PayPal -
<?=
$order
[
'payment_method'
]
;
?>
</b></p>
<p><b>
<?=
ucfirst
(
str_replace
(
'_'
,
' '
,
$order
[
'payment_method'
]))
;
?>
</b></p>
</td>
</tr>
...
...
services/email/views/order/create/logined/body_en.php
浏览文件 @
5891faab
...
...
@@ -55,7 +55,7 @@ use fecshop\app\appfront\helper\Format;
<td>
</td>
<td
valign=
"top"
style=
"padding:7px 9px 9px;font-size:12px;border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-style:solid;border-bottom-style:solid;border-left-style:solid"
>
<p><b>
PayPal -
<?=
$order
[
'payment_method'
]
;
?>
</b></p>
<p><b>
<?=
ucfirst
(
str_replace
(
'_'
,
' '
,
$order
[
'payment_method'
]))
;
?>
</b></p>
</td>
</tr>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录