public function index_iwe() { $cName = 'Home\\Common\\Lottery\\LotteryRuleFactory'; if (class_exists($cName)) { $obj = new $cName(); $mName = 'getDemoText'; $this->assign('str', $obj->{$mName}()); } else { $this->assign('str', 'Class not exists!'); } $cName_helper = 'Home\\Common\\Lottery\\' . 'Helper'; if (class_exists($cName_helper)) { $obj_helper = new $cName_helper(); $mName_helper = 'getDemoText'; $this->assign('str_helper', $obj_helper->{$mName_helper}()); } else { $this->assign('str_helper', 'Class not exists!'); } //$another = new \Home\Common\Lottery\Helper(' Test INPUT '); $another = new \Home\Common\Lottery\Helper(); $this->assign('another_str', $another->getDemoText()); $this->assign('global_str', $this->global_str); $meeting_id = '1431'; $lotteryRules_by_meetingId = M('lottery_rules')->where('meetingID=' . $meeting_id)->select(); $currentMeeting = M('meetings')->find($meeting_id); $lotteryRules_by_templateId = M('lottery_rules')->where('meetingTplID=' . $currentMeeting['Tplid'])->select(); $test_str = ',0,1,2,3,'; $this->assign('test_str', trim($test_str, ',')); /* $survey_list = M('meeting_survey')->where('meetingid=1431')->select(); $survey_question_map = array(); foreach($survey_list as $key=>$survey){ $questionids = explode(',', trim($survey['questionids'], ',')); $map['id'] = array('in', $questionids, 'AND'); $map['hasanswer'] = array('eq', 2, 'AND'); $questions = M('survey_questions')->where($map)->select(); $survey_question_map[$survey['id']] = $questions; } $answer_openids = M('survey_answers')->field('openid')->distinct(true)->where('meetingid=1431')->select(); $this->assign('openids', $answer_openids); */ //unset($map); $questionids = '1601, 1602, 1603, 1604'; //$map['td_survey_questions.id'] = array('in', $questionids); /* $question_answers = new \Think\Model(); $question_answers->query('select q.id, questionid, q.selections, q.answer correctAnswer, a.openid, a.answer from td_survey_questions q left join td_survey_answers a on q.id = a.questionid where q.id in ('.$questionids.')'); */ $question_answers_model = new \Think\Model(); $question_answer = $question_answers_model->query('select q.id, questionid, q.selections, q.answer correctAnswer, a.openid, a.answer from td_survey_questions q left join td_survey_answers a on q.id = a.questionid where q.id in (' . $questionids . ') order by a.openid'); /* $question_answers = M('survey_questions')->join('left join td_survey_answers survey_answers on td_survey_questions.id=survey_answers.questionid') ->field('td_survey_questions.id questionid, td_survey_questions.selections, td_survey_questions.answer correctAnswer, survey_answers.openid, survey_answers.answer') ->where($map); */ echo $question_answers_model->getLastSql(); $list = array('Shingen', 'Kenshin', 'Ieyasu', 'Nobunaga'); $this->assign('list', $list); $this->display(); }