|
@@ -324,7 +324,7 @@ class IndexController extends Controller
|
|
* @apiPermission none
|
|
* @apiPermission none
|
|
* @apiVersion 0.1.0
|
|
* @apiVersion 0.1.0
|
|
* @apiParam {string} [sex] 性别 //1男,2女,0:全部,
|
|
* @apiParam {string} [sex] 性别 //1男,2女,0:全部,
|
|
- * @apiParam {string} [age] 年龄段 0:全部,1:18-21,2:22-25,3:26-29,4:30-33,5:34-37,6:>37,
|
|
|
|
|
|
+ * @apiParam {string} [age] 年龄段 0:全部,1:18-21,2:22-25,3:26-29,4:30-33,5:34-37,6:>37, 接收1,2,3,4...
|
|
* @apiParam {string} [area] 地区 例:成都
|
|
* @apiParam {string} [area] 地区 例:成都
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* HTTP/1.1 200 OK
|
|
* HTTP/1.1 200 OK
|
|
@@ -351,16 +351,7 @@ class IndexController extends Controller
|
|
$login_user = $this->getUser();
|
|
$login_user = $this->getUser();
|
|
$id = $login_user->id;
|
|
$id = $login_user->id;
|
|
$query = new DreamInfoModel();
|
|
$query = new DreamInfoModel();
|
|
- if (($sex) == 1) {
|
|
|
|
- $query = $query->whereHas('user', function ($select) use ($sex) {
|
|
|
|
- $select->where('sex',0);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if (($sex) == 2) {
|
|
|
|
- $query = $query->whereHas('user', function ($select) use ($sex) {
|
|
|
|
- $select->where('sex',1);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
if (!empty($age)) {
|
|
if (!empty($age)) {
|
|
$age_arr = explode(',',$age); // 被选中的年龄数组
|
|
$age_arr = explode(',',$age); // 被选中的年龄数组
|
|
@@ -403,6 +394,16 @@ class IndexController extends Controller
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (($sex) == 1) {
|
|
|
|
+ $query = $query->whereHas('user', function ($select) use ($sex) {
|
|
|
|
+ $select->where('sex',0);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (($sex) == 2) {
|
|
|
|
+ $query = $query->whereHas('user', function ($select) use ($sex) {
|
|
|
|
+ $select->where('sex',1);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
/* if ($age == 7) {
|
|
/* if ($age == 7) {
|
|
$query = $query->whereHas('user', function ($select) use ($age) {
|
|
$query = $query->whereHas('user', function ($select) use ($age) {
|
|
@@ -445,6 +446,7 @@ class IndexController extends Controller
|
|
$select->where('city','like','%'.$area.'%');
|
|
$select->where('city','like','%'.$area.'%');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ \Log::info($query->toSql());
|
|
$arr1 =DreamInfoModel::limit(20)->select('id')->get()->toArray();
|
|
$arr1 =DreamInfoModel::limit(20)->select('id')->get()->toArray();
|
|
$id_arr1 = array_column($arr1,'id');
|
|
$id_arr1 = array_column($arr1,'id');
|
|
$arr2 =DreamInfoModel::orderBy('score','desc')->limit(120)->select('id')->get()->toArray();
|
|
$arr2 =DreamInfoModel::orderBy('score','desc')->limit(120)->select('id')->get()->toArray();
|