Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
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
郝肖肖
9 years ago
Commit
72af45c0c4f19e26036d5f0a8874d6f833683bba
1 parent
41301643
店铺人气单品用一个方法
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
61 deletions
library/Plugin/DataProcess/ShopProcess.php
library/Plugin/DataProcess/ShopProcess.php
View file @
72af45c
...
...
@@ -311,73 +311,22 @@ class ShopProcess
*/
private
static
function
hotProducts_APP
(
$data
)
{
$condition
[
'query'
]
=
''
;
$productSkn
=
array
();
foreach
(
$data
as
$val
)
{
$
condition
[
'query'
]
.=
$val
[
'productSkn'
]
.
','
;
$
productSkn
[]
=
$val
[
'productSkn'
]
;
}
/* tar modified 160826 根据资源位接口返回的 skn 去查数据,查到后取商品数据,查不到取资源位接口数据 */
$hotProducts
=
SearchData
::
searchBySkn
(
$condition
);
if
(
isset
(
$hotProducts
[
'code'
])
&&
$hotProducts
[
'code'
]
===
200
&&
isset
(
$hotProducts
[
'data'
][
'product_list'
]))
{
foreach
(
$hotProducts
[
'data'
][
'product_list'
]
as
$val
)
{
/* 取第一个设为默认商品 goods */
$defaultGoods
=
$val
[
'goods_list'
][
0
];
/* 判断是否设置了默认 goods,如果设置了就重新赋值 */
foreach
(
$val
[
'goods_list'
]
as
$key
=>
$goods
)
{
if
(
$goods
[
'is_default'
]
===
'Y'
)
{
$defaultGoods
=
$goods
;
}
}
$goodsCover
=
$val
[
'goods_list'
][
0
][
'images_url'
];
if
(
self
::
$channel
==
1
)
{
$goodsCover
=
empty
(
$defaultGoods
[
'cover_1'
])
?
$defaultGoods
[
'images_url'
]
:
$defaultGoods
[
'cover_1'
];
}
if
(
self
::
$channel
==
2
)
{
$goodsCover
=
empty
(
$defaultGoods
[
'cover_2'
])
?
$defaultGoods
[
'images_url'
]
:
$defaultGoods
[
'cover_2'
];
}
$product
=
DetailData
::
productBatch
(
$productSkn
);
if
(
$product
[
'code'
]
===
200
&&
isset
(
$product
[
'data'
][
'product_list'
]))
{
/* 如果还是没取到,取 product 默认图片 */
if
(
empty
(
$goodsCover
))
{
$goodsCover
=
$val
[
'default_images'
];
}
$goods
=
array
(
'url'
=>
Helpers
::
getUrlBySkc
(
$val
[
'product_id'
],
$val
[
'goods_list'
][
0
][
'goods_id'
],
$val
[
'cn_alphabet'
]),
'img'
=>
Helpers
::
getImageUrl
(
$goodsCover
,
235
,
314
),
'productName'
=>
$val
[
'product_name'
],
'salesPrice'
=>
'¥'
.
$val
[
'sales_price'
],
'presentPrice'
=>
'¥'
.
$val
[
'sales_price'
]
);
if
(
!
empty
(
self
::
$appVersion
))
{
$goods
[
'url'
]
.=
'?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'
.
$val
[
'product_skn'
]
.
'}}'
;
}
foreach
(
$product
[
'data'
][
'product_list'
]
as
$key
=>
$value
)
{
$goods
=
Helpers
::
formatProduct
(
$value
,
false
,
false
,
false
,
235
,
314
,
self
::
$appVersion
);
//店铺人气商品不须要其它标签、即将售罄
$goods
[
'tags'
]
=
array
();
$goods
[
'is_soon_sold_out'
]
=
false
;
$goods
[
'tags'
][
'is_hot'
]
=
true
;
self
::
$shopData
[
'hotList'
][]
=
$goods
;
}
}
else
{
$productSkn
=
array
();
foreach
(
$data
as
$val
)
{
$productSkn
[]
=
$val
[
'productSkn'
];
}
$product
=
DetailData
::
productBatch
(
$productSkn
);
if
(
$product
[
'code'
]
===
200
&&
isset
(
$product
[
'data'
][
'product_list'
]))
{
foreach
(
$product
[
'data'
][
'product_list'
]
as
$key
=>
$value
)
{
$goods
=
Helpers
::
formatProduct
(
$value
,
false
,
false
,
false
,
235
,
314
,
self
::
$appVersion
);
//店铺人气商品不须要其它标签、即将售罄
$goods
[
'tags'
]
=
array
();
$goods
[
'is_soon_sold_out'
]
=
false
;
$goods
[
'tags'
][
'is_hot'
]
=
true
;
self
::
$shopData
[
'hotList'
][]
=
$goods
;
}
}
}
}
...
...
Please
register
or
login
to post a comment