getDbConnection()->createCommand($sql)->queryAll(); $info = array(); foreach($res as $key=>$val){ if($sub) $val['phone_number'] = substr(trim($val['phone_number']),-4); $info[$val['phone_number']] = $val['teacher_id']; } return $info; } public function getAddTeacherInfo($phoneArr){ if(empty($phoneArr)) return false; $sql = 'SELECT teacher_id,phone_number FROM xb_teacher WHERE phone_number in( '.implode(',',$phoneArr).')'; $res = $this->getDbConnection()->createCommand($sql)->queryAll(); $info = array(); foreach($res as $key=>$val){ $info[$val['phone_number']] = $val['teacher_id']; } return $info; } public function getTeacherIdByNumber($phone,$schoolId){ if(!$phone || !is_numeric($phone)) return null; $sql="select teacher_id,phone_number from xb_teacher where phone_number like '%".$phone."%' and school_id='".$schoolId."'"; $res = $this->getDbConnection()->createCommand($sql)->queryAll(); $info = array(); foreach($res as $key=>$val){ $info[$val['phone_number']] = $val['teacher_id']; } return $info; } }