From 0e38177c4b09001ab40676bc0e5d4e850b347561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97?= Date: Tue, 6 Jan 2026 14:56:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/MatchService.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/service/MatchService.php b/app/service/MatchService.php index 5b9a11e..d8f3b9b 100644 --- a/app/service/MatchService.php +++ b/app/service/MatchService.php @@ -197,14 +197,13 @@ class MatchService // 这里简化处理,实际可以根据数据库中的具体值调整 if ($actualLevel >= 3) { // 如果是本科及以上,可以匹配"本科"、"本科及以上"等要求 - // 简化逻辑:空字符串和NULL在业务上等价,只检查空字符串即可 - // 如果需要检查NULL,可以在后续的匹配逻辑中处理 - $query->where(function($q) { - $q->where('education_require', 'like', '%本科%') - ->where('education_require', 'like', '%硕士%', 'or') - ->where('education_require', 'like', '%博士%', 'or') - ->where('education_require', '=', '', 'or'); - }); + // 使用数组形式的 where 条件,这是 ThinkPHP 的标准用法 + $query->where([ + ['education_require', 'like', '%本科%'], + ['education_require', 'like', '%硕士%'], + ['education_require', 'like', '%博士%'], + ['education_require', '=', ''], + ], 'or'); } } @@ -214,11 +213,11 @@ class MatchService // 性别过滤 if (!empty($resume['gender'])) { - $query->where(function($q) use ($resume) { - $q->where('sex_require', '不限制') - ->where('sex_require', $resume['gender'], 'or') - ->where('sex_require', '', 'or'); - }); + $query->where([ + ['sex_require', '=', '不限制'], + ['sex_require', '=', $resume['gender']], + ['sex_require', '=', ''], + ], 'or'); } // 获取过滤后的岗位