Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
毕凯
9 years ago
Commit
9be53d3d0184a12a9e8c4d7d1df57b531f33541b
2 parents
ebb78176
8fd5aa1b
Merge remote-tracking branch 'origin/hotfix-api-change' into feature/address
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
24 deletions
library/Api/Yohobuy.php
template/m.yohobuy.com/actions/index/home/address-act.phtml
template/m.yohobuy.com/actions/index/home/location-list.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
library/Api/Yohobuy.php
View file @
9be53d3
...
...
@@ -24,8 +24,8 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const
API_URL
=
'http://devapi.yoho.cn:58078/'
;
const
SERVICE_URL
=
'http://devservice.yoho.cn:58077/'
;
const
API_URL
=
'http://test2.open.yohobuy.com/'
;
const
SERVICE_URL
=
'http://test.service.api.yohobuy.com/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
const
YOHOBUY_ORDER
=
'http://192.168.102.205:8084/order/'
;
//我的订单
const
API_URL_MYCENTER
=
'http://192.168.102.205:8081/users/'
;
// 我的个人中心接口URL
...
...
template/m.yohobuy.com/actions/index/home/address-act.phtml
View file @
9be53d3
...
...
@@ -28,6 +28,5 @@
确认
</div>
</div>
{
{>
me/address/address-list
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/home/location-list.phtml
0 → 100644
View file @
9be53d3
{
{>
me/address/address-list
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
9be53d3
...
...
@@ -306,6 +306,23 @@ class HomeController extends AbstractAction
}*/
/**
* 异步获取三级地址数据
*/
public
function
locationListAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$result
[
'addressList'
]
=
UserModel
::
getAddressListData
(
$this
->
_uid
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'location-list'
,
$result
);
}
}
/**
* 地址管理
*/
public
function
addressAction
()
{
...
...
@@ -314,14 +331,12 @@ class HomeController extends AbstractAction
$this
->
setNavHeader
(
'地址管理'
);
$address
=
UserModel
::
getAddressData
(
$this
->
_uid
);
$addressList
=
UserModel
::
getAddressListData
(
$this
->
_uid
);
$this
->
_view
->
display
(
'address'
,
array
(
'addressPage'
=>
true
,
'pageFooter'
=>
true
,
'address'
=>
$address
,
'showAddBtn'
=>
(
count
(
$address
)
<=
5
),
'addressList'
=>
$addressList
'showAddBtn'
=>
(
count
(
$address
)
<=
5
)
));
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
9be53d3
...
...
@@ -172,29 +172,25 @@ class UserModel
// 处理用户收藏的商品数据
if
(
isset
(
$favProduct
[
'data'
])
&&
!
empty
(
$favProduct
[
'data'
][
'product_list'
]))
{
if
(
$page
>
$favProduct
[
'data'
][
'page_total'
])
{
$result
[
'end'
]
=
true
;
return
$result
;
}
$datas
=
array
();
$product
=
array
();
foreach
(
$favProduct
[
'data'
][
'product_list'
]
as
$val
)
{
$product
=
array
();
$product
[
'fav_id'
]
=
$val
[
'product_id'
];
$product
[
'imgUrl'
]
=
$val
[
'image'
];
$product
[
'link'
]
=
isset
(
$val
[
'goodsId'
])
?
Helpers
::
url
(
'/product/pro_'
.
$val
[
'product_skn'
]
.
'_'
.
$val
[
'goodsId'
]
.
'/'
.
$val
[
'cnAlphabet'
]
.
'.html'
)
:
''
;
$product
[
'imgUrl'
]
=
Helpers
::
getImageUrl
(
$val
[
'image'
],
447
,
596
);;
$product
[
'title'
]
=
$val
[
'product_name'
];
$product
[
'price'
]
=
!
empty
(
$val
[
'market_price'
])
?
'¥'
.
$val
[
'market_price'
]
.
'.00'
:
0
;
$product
[
'discountPrice'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
'¥'
.
$val
[
'sales_price'
]
.
'.00'
:
false
;
$product
[
'savePrice'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
'¥'
.
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
])
.
'.00'
:
false
;
$product
[
'sellOut'
]
=
(
bool
)(
$val
[
'price_down'
]);
$product
[
'savePrice'
]
=
!
empty
(
$val
[
'price_down'
]
>
0
)
?
'¥'
.
$val
[
'price_down'
]
.
'.00'
:
false
;
$product
[
'sellOut'
]
=
(
$val
[
'storage'
]
<=
0
);
$datas
[]
=
$product
;
}
!
empty
(
$datas
)
&&
$result
[
'hasFavProduct'
]
=
$datas
;
}
else
if
(
$page
>
1
&&
isset
(
$favProduct
[
'code'
])
&&
$favProduct
[
'code'
]
===
500
){
$result
[
'end'
]
=
true
;
}
return
$result
;
...
...
@@ -230,19 +226,19 @@ class UserModel
foreach
(
$favBrand
[
'data'
][
'brand_list'
]
as
$val
)
{
$brand
=
array
();
$brand
[
'id'
]
=
$val
[
'brand_id'
];
$brand
[
'brandImg'
]
=
Images
::
getImageUrl
(
$val
[
'brand_ico'
],
235
,
314
)
;
$brand
[
'brandImg'
]
=
!
empty
(
$val
[
'brand_ico'
])
?
Images
::
getImageUrl
(
$val
[
'brand_ico'
],
47
,
47
)
:
''
;
$brand
[
'brandName'
]
=
$val
[
'brand_name'
];
$brand
[
'update'
]
=
$val
[
'new_product_num'
];
$brand
[
'discount'
]
=
$val
[
'product_discount_num'
];
$brand
[
'link'
]
=
'#'
;
$brand
[
'link'
]
=
Helpers
::
url
(
''
,
array
(
'query'
=>
$val
[
'brand_name'
]),
'search'
)
;
// 处理品牌产品
$product
=
array
();
foreach
(
$val
[
'new_product'
]
as
$one
)
{
$product
=
array
();
$product
[
'imgUrl'
]
=
Images
::
getImageUrl
(
$one
[
'default_images'
],
235
,
314
);
$product
[
'price'
]
=
'¥'
.
$one
[
'market_price'
];
$product
[
'discount'
]
=
'¥'
.
$one
[
'sales_price'
];
$product
[
'price'
]
=
!
empty
(
$one
[
'market_price'
])
?
'¥'
.
$one
[
'market_price'
]
.
'.00'
:
0
;
$product
[
'discount'
]
=
!
empty
(
$one
[
'sales_price'
])
?
'¥'
.
$one
[
'sales_price'
]
.
'.00'
:
0
;
$brand
[
'productList'
][]
=
$product
;
}
...
...
@@ -277,7 +273,7 @@ class UserModel
* @param int $udid 客户端唯一标识
* @param int $page 第几页,默认为1
* @param int $limit 限制多少条,默认100
* @return array处理之后的数据
* @return array
处理之后的数据
*/
public
static
function
browserRecord
(
$uid
,
$udid
,
$page
,
$limit
)
{
...
...
@@ -285,9 +281,30 @@ class UserModel
$records
=
UserData
::
browseRecord
(
$uid
,
$udid
,
$page
,
$limit
);
if
(
!
$records
)
{
$result
[
'walkwayUrl'
]
=
'/product/new'
;
$result
[
'noRecord'
]
=
true
;
return
$result
;
}
// 处理数据
if
(
isset
(
$records
[
'data'
][
'product_list'
])
&&
!
empty
(
$records
[
'data'
][
'product_list'
]))
{
$result
=
$records
[
'data'
][
'product_list'
];
if
(
isset
(
$records
[
'data'
][
'product_list'
]))
{
// 不能再查到结果了
if
(
$page
==
1
&&
$records
[
'data'
][
'total'
]
===
0
)
{
$result
[
'walkwayUrl'
]
=
'/product/new'
;
$result
[
'noRecord'
]
=
true
;
}
else
{
$data
=
$records
[
'data'
][
'product_list'
];
foreach
(
$data
as
&
$val
)
{
$val
[
'image'
]
=
Helpers
::
getImageUrl
(
$val
[
'image'
],
140
,
140
);
$val
[
'sales_price'
]
=
!
empty
(
$val
[
'sales_price'
])
?
$val
[
'sales_price'
]
.
'.00'
:
0
;
$val
[
'market_price'
]
=
!
empty
(
$val
[
'market_price'
])
?
$val
[
'market_price'
]
.
'.00'
:
0
;
}
!
empty
(
$data
)
&&
$result
[
'browseRecord'
]
=
$data
;
}
}
return
$result
;
...
...
@@ -566,7 +583,7 @@ class UserModel
foreach
(
$suggest
[
'data'
][
'list'
]
as
$val
)
{
$one
=
array
();
$one
[
'suggest_id'
]
=
$val
[
'id'
];
$one
[
'imgUrl'
]
=
!
empty
(
$val
[
'cover_image'
])
?
Images
::
getSourceUrl
(
$val
[
'cover_image'
],
'suggest'
)
.
'?imageMogr2/thumbnail/320x155/extent/240x155/background/d2hpdGU=/position/center/quality/90'
:
''
;
$one
[
'imgUrl'
]
=
!
empty
(
$val
[
'cover_image'
])
?
Images
::
getSourceUrl
(
$val
[
'cover_image'
],
'suggest'
)
:
''
;
$one
[
'title'
]
=
$val
[
'filter_content'
];
$one
[
'content'
]
=
$val
[
'reply_content'
];
$one
[
'good'
]
=
(
$val
[
'is_reliable'
]
==
1
);
...
...
Please
register
or
login
to post a comment