'晨读词汇', 'moduleType'=>'english_4', 'setting'=>array( 'vocabularySelfTest' =>array( //词汇自测 "coreVocabulary"=>array( //核心词汇开关 "onOff" =>1, "vocabularyUse" =>1 //词汇运用 ), "keyPhrases" =>1 //重点短语 ), "focusOnGrammar" =>array(//语法聚焦 "singleSentenceGrammar" =>1, //单句语法填空 "grammaticalFillIn" =>1 //语法填空 ), "writingTraining" =>array(//写作训练 "commentsOnGoodSentences" =>1, // 佳句点拨 "actualCombatDrill" =>1 //实战演练 ), "extensiveReadingOfForeignJournals" =>array( //外刊泛读 "accumulationOfNewWords" =>1, //新词积累 "appreciationOfGoldenSentences" =>1, //金句赏析 "fullTextTranslation" =>1, //全文翻译 ), ) ); private $englishConfig_5=array( 'moduleName'=>'词汇宝', 'moduleType'=>'english_5', 'setting'=>array( 'isWhole' => 0, 'training' => array( //a-词汇集训 'wordReview' => 0, //词汇回顾 'wordExplain' => 1, // 词汇精讲 'practiceExact' => array( // 精准训练 'translate' => 1, //英汉互译 'wordApply' => 1, //词汇运用 'discourse' => 0, //语篇训练 'wordSpell' => 1, //单词拼写 'sentenceFill' => 1, //单句语法填空 'sentenceTranslate' => 0, //单句翻译 ) // ), 'checkCard' => 1, //词汇集训检测卡 'wrongPractice' => 1, //错词再练 'wrongPracticeTimes' => 3, //第几次推送错词再练 ) ); private $englishConfig_6=array( 'moduleName'=>'写作宝', 'moduleType'=>'english_6', 'setting'=>array( 'qcbdSwitch'=>1,//取长补短开关 'qcbd'=>array(//取长补短 'myEssay'=>1,//我的作文 'goodEssay'=>0//优秀范文 ), 'ocr'=>1,//OCR图像识别结果 'wdfx'=>1,//维度分析 'py'=>1,//评语 'ajdp'=>1,//按句点评 'ldsmSwitch'=>1,//亮点说明开关 'ldsm'=>array(//亮点说明 'grld'=>1,//个人亮点 'bjld'=>1,//班级亮点 ), 'cdtn'=>1,//错点提能 'lddyCount'=>10,//亮点短语 'ldjxCount'=>5//亮点句型 ) ); public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return 'product_setting'; } /** * @return array|null * 获取所有默认设置数据 */ public function getDefaultPro(){ $criteria = new CDbCriteria(); $criteria->select = 'ps_id,product_type'; $criteria->addCondition('is_default=1'); $result = $this->findAll($criteria); if($result){ $info = getAttributes($result); }else{ $info = array(); } return $info; } /** * @return array|null * 获取产品设置列表 */ public function getProductList($subjectId=3){ $criteria = new CDbCriteria(); $criteria->select = 'ps_id,name,product_type,is_default,subject_id,custom_config'; $criteria->addCondition('subject_id='.$subjectId); $criteria->order = 'product_type,ps_id ASC'; $result = getAttributes($this->findAll($criteria)); return $result; } /** * @param int $id * @return static * 获取设置详情 */ public function getSetInfo($id=0,$subjectId=3){ if($id>0 && $id!='NULL'){ $result = $this->findByPk($id); }else{ $criteria = new CDbCriteria(); if($subjectId==8){ $criteria->addCondition('product_type=6 AND is_default=1 AND subject_id='.$subjectId); }else{ $criteria->addCondition('product_type=1 AND is_default=1 AND subject_id='.$subjectId); } $result = $this->find($criteria); } return $result; } /** * @param $type * @return array * 通过产品类型获取默认设置详情 */ public function getDefaultByType($type){ $criteria = new CDbCriteria(); $criteria->select = "product_type,ps_id"; $criteria->addCondition("product_type={$type} AND is_default=1"); $result = $this->find($criteria); return $result->getAttributes(); } /** * @param $psType * @param $name * @return array * 添加新的产品 */ public function addNew($psType,$name,$subjectId=3){ $criteria = new CDbCriteria(); $criteria->select = 'ps_id'; $criteria->addCondition("product_type={$psType} AND name='{$name}' AND subject_id='{$subjectId}'"); $result = $this->find($criteria); if($result){ //重名 return array('status'=>0,'msg'=>"重名"); }else{ $criteria = new CDbCriteria(); $criteria->addCondition("product_type={$psType} AND is_default=1"); $oldResult = $this->find($criteria); $new = $oldResult->getAttributes(); $ps = new SProductSetting(); $ps->name = $name; $ps->product_type = $new['product_type']; $ps->show_map = $new['show_map']; $ps->show_kp = $new['show_kp']; $ps->show_top = $new['show_top']; $ps->show_wrg_origin = $new['show_wrg_origin']; $ps->show_wrg_analyze = $new['show_wrg_analyze']; $ps->show_guide = $new['show_guide']; $ps->st_tuozhan = $new['st_tuozhan']; $ps->st_wrong = $new['st_wrong']; $ps->st_reduce = $new['st_reduce']; $ps->show_level = $new['show_level']; $ps->create_time = time(); $ps->is_default = 0; $ps->subject_id=$subjectId; $ps->custom_config=$new['custom_config']; $bool = $ps->save(); if($bool){ return array('status'=>1,'msg'=>$ps->primaryKey); }else{ return array('status'=>0,'msg'=>"保存失败"); } } } /** * @param $psType * @param $name * @return string * 重命名 */ public function rename($psType,$name){ $ti = explode('_',$psType); $criteria = new CDbCriteria(); $criteria->select = 'ps_id'; $criteria->addCondition("product_type={$ti[0]} AND ps_id!={$ti[1]} AND name='{$name}'"); $result = $this->find($criteria); if($result){ //重名 return '2'; }else{ //更新 $bool = $this->updateByPk($ti[1],array('name'=>$name)); if($bool!==false){ return '1'; }else{ return '0'; } } } /** * @return bool * 初始化预设产品设置 */ public function initProductSetting($subjectId=3,$custom=false,$provinceId=0){ $criteria = new CDbCriteria(); if($subjectId==8){ $criteria->addCondition('product_type=4 AND is_default=1 AND subject_id='.$subjectId); }else{ $criteria->addCondition('product_type=1 AND is_default=1 AND subject_id='.$subjectId); } $result = $this->find($criteria); if($result){ return true; } //插入product_setting数据 $productVer = $this->getPerVersion($subjectId,$custom,$provinceId); foreach($productVer as $key => $value){ foreach($value as $k => $v){ $valueStr = "('{$v['name']}',{$v['product_type']},{$v['show_map']},{$v['show_kp']},{$v['show_wrg_origin']},{$v['show_wrg_analyze']},{$v['show_guide']},'{$v['st_tuozhan']}','{$v['st_wrong']}','{$v['st_reduce']}',{$v['show_level']},{$v['create_time']},{$v['is_default']},{$subjectId},'{$v['custom_config']}')"; $sql = "INSERT INTO `product_setting` (`name`,`product_type`,`show_map`,`show_kp`,`show_wrg_origin`,`show_wrg_analyze`,`show_guide`,`st_tuozhan`,`st_wrong`,`st_reduce`,`show_level`,`create_time`,`is_default`,`subject_id`,`custom_config`) VALUES ".$valueStr; $bool = $this->getDbConnection()->createCommand($sql)->execute(); //$versionRelPsId[$key.'_'.$k] = (int)$this->getDbConnection()->getLastInsertID(); } } return true; } //预设版本 public function getPerVersion($subjectId=3,$custom=false,$provinceId=0){ //1-错题本 2-个性化学习方案 3-个性化学习宝 $time = time(); $productVer = array( 1 => array( 0 => array( 'name' => '默认', 'product_type' => 1,//1-错题本 2-个性化学习方案 3-个性化学习宝 'show_map' => 1,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 1,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 1,//显示错因分析 1-是 0-否 'show_guide' => 1,//显示名师指导 1-是 0-否 'st_tuozhan' => '1|2|3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '5|5',//知识点数量 'custom_config'=>'', ) ) ); //英语模块默认配置 $defaultSetting=array( 'moduleName'=>'晨读词汇', 'setting'=>array( 'lexicalClassification' =>1, //词汇分类 'exampleSentenceWriting' =>1, //例句填词 'associativeMemory' =>1, //联想记忆 'lexicalUse' =>1, //词汇运用 'grammaticalFocus' =>1, //语法聚焦 'extraCredit' =>1, //美文赏析 'vocabularyConsolidation' =>1, //语汇巩固 'grammaticalEnhancement' =>1, //语法强化 'discourseEnhancement' =>1, //语篇提升 'finishingBreakthrough' =>1, //完型突破 'achievementAnalysisAndGoalSetting' =>1, //成绩分析定目标 'analyzeAndFindTheCause' =>1, //分析错题找原因 'readingTrainingLevel' =>1, //阅读训练分等级 'writingInstructionSkills' =>1, //写作指导学技巧 'numberOfWrongQuestions' =>array( //错题数量 //晨读词汇部分设置 'exampleSentenceWriting' =>10, //例句填词 5,10,15 'lexicalUse' =>array( 'wordSpelling' =>10, //单词拼写 5,10,15 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15 'singleSentenceTranslation' =>10, //单句翻译 'singleChoice' =>10 //单项选择 5,10,15 ), 'grammaticalFocus' =>array( 'singleChoice' =>10, //单项选择 5,10,15 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15 'singleSentenceCorrection' =>10, //单句改错 5,10,15 'grammaticalFillIn' =>1, //语法填空1,2,3 'errorCorrection' =>1, //短文改错1,2,3 ), 'extraCredit' =>1, //美文赏析1,2,3 //阶段复习部分设置 'vocabularyConsolidation' =>array( //语汇巩固 'bankedCloze' =>10, //选词填空 'singleSentenceTranslation' =>10, //单句翻译 ), 'grammaticalEnhancement' =>array( 'singleChoice' =>10, //单项选择 5,10,15 'singleSentenceCorrection' =>10, //单句改错 5,10,15 'grammaticalFillIn' =>1, //语法填空1,2,3 'errorCorrection' =>1, //短文改错1,2,3 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15 ), 'discourseEnhancement' =>array( //语篇提升 'readingComprehension' =>'1-1', //阅读理解 1配1,2配2 ), 'finishingBreakthrough' =>array( //完型突破 'gestaltFilling' =>'1-1', //完形填空 1配1,2配2 ), //考后复习部分设置 'readingTrainingLevel' =>array( 'readingComprehension' =>'1', //阅读理解 1配1,2配2 'taskBasedReading' =>1, //短文改错1,2,3==>任务型阅读 'sevenChooseFive' =>1, //七选五1,2,3 'gestaltFilling' =>'1', //完形填空 1配1,2配2 ), ) ) ); if($subjectId==3){ $productVer[2]=array( 0 => array( 'name' => '默认', 'product_type' => 2,//1-错题本 2-个性化学习方案 3-个性化学习宝 'show_map' => 1,//显示成长轨迹 1-是 0-否 'show_top' => 1, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '5|5',//知识点数量 'custom_config'=>'', ) ); $productVer[3]=array( 0 => array( 'name' => '默认', 'product_type' => 3,//1-错题本 2-个性化学习方案 3-个性化学习宝 'show_map' => 1,//显示成长轨迹 1-是 0-否 'show_top' => 1, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 1,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 1,//显示错因分析 1-是 0-否 'show_guide' => 1,//显示名师指导 1-是 0-否 'st_tuozhan' => '3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '5|5',//知识点数量 'custom_config'=>'', ) ); }elseif($subjectId==8){ //英语模块默认配置 $defaultSetting=array( 'moduleName'=>'晨读词汇', 'moduleType'=>'english_1', 'setting'=>array( 'lexicalClassification' =>1, //词汇分类 'exampleSentenceWriting' =>1, //例句填词 'associativeMemory' =>1, //联想记忆 'lexicalUse' =>1, //词汇运用 'grammaticalFocus' =>1, //语法聚焦 'extraCredit' =>1, //美文赏析 'numberOfWrongQuestions' =>array( //错题数量 ) ) ); if($provinceId==11){ $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['singleChoice']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleChoice']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10; }elseif($provinceId==12){ $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['wordSpelling']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceGrammar']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10; }else{ $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['wordSpelling']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['grammaticalFillIn']=1; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10; } $englishConfig=$defaultSetting; $productVer[2]=array( 0 => array( 'name' => '默认', 'product_type' => 4,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); $defaultSetting=array( 'moduleName'=>'阶段复习', 'moduleType'=>'english_2', 'setting'=>array( 'vocabularyConsolidation' =>1, //语汇巩固 'grammaticalEnhancement' =>1, //语法强化 'discourseEnhancement' =>1, //语篇提升 'finishingBreakthrough' =>1, //完型突破 'numberOfWrongQuestions' =>array( //错题数量 //阶段复习部分设置 'grammaticalEnhancement' =>array( ), 'vocabularyConsolidation'=>array( 'bankedCloze'=>10 ), ) ) ); if($provinceId==11){ $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleChoice']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10; }elseif($provinceId==12){ $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceGrammar']=10; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10; }else{ $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['grammaticalFillIn']=1; $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10; } $englishConfig=$defaultSetting; $productVer[3]=array( 0 => array( 'name' => '默认', 'product_type' => 5,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); $englishConfig=array( 'moduleName'=>'个性化学习宝', 'moduleType'=>'english_3', 'setting'=>array( 'achSwitch'=>1,//成长轨迹开关 'achievementAnalysisAndGoalSetting' =>array(//成长轨迹 'basicInformation'=>1,//基本情况 'classRankTrendChart'=>1,//班级排名趋势图 'personAveScoreRate'=>1//个人与班级平均得分率对比图 ), 'analyzeAndFindTheCause' =>1, //阶段小结 'topicScoreSwitch'=>1,//题型得分表开关 'topicTypeScore' =>array( //题型得分表 'questionTypeScore' =>1, //题型得分表 'analysisOfWrongQuestions' =>1 //错题分析 ), 'personSwitch'=>1,//个性训练开关 'personalTraining' =>array( //个性训练 'readingLevelDescription' =>1, //阅读等级说明 'discourseSwitch'=>1,//语篇题开关 'discourseTitle'=>array(//语篇题 'errorAnalysis' =>1, //错因分析 'vocabularyAccumulation' =>1, //词汇积累 'syntacticAnalysis' =>1, //句法剖析 'variantTrainingSwitch'=>1,//变式训练开关 'variantTraining'=>array( //变式训练 'vocabularyApplication' =>1, //词汇运用' 'skillInspiration' =>1, //技巧点拨 'disVariantTraining' =>1, //变式训练 ), ), 'grammaFillSwitch'=>1,//语法填空开关 'grammaFill'=>array( //语法填空 'errorAnalysis' =>1, //错因分析 'graVariantTraining' =>1, //变式训练 ), 'writingGuidanceSwitch'=>1,//写作指导开关 'writingGuidance'=>array( //写作指导 'compositionSwitch'=>1,//作文展示开关 'compositionDisplay'=>array( //作文展示 'myComposition'=>1, //我的作文 'excellentComposition'=>1 //优秀作文 ), 'intelligentDiagnosis' =>1, //智能诊断结果 'thinkingOfExamination' =>1, //审题思路 'standardModelText' =>1, //标准范文 'modelTextHighlights' =>1, //范文亮点 'writingTemplate' =>1, //写作模板 ), ), 'variantTrainingOfCommonProblems' =>1, //共性问题变式训练 'printSeparately'=>1,//题目答案分开打印 'oldPaperAnswer'=>1,//原卷答案 'isMandatoryChangePage'=>1,//"共性问题变式训练"是否强制换页 'isStudentEditionContainAnswer'=>1,//答案中是否显示“共性问题变式训练”答案 'numberOfWrongQuestions' =>array( //错题数量 //考后复习部分设置 'scoringTraining' =>array( 'readingComprehension' =>'1', //阅读理解 1配1,2配2 'taskBasedReading' =>1, //短文改错1,2,3==>任务型阅读 'sevenChooseFive' =>1, //七选五1,2,3 'gestaltFilling' =>'1', //完形填空 1配1,2配2 'grammaticalFillIn' =>'1', //语法填空 'vocabularyApplication' =>10, //词汇运用 ), ), 'commonType'=>0,//共性问题变式训练题型 'productName'=>'英语个性化学习宝',//产品名称 // 'teachingProgress'=>array(//教学进度 // 'nodeIds'=>'4_4_7', // 'nodeStr'=>'新课标人教版_必修一_Unit 1 Friendship' // ), 'exCompositionScope'=>1,//优秀作文选择范围 1-本班 2-本次考试 'growthTrackExamCount'=>1,//成长轨迹(显示的最小考试场次) ) ); $productVer[4]=array( 0 => array( 'name' => '默认', 'product_type' => 6,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); $englishConfig=$this->englishConfig_4; $productVer[5]=array( 0 => array( 'name' => '默认', 'product_type' => 7,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); } return $productVer; } //新增默认晨读模块 public function initEnglishCdch(){ $englishConfig=$this->englishConfig_4; $time=time(); $productVer[]=array( 0 => array( 'name' => '默认', 'product_type' => 7,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); foreach($productVer as $key => $value){ foreach($value as $k => $v){ $valueStr = "('{$v['name']}',{$v['product_type']},{$v['show_map']},{$v['show_kp']},{$v['show_wrg_origin']},{$v['show_wrg_analyze']},{$v['show_guide']},'{$v['st_tuozhan']}','{$v['st_wrong']}','{$v['st_reduce']}',{$v['show_level']},{$v['create_time']},{$v['is_default']},8,'{$v['custom_config']}')"; $sql = "INSERT INTO `product_setting` (`name`,`product_type`,`show_map`,`show_kp`,`show_wrg_origin`,`show_wrg_analyze`,`show_guide`,`st_tuozhan`,`st_wrong`,`st_reduce`,`show_level`,`create_time`,`is_default`,`subject_id`,`custom_config`) VALUES ".$valueStr; $this->getDbConnection()->createCommand($sql)->execute(); } } return true; } //新增默认晨读模块 public function initEnglishMagicWOrd(){ $englishConfig=$this->englishConfig_5; $time=time(); $productVer[]=array( 0 => array( 'name' => '默认', 'product_type' => 8,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇,8魔法词汇宝 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); foreach($productVer as $key => $value){ foreach($value as $k => $v){ $valueStr = "('{$v['name']}',{$v['product_type']},{$v['show_map']},{$v['show_kp']},{$v['show_wrg_origin']},{$v['show_wrg_analyze']},{$v['show_guide']},'{$v['st_tuozhan']}','{$v['st_wrong']}','{$v['st_reduce']}',{$v['show_level']},{$v['create_time']},{$v['is_default']},8,'{$v['custom_config']}')"; $sql = "INSERT INTO `product_setting` (`name`,`product_type`,`show_map`,`show_kp`,`show_wrg_origin`,`show_wrg_analyze`,`show_guide`,`st_tuozhan`,`st_wrong`,`st_reduce`,`show_level`,`create_time`,`is_default`,`subject_id`,`custom_config`) VALUES ".$valueStr; $this->getDbConnection()->createCommand($sql)->execute(); } } return true; } //新增默认写作宝 public function initEnglishWriting(){ $englishConfig=$this->englishConfig_6; $time=time(); $productVer[]=array( 0 => array( 'name' => '默认', 'product_type' => 9,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇,8魔法词汇宝,9写作宝 'show_map' => 0,//显示成长轨迹 1-是 0-否 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否 'show_guide' => 0,//显示名师指导 1-是 0-否 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生 'st_wrong' => '',//错题本过滤难题 'st_reduce' => '',//减少提分题 'show_level' => 0,//提分题分层 1-是 0-否 'create_time' => $time,//创建时间 'is_default' => 1,//是否默认设置 1-是 0-否 'top_kps' => '',//知识点数量 'custom_config'=>json_encode($englishConfig) ) ); foreach($productVer as $key => $value){ foreach($value as $k => $v){ $valueStr = "('{$v['name']}',{$v['product_type']},{$v['show_map']},{$v['show_kp']},{$v['show_wrg_origin']},{$v['show_wrg_analyze']},{$v['show_guide']},'{$v['st_tuozhan']}','{$v['st_wrong']}','{$v['st_reduce']}',{$v['show_level']},{$v['create_time']},{$v['is_default']},8,'{$v['custom_config']}')"; $sql = "INSERT INTO `product_setting` (`name`,`product_type`,`show_map`,`show_kp`,`show_wrg_origin`,`show_wrg_analyze`,`show_guide`,`st_tuozhan`,`st_wrong`,`st_reduce`,`show_level`,`create_time`,`is_default`,`subject_id`,`custom_config`) VALUES ".$valueStr; $this->getDbConnection()->createCommand($sql)->execute(); } } return true; } public function getCommonSetting($classId,$subjectId,$type){ $sql = "select custom_config from product_class_relation pcr join product_setting ps on pcr.ps_id=ps.ps_id where pcr.class_id={$classId} and product_type={$type} and ps.subject_id = {$subjectId}"; $res = $this->findBySql($sql); $check = 1; if ($res) { $config = json_decode($res->custom_config,true); $setting = $config['setting']; $check = isset($setting['variantTrainingOfCommonProblems']) ? $setting['variantTrainingOfCommonProblems'] : 1; } return $check; } }