作者 lishaoshuai
1 个管道 的构建 通过 耗费 0 秒

更新 CardController.php 搜索调整

... ... @@ -64,7 +64,7 @@ class CardController extends RestBaseController
//加分享过的名片
$ids = Db::name('card_log')->where(['user_id' => $this->userId])->column('card_id');
if($data['keyword']) {
$condition['c.name|company|tel'] = ['like','%'.$data['keyword'].'%'];
$condition2['c.name|company|tel'] = ['like','%'.$data['keyword'].'%'];
//搜索日志
$info = Db::name('search')->where(['keyword' => $data['keyword']])->find();
if ($info) {
... ... @@ -82,12 +82,12 @@ class CardController extends RestBaseController
}
}
$condition = $condition == '' ? '1=1' : $condition;
$condition['c.id'] = ['in',$ids];
$condition2['c.id'] = ['in',$ids];
$result = Db::name('card')
->alias('c')
->join('user u','c.user_id=u.id','left')
->where($condition)
//->whereOr($condition2)
->whereOr($condition2)
->field('c.id,c.name,c.position,c.tel,c.home_tel,c.email,c.company,u.avatar,IF(c.user_id='.$this->userId.',c.user_id,0) top')
->order('top desc,c.create_time desc')
->paginate($per_page);
... ...