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
Rock Zhang
9 years ago
Commit
5529cb24d50313f8fb38716a9ffe5faa3736b41a
1 parent
9c6dc1e9
提出价格处理函数;修改获取优惠券接口,能单独返回总数
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
library/Plugin/Helpers.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
library/Plugin/Helpers.php
View file @
5529cb2
...
...
@@ -155,8 +155,6 @@ class Helpers
*/
public
static
function
transOrder
(
$order
,
$type
)
{
$result
=
''
;
switch
(
$type
)
{
case
'price'
:
$result
=
(
$order
==
0
)
?
's_p_desc'
:
's_p_asc'
;
...
...
@@ -173,6 +171,17 @@ class Helpers
return
$result
;
}
/**
* 转换价格
*
* @param float|string $price 价格
* @return float|string 转换之后的价格
*/
public
static
function
transPrice
(
$price
)
{
return
(
!
empty
(
$price
)
&&
!
is_float
(
$price
))
?
$price
.
'.00'
:
$price
;
}
/**
* 格式化商品信息
*
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
5529cb2
...
...
@@ -322,7 +322,7 @@ class UserModel
foreach
(
$data
as
&
$val
)
{
$val
[
'link'
]
=
isset
(
$val
[
'goodsId'
])
?
Helpers
::
url
(
'/product/pro_'
.
$val
[
'product_skn'
]
.
'_'
.
$val
[
'goodsId'
]
.
'/'
.
$val
[
'cnAlphabet'
]
.
'.html'
)
:
''
;
$val
[
'image'
]
=
!
empty
(
$val
[
'image'
])
?
Helpers
::
getImageUrl
(
$val
[
'image'
],
447
,
596
)
:
''
;
$val
[
'sales_price'
]
=
(
!
empty
(
$val
[
'sales_price'
])
&&
!
is_float
(
$val
[
'sales_price'
]))
?
$val
[
'sales_price'
]
.
'.00'
:
$val
[
'sales_price'
]
;
$val
[
'sales_price'
]
=
Helpers
::
transPrice
(
$val
[
'sales_price'
])
;
$val
[
'market_price'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
$val
[
'market_price'
]
.
'.00'
:
false
;
}
!
empty
(
$data
)
&&
$result
[
'browseRecord'
]
=
$data
;
...
...
@@ -381,9 +381,10 @@ class UserModel
* @param int $uid 用户ID
* @param int $status 优惠券状态,0表示未使用,1表示已使用
* @param int $page 第几页
* @param boolean $onlyTotal 只返回总数
* @return array|mixed 处理之后的优惠券数据
*/
public
static
function
getCouponData
(
$uid
,
$status
,
$page
)
public
static
function
getCouponData
(
$uid
,
$status
,
$page
,
$onlyTotal
=
false
)
{
$result
=
array
();
...
...
@@ -400,6 +401,13 @@ class UserModel
// 处理优惠券数据
if
(
isset
(
$coupons
[
'data'
]))
{
if
(
$onlyTotal
)
{
$result
[
'count'
]
=
$coupons
[
'data'
][
'total'
];
return
$result
;
}
// 不能再查到结果了
if
(
$page
==
1
&&
$coupons
[
'data'
][
'total'
]
===
0
)
{
$result
[
'walkwayUrl'
]
=
'/product/new'
;
...
...
Please
register
or
login
to post a comment