...
|
...
|
@@ -465,35 +465,36 @@ class UserModel |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
do {
|
|
|
// 调用接口获取优惠券数据
|
|
|
$coupons = UserData::couponData($uid, $status, $page);
|
|
|
|
|
|
// 没有获取到优惠券时
|
|
|
if (!$coupons) {
|
|
|
if (empty($coupons)) {
|
|
|
$result['noRecord'] = true;
|
|
|
|
|
|
return $result;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// 处理优惠券数据
|
|
|
if (isset($coupons['data'])) {
|
|
|
|
|
|
// 不能再查到结果了
|
|
|
if ($page == 1 && $coupons['data']['total'] === 0) {
|
|
|
if ($page == 1 && isset($coupons['data']['total']) && $coupons['data']['total'] === 0) {
|
|
|
$result['noRecord'] = true;
|
|
|
} else {
|
|
|
$couponArr = array();
|
|
|
isset($coupons['data']['info']) && $couponArr = $coupons['data']['info'];
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// 判断是否有优惠券
|
|
|
if (empty($coupons['data']['info'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
foreach ($couponArr as &$val) {
|
|
|
// 处理已使用的优惠券
|
|
|
if ($status == 1) {
|
|
|
$val['used'] = true;
|
|
|
}
|
|
|
foreach ($coupons['data']['info'] as &$value) {
|
|
|
$value['used'] = true;
|
|
|
}
|
|
|
!empty($couponArr) && $result['coupons'] = $couponArr;
|
|
|
}
|
|
|
|
|
|
$result['coupons'] = $coupons['data']['info'];
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
|