| xqd
@@ -31,18 +31,42 @@ class IndexController extends Controller
|
|
|
* "users": [ 动态用户
|
|
|
* 'news_num':2 新消息数目
|
|
|
* ],
|
|
|
- * "dreams": [
|
|
|
- * "care_num": 0, 关注人数
|
|
|
- * "time": 1222222, 梦想倒计时
|
|
|
- * "dream_imgs_first": {
|
|
|
- * "pic": "", 梦想封面图片
|
|
|
- * }
|
|
|
- * "dream_find_user": [
|
|
|
- * {
|
|
|
- * ... 发布梦想的用户信息
|
|
|
- * }
|
|
|
- * ],
|
|
|
- * ]
|
|
|
+ * "dreams": {
|
|
|
+ * "current_page": 1,
|
|
|
+ * "data": [
|
|
|
+ * {
|
|
|
+ * "dream": "signture",
|
|
|
+ * "about": "123568",
|
|
|
+ * "video": "",
|
|
|
+ * "money": 162,
|
|
|
+ * "time": 2666,
|
|
|
+ * "get_money": 0,
|
|
|
+ * "status": 0,
|
|
|
+ * "updated_at": "2017-06-21 10:51:20",
|
|
|
+ * "dream_find_user": [
|
|
|
+ * {
|
|
|
+ * "pic": "",
|
|
|
+ * }
|
|
|
+ * ],
|
|
|
+ * "care_num": 1,
|
|
|
+ * "dream_first_pic": null,
|
|
|
+ * "dream_imgs_first": null 封面图片
|
|
|
+ * "care_num": 2,
|
|
|
+ * "dream_first_pic": null,
|
|
|
+ * "dream_imgs_first": null
|
|
|
+ * },
|
|
|
+ * }
|
|
|
+ * ],
|
|
|
+ * "from": 1,
|
|
|
+ * "last_page": 1,
|
|
|
+ * "next_page_url": null,
|
|
|
+ * "path": "http://www.miao.com/api/index/index",
|
|
|
+ * "per_page": 20,
|
|
|
+ * "prev_page_url": null,
|
|
|
+ * "to": 3,
|
|
|
+ * "total": 3
|
|
|
+ * }
|
|
|
+ * ]
|
|
|
* }
|
|
|
* }
|
|
|
* @apiErrorExample {json} Error-Response:
|
| xqd
@@ -67,13 +91,7 @@ class IndexController extends Controller
|
|
|
}
|
|
|
}
|
|
|
$type = $request->type;
|
|
|
- if ($type == 'hot') {
|
|
|
- $banner = $this->getBanner();
|
|
|
-// 获取其他用户信息 及梦想
|
|
|
- $dreams = DreamInfoModel::orderBy('score','desc')->limit(20)->paginate(20);
|
|
|
- $this->dreams($dreams);
|
|
|
- return $this->api(compact('banner','users','dreams'));
|
|
|
- } elseif ($type == 'trend') {
|
|
|
+ if ($type == 'trend') {
|
|
|
$dreams = DreamInfoModel::orderBy('score','desc')->offset(20)->limit(100)->paginate(20);
|
|
|
$this->dreams($dreams);
|
|
|
return $this->api(compact('users','dreams'));
|
| xqd
@@ -81,8 +99,12 @@ class IndexController extends Controller
|
|
|
$dreams = DreamInfoModel::orderBy('score','desc')->offset(100)->limit(500)->paginate(20);
|
|
|
$this->dreams($dreams);
|
|
|
return $this->api(compact('users','dreams'));
|
|
|
- }else{
|
|
|
- return $this->error(ErrorCode::KEY_ERROR);
|
|
|
+ } else{
|
|
|
+ $banner = $this->getBanner();
|
|
|
+ // 获取其他用户信息 及梦想
|
|
|
+ $dreams = DreamInfoModel::orderBy('score','desc')->limit(20)->paginate(20);
|
|
|
+ $this->dreams($dreams);
|
|
|
+ return $this->api(compact('banner','users','dreams'));
|
|
|
}
|
|
|
}
|
|
|
|