总结如下:
//单一查询条件
$user = $this->where('userId',$userId)->field('secretKey,loginPwd')->find();
//多个查询条件,可以多加一个where
$user = $this->where('userId',$userId)->where('userName',$userName)->field('secretKey,loginPwd')->find();
//多个查询条件
$user = $this->where(['userId'=>$userId,'userName'=>$userName])->field('secretKey,loginPwd')->find();
//多个查询条件
$loginName = input('loginName');
$userName = input('userName');
if($loginName !='')$where['loginName'] = ['like','%'.$loginName.'%'];
if($userName != '')$where['userName'] = ['like','%'.$userName.'%'];
$user = $this->where($where)->field('secretKey,loginPwd')->find();
//另一种写法
$user = $this->where(['loginName'=>['like','%'.$loginName.'%'],'userName'=>['like','%'.$userName.'%']])->field('secretKey,loginPwd')->find();