Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
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
whb
9 years ago
Commit
51302b14cce67d073b1bf82dc8d42b0255af5dbb
1 parent
7be76677
channel处理
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
7 deletions
library/Plugin/DataProcess/WebChannel/Process.php
yohobuy/www.yohobuy.com/application/models/Index/Home.php
library/Plugin/DataProcess/WebChannel/Process.php
View file @
51302b1
<?php
namespace
Plugin\DataProcess\WebChannel
;
use
Plugin\Images
;
use
Plugin\Helpers
;
/**
* web版通用处理器
*/
...
...
@@ -46,13 +48,37 @@ class Process
);
}
foreach
(
$data
[
'menuNav'
][
'blocks'
]
as
$val
)
{
$temp
[
'tplrecommend'
][
'keyword'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'name'
=>
$val
[
'title'
],
'img'
=>
[
'src'
]);
$val
[
'img'
]
=
Images
::
getImageUrl
(
$val
[
'img'
],
185
,
76
,
1
);
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
$temp
[
'tplrecommend'
][
'keyword'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'name'
=>
$val
[
'title'
],
'img'
=>
$val
[
'img'
]);
}
foreach
(
$data
[
'menuNav'
][
'list'
]
as
$val
)
{
if
(
empty
(
$val
[
'name'
])
&&
empty
(
$val
[
'url'
]))
{
continue
;
}
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
$temp
[
'tplrecommend'
][
'category'
][]
=
array
(
'name'
=>
$val
[
'name'
],
'url'
=>
$val
[
'url'
]);
}
foreach
(
$data
[
'imgs'
]
as
$val
)
{
$temp
[
'tplrecommend'
][
'types'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'name'
=>
$val
[
'title'
],
'img'
=>
[
'src'
]);
foreach
(
$data
[
'imgs'
]
as
$key
=>
$val
)
{
$w
=
185
;
$h
=
248
;
if
(
$key
==
0
)
{
$w
=
377
;
$h
=
504
;
}
$val
[
'img'
]
=
Images
::
getImageUrl
(
$val
[
'img'
],
$w
,
$h
,
1
);
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
if
(
$key
==
0
)
{
$temp
[
'tplrecommend'
][
'brands'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'name'
=>
$val
[
'title'
],
'img'
=>
$val
[
'img'
]);
}
else
{
$temp
[
'tplrecommend'
][
'types'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'name'
=>
$val
[
'title'
],
'img'
=>
$val
[
'img'
]);
}
}
$result
[
'recommend'
]
=
$temp
;
return
$result
;
...
...
@@ -69,8 +95,12 @@ class Process
{
$result
=
array
();
$temp
=
array
();
$width
=
1150
;
$height
=
450
;
if
(
$data
[
'focus_type'
]
==
1
)
{
foreach
(
$data
[
'data'
]
as
$val
)
{
$val
[
'src'
]
=
Images
::
getImageUrl
(
$val
[
'src'
],
$width
,
$height
,
1
);
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
$temp
[]
=
array
(
'href'
=>
$val
[
'url'
],
'img'
=>
$val
[
'src'
]);
}
$result
[
'slide'
][
'list'
]
=
$temp
;
...
...
@@ -96,31 +126,46 @@ class Process
if
(
$data
[
$key
][
'template_name'
]
==
'text'
&&
$data
[
$key
+
1
][
'template_name'
]
==
'textNav'
&&
$data
[
$key
+
2
][
'template_name'
]
==
'goods'
&&
$data
[
$key
+
3
][
'template_name'
]
==
'floor'
)
{
//text模版
$temp
[
'singlehot'
][
'name'
]
=
$val
[
'data'
][
'text'
];
//goods模版
foreach
(
$data
[
$key
+
2
][
'data'
]
as
$val
)
//TODO
{
$temp
[
'singlehot'
][
'imgHot'
][]
=
array
(
'href'
=>
''
,
//$val['url'],
'name'
=>
''
,
'price'
=>
''
);
}
//floor模版
foreach
(
$data
[
$key
+
3
][
'data'
]
as
$val
)
{
$val
[
'src'
]
=
Images
::
getImageUrl
(
$val
[
'src'
],
185
,
86
,
1
);
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
$temp
[
'singlehot'
][
'brands'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'img'
=>
$val
[
'src'
],
'name'
=>
$val
[
'title'
]);
}
$result
[
$key
]
=
$temp
;
unset
(
$data
[
$key
],
$data
[
$key
+
1
],
$data
[
$key
+
2
],
$data
[
$key
+
3
]);
}
}
if
(
isset
(
$data
[
$key
])
&&
isset
(
$data
[
$key
+
1
]))
//优选品牌 [ template: text & focus]
if
(
isset
(
$data
[
$key
])
&&
isset
(
$data
[
$key
+
1
]))
//优选品牌 [ template: text & focus
]
{
$temp
=
array
(
'preferenceBrands'
=>
array
(
'name'
=>
''
,
'slider'
=>
array
()));
if
(
$data
[
$key
][
'template_name'
]
==
'text'
&&
$data
[
$key
+
1
][
'template_name'
]
==
'focus'
)
{
$temp
[
'preferenceBrands'
][
'name'
]
=
$val
[
'data'
][
'text'
];
//focus 分类
foreach
(
$data
[
$key
+
1
][
'data'
]
as
$val
)
{
$width
=
320
;
$height
=
430
;
$val
[
'src'
]
=
Images
::
getImageUrl
(
$val
[
'src'
],
$width
,
$height
,
1
);
$val
[
'url'
]
=
Helpers
::
transUrl
(
$val
[
'url'
],
$type
);
$temp
[
'preferenceBrands'
][
'slider'
][]
=
array
(
'href'
=>
$val
[
'url'
],
'img'
=>
$val
[
'src'
]);
}
$result
[
$key
]
=
$temp
;
unset
(
$data
[
$key
],
$data
[
$key
+
1
]);
}
...
...
yohobuy/www.yohobuy.com/application/models/Index/Home.php
View file @
51302b1
...
...
@@ -139,11 +139,8 @@ class HomeModel
public
static
function
getChannelResource
(
$content_code
)
{
$resource
=
IndexData
::
getResourceData
(
$content_code
);
header
(
'Content-Type:text/html;charset=utf-8 '
);
//格式化数据
$data
=
ChannelProcess
::
getFormat
(
'kids'
,
$resource
[
'data'
]);
print_r
(
$data
);
exit
();
return
$data
;
}
...
...
Please
register
or
login
to post a comment