Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenchao
/
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
hf
9 years ago
Commit
b22062e3d43b3426a7b4acfa7f4a46d5a67bbaef
1 parent
fe090b83
code review by hf: do cuxiao huodong christmas second times
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
28 deletions
library/Api/Yohobuy.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
library/Api/Yohobuy.php
View file @
b22062e
...
...
@@ -23,15 +23,15 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const
API_URL
=
'http://testapi.yoho.cn:28078/'
;
const
SERVICE_URL
=
'http://testservice.yoho.cn:28077/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
const
API_URL
=
'http://apih5.yoho.cn/'
;
const
API_URL2
=
'http://apih5.yoho.cn/'
;
const
SERVICE_URL
=
'http://serviceh5.yoho.cn/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
// /* 测试环境 */
// const API_URL = 'http://testapi.yoho.cn:28078/';
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/**
* 私钥列表
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
b22062e
...
...
@@ -34,10 +34,12 @@ class DetailModel
$baseInfo
=
DetailData
::
baseInfo
(
$productId
,
$uid
);
// 商品名称
if
(
isset
(
$baseInfo
[
'productName'
]))
{
$result
[
'goodsName'
]
=
$baseInfo
[
'productName'
];
if
(
empty
(
$baseInfo
[
'productName'
]))
{
return
$result
;
}
$result
[
'goodsName'
]
=
$baseInfo
[
'productName'
];
// 商品促销短语
if
(
!
empty
(
$baseInfo
[
'salesPhrase'
]))
{
$result
[
'goodsSubtitle'
]
=
$baseInfo
[
'salesPhrase'
];
...
...
@@ -159,12 +161,12 @@ class DetailModel
$thumbImageList
=
array
();
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr
=
''
;
// 尺码库存总数集合, 多个之间用/分隔
$colorStorageNum
=
0
;
$colorStorageNum
=
0
;
$totalStorageNum
=
0
;
// 总库存数
foreach
(
$baseInfo
[
'goodsList'
]
as
$value
)
{
$colorStorageNum
=
0
;
$sizeStorageStr
=
''
;
// 商品分组
if
(
isset
(
$value
[
'goodsImagesList'
]))
{
foreach
(
$value
[
'goodsImagesList'
]
as
$goods
)
{
...
...
@@ -178,7 +180,7 @@ class DetailModel
// 商品的尺码列表
if
(
isset
(
$value
[
'goodsSizeBoList'
]))
{
foreach
(
$value
[
'goodsSizeBoList'
]
as
$size
)
{
$sizeList
[
$value
[
'colorId'
]
][]
=
array
(
$sizeList
[
$value
[
'colorId'
]
][]
=
array
(
'id'
=>
$size
[
'id'
],
'skuId'
=>
$size
[
'goodsSizeSkuId'
],
'goodsId'
=>
$size
[
'goodsId'
],
...
...
@@ -188,9 +190,9 @@ class DetailModel
);
$colorStorageNum
+=
intval
(
$size
[
'goodsSizeStorageNum'
]);
$sizeStorageStr
.=
$size
[
'goodsSizeStorageNum'
]
.
'/'
;
$colorStorageGroup
[
$size
[
'sizeName'
]
][
$value
[
'colorName'
]
]
=
$size
[
'goodsSizeStorageNum'
];
$colorStorageGroup
[
$size
[
'sizeName'
]][
$value
[
'colorName'
]
]
=
$size
[
'goodsSizeStorageNum'
];
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
...
...
@@ -201,21 +203,24 @@ class DetailModel
'sizeNumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
),
);
}
// 缩略图
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
)
);
foreach
(
$sizeList
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
));
// 添加尺码对应的各个颜色的库存量
foreach
(
$sizeList
as
$colorId
=>
$sizeArr
)
{
foreach
(
$sizeArr
as
$key
=>
$value
)
{
$sizeList
[
$colorId
][
$key
][
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$value
[
'name'
]]));
}
}
// 商品库存总数
$totalStorageNum
+=
$colorStorageNum
;
}
// 统计尺码对应的各个颜色的库存量
// 格式化尺码对应的各个颜色分组
foreach
(
$colorGroup
as
$value
)
{
$sizeGroup
[][
'size'
]
=
$sizeList
[
$value
[
'
colorI
d'
]
];
$sizeGroup
[][
'size'
]
=
$sizeList
[
$value
[
'
i
d'
]
];
}
// 商品图: 多个
...
...
@@ -360,10 +365,9 @@ class DetailModel
foreach
(
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
]
as
$value
)
{
$item
=
array
();
$sizeNameList
[]
=
array
(
'param'
=>
$value
[
'sizeName'
]);
if
(
$boyReference
&&
(
$gender
==
1
||
$gender
==
3
)
)
{
if
(
$boyReference
&&
(
$gender
==
1
||
$gender
==
3
))
{
$referenceList
[]
=
array
(
'param'
=>
empty
(
$value
[
'boyReferSize'
][
'referenceName'
])
?
' '
:
$value
[
'boyReferSize'
][
'referenceName'
]);
}
elseif
(
$girlReference
&&
(
$gender
==
2
||
$gender
==
3
)
)
{
}
elseif
(
$girlReference
&&
(
$gender
==
2
||
$gender
==
3
))
{
$referenceList
[]
=
array
(
'param'
=>
empty
(
$value
[
'girlReferSize'
][
'referenceName'
])
?
' '
:
$value
[
'girlReferSize'
][
'referenceName'
]);
}
foreach
(
$value
[
'sortAttributes'
]
as
$attr
)
{
...
...
Please
register
or
login
to post a comment