getPage($params), $this->getLimit($params), function ($query) use ($name, $mobile, $user_id, $user_keyword) { $query->andWhere(['mall_id' => $this->mall_id]); // 会员ID if (!empty($user_id)) { $query->andWhere(['user_id' => $user_id]); } // 会员名称 if (!empty($name)) { $query->andWhere(['user_id' => ApplyList::getUserIdByName( $this->mall_id, $name )]); } // 联系电话 if (!empty($mobile)) { $query->andWhere(['user_id' => ApplyList::getUserIdByMobile( $this->mall_id, $mobile )]); } // 会员信息查询 if (!empty($user_keyword)) { $query->andWhere(['user_id' => MallUser::getUserIdByUserKeyWord( $this->mall_id, $user_keyword )]); } $query->with([ 'user' => function ($query) { $query->select(['id', 'nickname', 'username', 'mobile', 'avatar_url']); }, 'level' => function ($query) { $query->select(['id', 'mall_id', 'name', 'level']); }, 'applyInfo' => function ($query) { $query->select(['id', 'user_id', 'mobile', 'name', 'center_name', 'operation_address', 'idcard_front', 'idcard_reverse']); }, ]); } ); } /** * 删除会员 * * @param integer $id * @return boolean */ public function delUser(int $id) { $user = UserCenter::getCenterById($this->mall_id, $id); if (empty($user)) return $this->error('运营中心不存在'); $user->delete(); return true; } }