Authored by Rock Zhang

修改优惠券数据处理逻辑

@@ -160,15 +160,24 @@ class UserData @@ -160,15 +160,24 @@ class UserData
160 */ 160 */
161 public static function couponData($uid, $status, $page = 1, $limit = 10) 161 public static function couponData($uid, $status, $page = 1, $limit = 10)
162 { 162 {
  163 + $urlList = array();
  164 +
163 $param = Yohobuy::param(); 165 $param = Yohobuy::param();
164 $param['method'] = 'app.coupons.li'; 166 $param['method'] = 'app.coupons.li';
165 $param['uid'] = $uid; 167 $param['uid'] = $uid;
166 - $param['status'] = $status; 168 + $param['status'] = 0;
167 $param['page'] = $page; 169 $param['page'] = $page;
168 $param['limit'] = $limit; 170 $param['limit'] = $limit;
  171 +
169 $param['client_secret'] = Sign::getSign($param); 172 $param['client_secret'] = Sign::getSign($param);
  173 + $urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
170 174
171 - return Yohobuy::get(Yohobuy::API_URL, $param); 175 + unset($param['client_secret']);
  176 + $param['status'] = 1;
  177 + $param['client_secret'] = Sign::getSign($param);
  178 + $urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  179 +
  180 + return Yohobuy::getMulti($urlList);
172 } 181 }
173 182
174 /** 183 /**
@@ -30,7 +30,7 @@ class UserModel @@ -30,7 +30,7 @@ class UserModel
30 // 调用接口获取个人详情 30 // 调用接口获取个人详情
31 $userData = UserData::userData($uid); 31 $userData = UserData::userData($uid);
32 32
33 - // 处理个人详情数 33 + // 处理个人详情数
34 if (isset($userData['data']) && !empty($userData['data'])) { 34 if (isset($userData['data']) && !empty($userData['data'])) {
35 $result = $userData['data']; 35 $result = $userData['data'];
36 $result['gender'] = $result['gender'] == 1 ? '男' : '女'; 36 $result['gender'] = $result['gender'] == 1 ? '男' : '女';
@@ -213,8 +213,11 @@ class UserModel @@ -213,8 +213,11 @@ class UserModel
213 $coupons = UserData::couponData($uid, $status); 213 $coupons = UserData::couponData($uid, $status);
214 214
215 // 处理优惠券数据 215 // 处理优惠券数据
216 - if (isset($coupons['data']) && !empty($coupons['data'])) {  
217 - $result = $coupons['data']['info']; 216 + if (!empty($coupons['unused'])) {
  217 + $result['unused'] = $coupons['unused']['info'];
  218 + }
  219 + if (!empty($coupons['used'])) {
  220 + $result['used'] = $coupons['used']['info'];
218 } 221 }
219 222
220 return $result; 223 return $result;
@@ -353,14 +356,11 @@ class UserModel @@ -353,14 +356,11 @@ class UserModel
353 $one = array(); 356 $one = array();
354 foreach ($suggest['data']['list'] as $val) { 357 foreach ($suggest['data']['list'] as $val) {
355 $one = array(); 358 $one = array();
356 - $one['hasImage'] = $val['has_image'];  
357 $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240); 359 $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
358 $one['title'] = $val['filter_content']; 360 $one['title'] = $val['filter_content'];
359 $one['content'] = $val['reply_content']; 361 $one['content'] = $val['reply_content'];
360 - $one['good'] = $val['is_reliable'];  
361 - $one['bad'] = !$val['is_reliable'];  
362 - $one['goodNum'] = $val['reliable'];  
363 - $one['badNum'] = $val['unreliable']; 362 + $one['good'] = boolval($val['is_reliable']);
  363 + $one['bad'] = !$one['good'];
364 364
365 $result[] = $one; 365 $result[] = $one;
366 } 366 }