perf: 支持通过职位名称搜索成员

This commit is contained in:
kuaifan 2024-12-01 01:52:29 +08:00
parent 396144f3fb
commit a160b2a471
3 changed files with 19 additions and 4 deletions

View File

@ -134,7 +134,9 @@ class DialogController extends AbstractController
if (str_contains($key, "@")) {
$query->where("email", "like", "%{$key}%");
} else {
$query->where("nickname", "like", "%{$key}%")->orWhere("pinyin", "like", "%{$key}%");
$query->where("nickname", "like", "%{$key}%")
->orWhere("pinyin", "like", "%{$key}%")
->orWhere("profession", "like", "%{$key}%");
}
})->orderBy('userid')
->take(20 - count($list))

View File

@ -520,7 +520,8 @@ class UsersController extends AbstractController
} else {
$builder->where(function($query) use ($keys) {
$query->where("nickname", "like", "%{$keys['key']}%")
->orWhere("pinyin", "like", "%{$keys['key']}%");
->orWhere("pinyin", "like", "%{$keys['key']}%")
->orWhere("profession", "like", "%{$keys['key']}%");
});
}
}

View File

@ -114,7 +114,7 @@
</template>
<div class="last-text">
<em v-if="formatMsgEmojiDesc(dialog.last_msg)">{{formatMsgEmojiDesc(dialog.last_msg)}}</em>
<span>{{$A.getMsgSimpleDesc(dialog.last_msg)}}</span>
<span>{{$A.getMsgSimpleDesc(dialog.last_msg) || showProfessionDesc(dialog.dialog_user)}}</span>
</div>
</template>
<div v-if="dialog.silence" class="taskfont last-silence">&#xe7d7;</div>
@ -469,8 +469,13 @@ export default {
},
contactsList() {
const {contactsKey} = this;
const list = [];
this.contactsFilter.some(user => {
this.contactsFilter.some(data => {
const user = $A.cloneJSON(data);
if (contactsKey && $A.strExists(user.profession, contactsKey)) {
user.tags.push(user.profession)
}
let az = user.az ? user.az.toUpperCase() : "#";
let item = list.find(item => item.az == az);
if (item) {
@ -998,6 +1003,13 @@ export default {
return null;
},
showProfessionDesc(dialog_user) {
if (dialog_user) {
return `[${dialog_user.profession}]`
}
return ''
},
lastMsgReadDone(data) {
if ($A.isJson(data)) {
const {userid, percentage} = data;