| xqd
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Api\V1;
|
|
|
|
|
|
use App\Models\BaseDictionaryOptionModel;
|
|
|
use App\Models\BaseSettingsModel;
|
|
|
+use App\Models\DreamInfoModel;
|
|
|
+use App\Models\SearchInfoModel;
|
|
|
use App\Models\SystemInfoModel;
|
|
|
use App\Models\UserCareDream;
|
|
|
use App\Models\UserInfoModel;
|
| xqd
@@ -416,24 +418,31 @@ class MyController extends Controller
|
|
|
* @apiParam {string} keyword 关键字
|
|
|
* @apiSuccessExample {json} Success-Response:
|
|
|
* HTTP/1.1 200 OK
|
|
|
- *{
|
|
|
- * "status": true,
|
|
|
- * "status_code": 0,
|
|
|
- * "message": "",
|
|
|
- * "data": {
|
|
|
- * "data": [
|
|
|
- * {
|
|
|
- * "dream": "haha", 梦想名
|
|
|
- * "user_pic": [
|
|
|
- * {
|
|
|
- * "pic": "", 用户头像
|
|
|
- * }
|
|
|
- * ],
|
|
|
- * "dream_img": "", 梦想图片
|
|
|
- * }
|
|
|
- * ]
|
|
|
- * }
|
|
|
- *}
|
|
|
+ {
|
|
|
+ "status": true,
|
|
|
+ "status_code": 0,
|
|
|
+ "message": "",
|
|
|
+ "data": [
|
|
|
+ {
|
|
|
+ "id": 5,
|
|
|
+ "user_id": 1,
|
|
|
+ "name": "梦想标题1",
|
|
|
+ "about": "梦想介绍",
|
|
|
+ "coin": 2500,
|
|
|
+ "time": 72000,
|
|
|
+ "get_coin": 0,
|
|
|
+ "mark": 0,
|
|
|
+ "status": 0,
|
|
|
+ "video": "url",
|
|
|
+ "score": 100079365,
|
|
|
+ "sign": "梦想达人",
|
|
|
+ "created_at": "2017-06-25 12:45:22",
|
|
|
+ "updated_at": "2017-06-28 15:50:41",
|
|
|
+ "user": {},
|
|
|
+ "imgs": []
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
* @apiErrorExample {json} Error-Response:
|
|
|
* HTTP/1.1 400 Bad Request
|
|
|
*/
|
| xqd
@@ -444,12 +453,8 @@ class MyController extends Controller
|
|
|
return $this->api('');
|
|
|
}
|
|
|
$keyword ='%'.$request->keyword.'%';
|
|
|
- $data = DreamInfoModel::where('dream','like',$keyword)->
|
|
|
- orWhere('sign','like',$keyword)->get();
|
|
|
- foreach ($data as $k => $value) {
|
|
|
- $value->user_pic = $value->dreamFindUser;
|
|
|
- $value->dream_img = $value->dreamImgsFirst->pic;
|
|
|
- }
|
|
|
+ $data = DreamInfoModel::where('name','like',$keyword)->
|
|
|
+ orWhere('sign','like',$keyword)->with('user','imgs')->get();
|
|
|
$this->insertSearchTable($user->id,$request->keyword);
|
|
|
return $this->api(compact('data'));
|
|
|
}
|