Showing
1 changed file
with
24 additions
and
3 deletions
@@ -273,7 +273,7 @@ class UserModel | @@ -273,7 +273,7 @@ class UserModel | ||
273 | * @param int $udid 客户端唯一标识 | 273 | * @param int $udid 客户端唯一标识 |
274 | * @param int $page 第几页,默认为1 | 274 | * @param int $page 第几页,默认为1 |
275 | * @param int $limit 限制多少条,默认100 | 275 | * @param int $limit 限制多少条,默认100 |
276 | - * @return array处理之后的数据 | 276 | + * @return array 处理之后的数据 |
277 | */ | 277 | */ |
278 | public static function browserRecord($uid, $udid, $page, $limit) | 278 | public static function browserRecord($uid, $udid, $page, $limit) |
279 | { | 279 | { |
@@ -281,9 +281,30 @@ class UserModel | @@ -281,9 +281,30 @@ class UserModel | ||
281 | 281 | ||
282 | $records = UserData::browseRecord($uid, $udid, $page, $limit); | 282 | $records = UserData::browseRecord($uid, $udid, $page, $limit); |
283 | 283 | ||
284 | + if (!$records) { | ||
285 | + $result['walkwayUrl'] = '/product/new'; | ||
286 | + $result['noRecord'] = true; | ||
287 | + | ||
288 | + return $result; | ||
289 | + } | ||
290 | + | ||
284 | // 处理数据 | 291 | // 处理数据 |
285 | - if (isset($records['data']['product_list']) && !empty($records['data']['product_list'])) { | ||
286 | - $result = $records['data']['product_list']; | 292 | + if (isset($records['data']['product_list'])) { |
293 | + | ||
294 | + // 不能再查到结果了 | ||
295 | + if ($page == 1 && $records['data']['total'] === 0) { | ||
296 | + $result['walkwayUrl'] = '/product/new'; | ||
297 | + $result['noRecord'] = true; | ||
298 | + } else { | ||
299 | + $data = $records['data']['product_list']; | ||
300 | + foreach ($data as &$val) { | ||
301 | + $val['image'] = Helpers::getImageUrl($val['image'], 140, 140); | ||
302 | + $val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0; | ||
303 | + $val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0; | ||
304 | + } | ||
305 | + | ||
306 | + !empty($data) && $result['browseRecord'] = $data; | ||
307 | + } | ||
287 | } | 308 | } |
288 | 309 | ||
289 | return $result; | 310 | return $result; |
-
Please register or login to post a comment