Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHO-ACTIVITY-PHP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
68ecc2cbf68bb3fc80f19724a3894324913c8558
1 parent
7e3e8cde
fixes bug to maylike data show
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
67 deletions
library/Plugin/DataProcess/ListProcess.php
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
library/Plugin/DataProcess/ListProcess.php
View file @
68ecc2c
<?php
namespace
Plugin\DataProcess
;
use
Plugin\Helpers
;
/**
...
...
@@ -19,8 +20,7 @@ class ListProcess
{
$result
=
array
();
if
(
isset
(
$data
[
'product_list'
]))
{
if
(
isset
(
$data
[
'product_list'
]))
{
$result
[
'new'
]
=
self
::
getProductData
(
$data
[
'product_list'
]);
}
if
(
$returnFilter
&&
isset
(
$data
[
'filter'
]))
{
...
...
@@ -28,7 +28,6 @@ class ListProcess
}
return
$result
;
}
/**
...
...
@@ -47,7 +46,6 @@ class ListProcess
}
return
$products
;
}
/**
...
...
@@ -60,23 +58,21 @@ class ListProcess
public
static
function
getFilterData
(
$data
,
$gender
=
'1,2,3'
)
{
// 过滤条件数据
$filters
=
array
(
'classify'
=>
array
());
$filters
=
array
(
'classify'
=>
array
());
// 返回数据中有没有gender时要添加gender
// $data['gender'] = array('2,3'=>'GIRLS','1,3'=>'BOYS');
$num
=
1
;
foreach
(
$data
as
$key
=>
$val
)
{
if
(
empty
(
$val
))
{
if
(
empty
(
$val
))
{
continue
;
}
if
(
!
is_callable
(
"self::
$key
"
))
{
continue
;
}
$build
=
self
::
$key
(
$val
,
$gender
);
if
(
$num
===
1
)
{
if
(
$num
===
1
)
{
$build
[
'active'
]
=
true
;
}
...
...
@@ -88,7 +84,6 @@ class ListProcess
self
::
sortArrByField
(
$filters
[
'classify'
],
'sort_col'
);
return
$filters
;
}
private
static
function
brand
(
$data
)
...
...
@@ -167,7 +162,7 @@ class ListProcess
foreach
(
$data
as
$key
=>
$one
)
{
$discount
=
array
();
$discount
[
'dataId'
]
=
$key
;
$discount
[
'name'
]
=
$one
[
'name'
]
.
'折商品'
;
$discount
[
'name'
]
=
$one
[
'name'
]
.
'折商品'
;
$result
[
'subs'
][]
=
$discount
;
}
...
...
@@ -200,7 +195,9 @@ class ListProcess
// 处理选中状态
foreach
(
$result
[
'subs'
]
as
&
$val
)
{
$val
[
'dataId'
]
===
$gender
&&
$val
[
'chosed'
]
=
true
;
if
(
$val
[
'dataId'
]
===
$gender
)
{
$val
[
'chosed'
]
=
true
;
}
}
return
$result
;
...
...
@@ -222,23 +219,24 @@ class ListProcess
)
);
$category
=
array
();
foreach
(
$data
as
$one
)
{
$category
=
array
();
$category
[
'dataId'
]
=
isset
(
$one
[
'relation_parameter'
])
?
$one
[
'relation_parameter'
][
'sort'
]
:
0
;
$category
[
'name'
]
=
$one
[
'category_name'
];
/*// 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
/* // 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
$category['subs'][] = $subitem;
}
}*/
$category['subs'][] = $subitem;
}
} */
$result
[
'subs'
][]
=
$category
;
}
...
...
@@ -262,8 +260,9 @@ class ListProcess
)
);
$price
=
array
();
foreach
(
$data
as
$key
=>
$one
)
{
$price
=
array
();
$price
[
'dataId'
]
=
$key
;
$price
[
'name'
]
=
$one
;
...
...
@@ -289,9 +288,10 @@ class ListProcess
)
);
$size
=
array
();
foreach
(
$data
as
$one
)
{
$size
=
array
();
$size
[
'dataId'
]
=
$one
[
'size_id'
];
$size
[
'dataId'
]
=
$one
[
'size_id'
];
$size
[
'name'
]
=
$one
[
'size_name'
];
$result
[
'subs'
][]
=
$size
;
...
...
@@ -307,7 +307,8 @@ class ListProcess
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
){
private
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
)
{
$fieldArr
=
array
();
foreach
(
$array
as
$k
=>
$v
)
{
$fieldArr
[
$k
]
=
$v
[
$field
];
...
...
@@ -315,4 +316,5 @@ class ListProcess
$sort
=
$desc
==
false
?
SORT_ASC
:
SORT_DESC
;
array_multisort
(
$fieldArr
,
$sort
,
$array
);
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
68ecc2c
...
...
@@ -19,7 +19,7 @@ class HomeController extends AbstractAction
public
function
indexAction
()
{
// 目前跳到老站
$this
->
go
(
OLD_MAIN
.
'/home'
);
//
$this->go(OLD_MAIN . '/home');
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
68ecc2c
...
...
@@ -16,6 +16,6 @@ class IndexController extends AbstractAction
public
function
indexAction
()
{
// 跳转到老版
$this
->
go
(
OLD_MAIN
.
'/cart/index/index'
);
//
$this->go(OLD_MAIN . '/cart/index/index');
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
View file @
68ecc2c
...
...
@@ -36,11 +36,11 @@ class RecomController extends AbstractAction
$gender
=
$this
->
get
(
'gender'
,
'1,3'
);
// 女
if
(
$gender
===
'2,3'
)
{
$recom
=
RecomData
::
mayLike
(
'2,3'
,
2
);
$recom
=
RecomData
::
mayLike
(
'2,3'
,
2
,
$page
);
}
// 男
else
{
$recom
=
RecomData
::
mayLike
(
'1,3'
,
1
);
$recom
=
RecomData
::
mayLike
(
'1,3'
,
1
,
$page
);
}
/* 判断是否有内容返回 */
...
...
@@ -59,6 +59,9 @@ class RecomController extends AbstractAction
$data
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
,
true
,
true
,
276
,
366
);
}
$this
->
_view
->
display
(
'maylike'
,
$data
);
exit
();
}
while
(
false
);
echo
' '
;
...
...
@@ -101,6 +104,7 @@ class RecomController extends AbstractAction
$data
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
);
}
$this
->
_view
->
display
(
'maylike'
,
$data
);
exit
();
}
while
(
false
);
...
...
@@ -179,45 +183,11 @@ class RecomController extends AbstractAction
// }
$this
->
_view
->
display
(
'maylikelife'
,
$data
);
exit
();
}
while
(
false
);
echo
' '
;
}
// /**
// * 你可能喜欢的
// *
// * 备注:
// * 调用位于男生(BOYS),女生(GIRLS),潮童(KIDS),创意生活(LifeStyle)页面的底部.
// * 调用方式为AJAX,需要用JS遍历该数据集,替换图片URL地址中的{width},{height},{mode}.
// * JS替换示例: str.replace("{width}", 300).replace("{height}", 300).replace("{mode}", 2);
// *
// * @param string gender "1,3"表示男, "2,3"表示女, 当channel为3时该参数可不传
// * @param string channel 1表示男, 2表示女, 3表示潮童
// * @return json
// */
// public function maylikeAction()
// {
// if ($this->isAjax()) {
// $data = '';
// $gender = $this->get('gender', '1,3');
// $channel = $this->get('channel', '1');
//
// switch (strval($channel)) {
// case '1': // 男(Boys)
// case '2': // 女(Girls)
// $data = RecomData::mayLike($gender, $channel);
// break;
// case '3': // 潮童(Kids)
// $data = RecomData::mayLikeKids();
// break;
// case '4': // 创意生活(LifeStyle)
// $data = RecomData::mayLikeLifestyle();
// break;
// }
//
// $this->echoJson($data);
// }
// }
}
...
...
Please
register
or
login
to post a comment