Authored by Rock Zhang

修改优惠券数据处理逻辑

... ... @@ -160,15 +160,24 @@ class UserData
*/
public static function couponData($uid, $status, $page = 1, $limit = 10)
{
$urlList = array();
$param = Yohobuy::param();
$param['method'] = 'app.coupons.li';
$param['uid'] = $uid;
$param['status'] = $status;
$param['status'] = 0;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
$urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::get(Yohobuy::API_URL, $param);
unset($param['client_secret']);
$param['status'] = 1;
$param['client_secret'] = Sign::getSign($param);
$urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList);
}
/**
... ...
... ... @@ -30,7 +30,7 @@ class UserModel
// 调用接口获取个人详情
$userData = UserData::userData($uid);
// 处理个人详情数
// 处理个人详情数
if (isset($userData['data']) && !empty($userData['data'])) {
$result = $userData['data'];
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
... ... @@ -213,8 +213,11 @@ class UserModel
$coupons = UserData::couponData($uid, $status);
// 处理优惠券数据
if (isset($coupons['data']) && !empty($coupons['data'])) {
$result = $coupons['data']['info'];
if (!empty($coupons['unused'])) {
$result['unused'] = $coupons['unused']['info'];
}
if (!empty($coupons['used'])) {
$result['used'] = $coupons['used']['info'];
}
return $result;
... ... @@ -353,14 +356,11 @@ class UserModel
$one = array();
foreach ($suggest['data']['list'] as $val) {
$one = array();
$one['hasImage'] = $val['has_image'];
$one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
$one['title'] = $val['filter_content'];
$one['content'] = $val['reply_content'];
$one['good'] = $val['is_reliable'];
$one['bad'] = !$val['is_reliable'];
$one['goodNum'] = $val['reliable'];
$one['badNum'] = $val['unreliable'];
$one['good'] = boolval($val['is_reliable']);
$one['bad'] = !$one['good'];
$result[] = $one;
}
... ...