SProductSetting.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <?php
  2. /**
  3. * 产品设置.
  4. * User: chenye
  5. * Date: 2017/11/22
  6. * Time: 11:10
  7. */
  8. class SProductSetting extends MyActiveRecord {
  9. private $englishConfig_4=array(
  10. 'moduleName'=>'晨读词汇',
  11. 'moduleType'=>'english_4',
  12. 'setting'=>array(
  13. 'vocabularySelfTest' =>array( //词汇自测
  14. "coreVocabulary"=>array( //核心词汇开关
  15. "onOff" =>1,
  16. "vocabularyUse" =>1 //词汇运用
  17. ),
  18. "keyPhrases" =>1 //重点短语
  19. ),
  20. "focusOnGrammar" =>array(//语法聚焦
  21. "singleSentenceGrammar" =>1, //单句语法填空
  22. "grammaticalFillIn" =>1 //语法填空
  23. ),
  24. "writingTraining" =>array(//写作训练
  25. "commentsOnGoodSentences" =>1, // 佳句点拨
  26. "actualCombatDrill" =>1 //实战演练
  27. ),
  28. "extensiveReadingOfForeignJournals" =>array( //外刊泛读
  29. "accumulationOfNewWords" =>1, //新词积累
  30. "appreciationOfGoldenSentences" =>1, //金句赏析
  31. "fullTextTranslation" =>1, //全文翻译
  32. ),
  33. )
  34. );
  35. private $englishConfig_5=array(
  36. 'moduleName'=>'词汇宝',
  37. 'moduleType'=>'english_5',
  38. 'setting'=>array(
  39. 'isWhole' => 0,
  40. 'training' => array( //a-词汇集训
  41. 'wordReview' => 0, //词汇回顾
  42. 'wordExplain' => 1, // 词汇精讲
  43. 'practiceExact' => array( // 精准训练
  44. 'translate' => 1, //英汉互译
  45. 'wordApply' => 1, //词汇运用
  46. 'discourse' => 0, //语篇训练
  47. 'wordSpell' => 1, //单词拼写
  48. 'sentenceFill' => 1, //单句语法填空
  49. 'sentenceTranslate' => 0, //单句翻译
  50. ) //
  51. ),
  52. 'checkCard' => 1, //词汇集训检测卡
  53. 'wrongPractice' => 1, //错词再练
  54. 'wrongPracticeTimes' => 3, //第几次推送错词再练
  55. )
  56. );
  57. private $englishConfig_6=array(
  58. 'moduleName'=>'写作宝',
  59. 'moduleType'=>'english_6',
  60. 'setting'=>array(
  61. 'qcbdSwitch'=>1,//取长补短开关
  62. 'qcbd'=>array(//取长补短
  63. 'myEssay'=>1,//我的作文
  64. 'goodEssay'=>0//优秀范文
  65. ),
  66. 'ocr'=>1,//OCR图像识别结果
  67. 'wdfx'=>1,//维度分析
  68. 'py'=>1,//评语
  69. 'ajdp'=>1,//按句点评
  70. 'ldsmSwitch'=>1,//亮点说明开关
  71. 'ldsm'=>array(//亮点说明
  72. 'grld'=>1,//个人亮点
  73. 'bjld'=>1,//班级亮点
  74. ),
  75. 'cdtn'=>1,//错点提能
  76. 'lddyCount'=>10,//亮点短语
  77. 'ldjxCount'=>5//亮点句型
  78. )
  79. );
  80. public static function model($className = __CLASS__)
  81. {
  82. return parent::model($className);
  83. }
  84. public function tableName()
  85. {
  86. return 'product_setting';
  87. }
  88. /**
  89. * @return array|null
  90. * 获取所有默认设置数据
  91. */
  92. public function getDefaultPro(){
  93. $criteria = new CDbCriteria();
  94. $criteria->select = 'ps_id,product_type';
  95. $criteria->addCondition('is_default=1');
  96. $result = $this->findAll($criteria);
  97. if($result){
  98. $info = getAttributes($result);
  99. }else{
  100. $info = array();
  101. }
  102. return $info;
  103. }
  104. /**
  105. * @return array|null
  106. * 获取产品设置列表
  107. */
  108. public function getProductList($subjectId=3){
  109. $criteria = new CDbCriteria();
  110. $criteria->select = 'ps_id,name,product_type,is_default,subject_id,custom_config';
  111. $criteria->addCondition('subject_id='.$subjectId);
  112. $criteria->order = 'product_type,ps_id ASC';
  113. $result = getAttributes($this->findAll($criteria));
  114. return $result;
  115. }
  116. /**
  117. * @param int $id
  118. * @return static
  119. * 获取设置详情
  120. */
  121. public function getSetInfo($id=0,$subjectId=3){
  122. if($id>0 && $id!='NULL'){
  123. $result = $this->findByPk($id);
  124. }else{
  125. $criteria = new CDbCriteria();
  126. if($subjectId==8){
  127. $criteria->addCondition('product_type=6 AND is_default=1 AND subject_id='.$subjectId);
  128. }else{
  129. $criteria->addCondition('product_type=1 AND is_default=1 AND subject_id='.$subjectId);
  130. }
  131. $result = $this->find($criteria);
  132. }
  133. return $result;
  134. }
  135. /**
  136. * @param $type
  137. * @return array
  138. * 通过产品类型获取默认设置详情
  139. */
  140. public function getDefaultByType($type){
  141. $criteria = new CDbCriteria();
  142. $criteria->select = "product_type,ps_id";
  143. $criteria->addCondition("product_type={$type} AND is_default=1");
  144. $result = $this->find($criteria);
  145. return $result->getAttributes();
  146. }
  147. /**
  148. * @param $psType
  149. * @param $name
  150. * @return array
  151. * 添加新的产品
  152. */
  153. public function addNew($psType,$name,$subjectId=3){
  154. $criteria = new CDbCriteria();
  155. $criteria->select = 'ps_id';
  156. $criteria->addCondition("product_type={$psType} AND name='{$name}' AND subject_id='{$subjectId}'");
  157. $result = $this->find($criteria);
  158. if($result){
  159. //重名
  160. return array('status'=>0,'msg'=>"重名");
  161. }else{
  162. $criteria = new CDbCriteria();
  163. $criteria->addCondition("product_type={$psType} AND is_default=1");
  164. $oldResult = $this->find($criteria);
  165. $new = $oldResult->getAttributes();
  166. $ps = new SProductSetting();
  167. $ps->name = $name;
  168. $ps->product_type = $new['product_type'];
  169. $ps->show_map = $new['show_map'];
  170. $ps->show_kp = $new['show_kp'];
  171. $ps->show_top = $new['show_top'];
  172. $ps->show_wrg_origin = $new['show_wrg_origin'];
  173. $ps->show_wrg_analyze = $new['show_wrg_analyze'];
  174. $ps->show_guide = $new['show_guide'];
  175. $ps->st_tuozhan = $new['st_tuozhan'];
  176. $ps->st_wrong = $new['st_wrong'];
  177. $ps->st_reduce = $new['st_reduce'];
  178. $ps->show_level = $new['show_level'];
  179. $ps->create_time = time();
  180. $ps->is_default = 0;
  181. $ps->subject_id=$subjectId;
  182. $ps->custom_config=$new['custom_config'];
  183. $bool = $ps->save();
  184. if($bool){
  185. return array('status'=>1,'msg'=>$ps->primaryKey);
  186. }else{
  187. return array('status'=>0,'msg'=>"保存失败");
  188. }
  189. }
  190. }
  191. /**
  192. * @param $psType
  193. * @param $name
  194. * @return string
  195. * 重命名
  196. */
  197. public function rename($psType,$name){
  198. $ti = explode('_',$psType);
  199. $criteria = new CDbCriteria();
  200. $criteria->select = 'ps_id';
  201. $criteria->addCondition("product_type={$ti[0]} AND ps_id!={$ti[1]} AND name='{$name}'");
  202. $result = $this->find($criteria);
  203. if($result){
  204. //重名
  205. return '2';
  206. }else{
  207. //更新
  208. $bool = $this->updateByPk($ti[1],array('name'=>$name));
  209. if($bool!==false){
  210. return '1';
  211. }else{
  212. return '0';
  213. }
  214. }
  215. }
  216. /**
  217. * @return bool
  218. * 初始化预设产品设置
  219. */
  220. public function initProductSetting($subjectId=3,$custom=false,$provinceId=0){
  221. $criteria = new CDbCriteria();
  222. if($subjectId==8){
  223. $criteria->addCondition('product_type=4 AND is_default=1 AND subject_id='.$subjectId);
  224. }else{
  225. $criteria->addCondition('product_type=1 AND is_default=1 AND subject_id='.$subjectId);
  226. }
  227. $result = $this->find($criteria);
  228. if($result){
  229. return true;
  230. }
  231. //插入product_setting数据
  232. $productVer = $this->getPerVersion($subjectId,$custom,$provinceId);
  233. foreach($productVer as $key => $value){
  234. foreach($value as $k => $v){
  235. $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']}')";
  236. $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;
  237. $bool = $this->getDbConnection()->createCommand($sql)->execute();
  238. //$versionRelPsId[$key.'_'.$k] = (int)$this->getDbConnection()->getLastInsertID();
  239. }
  240. }
  241. return true;
  242. }
  243. //预设版本
  244. public function getPerVersion($subjectId=3,$custom=false,$provinceId=0){
  245. //1-错题本 2-个性化学习方案 3-个性化学习宝
  246. $time = time();
  247. $productVer = array(
  248. 1 => array(
  249. 0 => array(
  250. 'name' => '默认',
  251. 'product_type' => 1,//1-错题本 2-个性化学习方案 3-个性化学习宝
  252. 'show_map' => 1,//显示成长轨迹 1-是 0-否
  253. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  254. 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否
  255. 'show_wrg_origin' => 1,//显示错题原型 1-是 0-否
  256. 'show_wrg_analyze' => 1,//显示错因分析 1-是 0-否
  257. 'show_guide' => 1,//显示名师指导 1-是 0-否
  258. 'st_tuozhan' => '1|2|3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  259. 'st_wrong' => '',//错题本过滤难题
  260. 'st_reduce' => '',//减少提分题
  261. 'show_level' => 0,//提分题分层 1-是 0-否
  262. 'create_time' => $time,//创建时间
  263. 'is_default' => 1,//是否默认设置 1-是 0-否
  264. 'top_kps' => '5|5',//知识点数量
  265. 'custom_config'=>'',
  266. )
  267. )
  268. );
  269. //英语模块默认配置
  270. $defaultSetting=array(
  271. 'moduleName'=>'晨读词汇',
  272. 'setting'=>array(
  273. 'lexicalClassification' =>1, //词汇分类
  274. 'exampleSentenceWriting' =>1, //例句填词
  275. 'associativeMemory' =>1, //联想记忆
  276. 'lexicalUse' =>1, //词汇运用
  277. 'grammaticalFocus' =>1, //语法聚焦
  278. 'extraCredit' =>1, //美文赏析
  279. 'vocabularyConsolidation' =>1, //语汇巩固
  280. 'grammaticalEnhancement' =>1, //语法强化
  281. 'discourseEnhancement' =>1, //语篇提升
  282. 'finishingBreakthrough' =>1, //完型突破
  283. 'achievementAnalysisAndGoalSetting' =>1, //成绩分析定目标
  284. 'analyzeAndFindTheCause' =>1, //分析错题找原因
  285. 'readingTrainingLevel' =>1, //阅读训练分等级
  286. 'writingInstructionSkills' =>1, //写作指导学技巧
  287. 'numberOfWrongQuestions' =>array( //错题数量
  288. //晨读词汇部分设置
  289. 'exampleSentenceWriting' =>10, //例句填词 5,10,15
  290. 'lexicalUse' =>array(
  291. 'wordSpelling' =>10, //单词拼写 5,10,15
  292. 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15
  293. 'singleSentenceTranslation' =>10, //单句翻译
  294. 'singleChoice' =>10 //单项选择 5,10,15
  295. ),
  296. 'grammaticalFocus' =>array(
  297. 'singleChoice' =>10, //单项选择 5,10,15
  298. 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15
  299. 'singleSentenceCorrection' =>10, //单句改错 5,10,15
  300. 'grammaticalFillIn' =>1, //语法填空1,2,3
  301. 'errorCorrection' =>1, //短文改错1,2,3
  302. ),
  303. 'extraCredit' =>1, //美文赏析1,2,3
  304. //阶段复习部分设置
  305. 'vocabularyConsolidation' =>array( //语汇巩固
  306. 'bankedCloze' =>10, //选词填空
  307. 'singleSentenceTranslation' =>10, //单句翻译
  308. ),
  309. 'grammaticalEnhancement' =>array(
  310. 'singleChoice' =>10, //单项选择 5,10,15
  311. 'singleSentenceCorrection' =>10, //单句改错 5,10,15
  312. 'grammaticalFillIn' =>1, //语法填空1,2,3
  313. 'errorCorrection' =>1, //短文改错1,2,3
  314. 'singleSentenceGrammar' =>10, //单句语法填空 5,10,15
  315. ),
  316. 'discourseEnhancement' =>array( //语篇提升
  317. 'readingComprehension' =>'1-1', //阅读理解 1配1,2配2
  318. ),
  319. 'finishingBreakthrough' =>array( //完型突破
  320. 'gestaltFilling' =>'1-1', //完形填空 1配1,2配2
  321. ),
  322. //考后复习部分设置
  323. 'readingTrainingLevel' =>array(
  324. 'readingComprehension' =>'1', //阅读理解 1配1,2配2
  325. 'taskBasedReading' =>1, //短文改错1,2,3==>任务型阅读
  326. 'sevenChooseFive' =>1, //七选五1,2,3
  327. 'gestaltFilling' =>'1', //完形填空 1配1,2配2
  328. ),
  329. )
  330. )
  331. );
  332. if($subjectId==3){
  333. $productVer[2]=array(
  334. 0 => array(
  335. 'name' => '默认',
  336. 'product_type' => 2,//1-错题本 2-个性化学习方案 3-个性化学习宝
  337. 'show_map' => 1,//显示成长轨迹 1-是 0-否
  338. 'show_top' => 1, //显示 题组训练个性化学习宝 1-是 0-否
  339. 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否
  340. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  341. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  342. 'show_guide' => 0,//显示名师指导 1-是 0-否
  343. 'st_tuozhan' => '3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  344. 'st_wrong' => '',//错题本过滤难题
  345. 'st_reduce' => '',//减少提分题
  346. 'show_level' => 0,//提分题分层 1-是 0-否
  347. 'create_time' => $time,//创建时间
  348. 'is_default' => 1,//是否默认设置 1-是 0-否
  349. 'top_kps' => '5|5',//知识点数量
  350. 'custom_config'=>'',
  351. )
  352. );
  353. $productVer[3]=array(
  354. 0 => array(
  355. 'name' => '默认',
  356. 'product_type' => 3,//1-错题本 2-个性化学习方案 3-个性化学习宝
  357. 'show_map' => 1,//显示成长轨迹 1-是 0-否
  358. 'show_top' => 1, //显示 题组训练个性化学习宝 1-是 0-否
  359. 'show_kp' => 1,//显示薄弱知识点掌握分析 1-是 0-否
  360. 'show_wrg_origin' => 1,//显示错题原型 1-是 0-否
  361. 'show_wrg_analyze' => 1,//显示错因分析 1-是 0-否
  362. 'show_guide' => 1,//显示名师指导 1-是 0-否
  363. 'st_tuozhan' => '3|4',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  364. 'st_wrong' => '',//错题本过滤难题
  365. 'st_reduce' => '',//减少提分题
  366. 'show_level' => 0,//提分题分层 1-是 0-否
  367. 'create_time' => $time,//创建时间
  368. 'is_default' => 1,//是否默认设置 1-是 0-否
  369. 'top_kps' => '5|5',//知识点数量
  370. 'custom_config'=>'',
  371. )
  372. );
  373. }elseif($subjectId==8){
  374. //英语模块默认配置
  375. $defaultSetting=array(
  376. 'moduleName'=>'晨读词汇',
  377. 'moduleType'=>'english_1',
  378. 'setting'=>array(
  379. 'lexicalClassification' =>1, //词汇分类
  380. 'exampleSentenceWriting' =>1, //例句填词
  381. 'associativeMemory' =>1, //联想记忆
  382. 'lexicalUse' =>1, //词汇运用
  383. 'grammaticalFocus' =>1, //语法聚焦
  384. 'extraCredit' =>1, //美文赏析
  385. 'numberOfWrongQuestions' =>array( //错题数量
  386. )
  387. )
  388. );
  389. if($provinceId==11){
  390. $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['singleChoice']=10;
  391. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleChoice']=10;
  392. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10;
  393. }elseif($provinceId==12){
  394. $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['wordSpelling']=10;
  395. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceGrammar']=10;
  396. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10;
  397. }else{
  398. $defaultSetting['setting']['numberOfWrongQuestions']['lexicalUse']['wordSpelling']=10;
  399. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['grammaticalFillIn']=1;
  400. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalFocus']['singleSentenceCorrection']=10;
  401. }
  402. $englishConfig=$defaultSetting;
  403. $productVer[2]=array(
  404. 0 => array(
  405. 'name' => '默认',
  406. 'product_type' => 4,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块
  407. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  408. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  409. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  410. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  411. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  412. 'show_guide' => 0,//显示名师指导 1-是 0-否
  413. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  414. 'st_wrong' => '',//错题本过滤难题
  415. 'st_reduce' => '',//减少提分题
  416. 'show_level' => 0,//提分题分层 1-是 0-否
  417. 'create_time' => $time,//创建时间
  418. 'is_default' => 1,//是否默认设置 1-是 0-否
  419. 'top_kps' => '',//知识点数量
  420. 'custom_config'=>json_encode($englishConfig)
  421. )
  422. );
  423. $defaultSetting=array(
  424. 'moduleName'=>'阶段复习',
  425. 'moduleType'=>'english_2',
  426. 'setting'=>array(
  427. 'vocabularyConsolidation' =>1, //语汇巩固
  428. 'grammaticalEnhancement' =>1, //语法强化
  429. 'discourseEnhancement' =>1, //语篇提升
  430. 'finishingBreakthrough' =>1, //完型突破
  431. 'numberOfWrongQuestions' =>array( //错题数量
  432. //阶段复习部分设置
  433. 'grammaticalEnhancement' =>array(
  434. ),
  435. 'vocabularyConsolidation'=>array(
  436. 'bankedCloze'=>10
  437. ),
  438. )
  439. )
  440. );
  441. if($provinceId==11){
  442. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleChoice']=10;
  443. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10;
  444. }elseif($provinceId==12){
  445. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceGrammar']=10;
  446. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10;
  447. }else{
  448. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['grammaticalFillIn']=1;
  449. $defaultSetting['setting']['numberOfWrongQuestions']['grammaticalEnhancement']['singleSentenceCorrection']=10;
  450. }
  451. $englishConfig=$defaultSetting;
  452. $productVer[3]=array(
  453. 0 => array(
  454. 'name' => '默认',
  455. 'product_type' => 5,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块
  456. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  457. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  458. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  459. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  460. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  461. 'show_guide' => 0,//显示名师指导 1-是 0-否
  462. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  463. 'st_wrong' => '',//错题本过滤难题
  464. 'st_reduce' => '',//减少提分题
  465. 'show_level' => 0,//提分题分层 1-是 0-否
  466. 'create_time' => $time,//创建时间
  467. 'is_default' => 1,//是否默认设置 1-是 0-否
  468. 'top_kps' => '',//知识点数量
  469. 'custom_config'=>json_encode($englishConfig)
  470. )
  471. );
  472. $englishConfig=array(
  473. 'moduleName'=>'个性化学习宝',
  474. 'moduleType'=>'english_3',
  475. 'setting'=>array(
  476. 'achSwitch'=>1,//成长轨迹开关
  477. 'achievementAnalysisAndGoalSetting' =>array(//成长轨迹
  478. 'basicInformation'=>1,//基本情况
  479. 'classRankTrendChart'=>1,//班级排名趋势图
  480. 'personAveScoreRate'=>1//个人与班级平均得分率对比图
  481. ),
  482. 'analyzeAndFindTheCause' =>1, //阶段小结
  483. 'topicScoreSwitch'=>1,//题型得分表开关
  484. 'topicTypeScore' =>array( //题型得分表
  485. 'questionTypeScore' =>1, //题型得分表
  486. 'analysisOfWrongQuestions' =>1 //错题分析
  487. ),
  488. 'personSwitch'=>1,//个性训练开关
  489. 'personalTraining' =>array( //个性训练
  490. 'readingLevelDescription' =>1, //阅读等级说明
  491. 'discourseSwitch'=>1,//语篇题开关
  492. 'discourseTitle'=>array(//语篇题
  493. 'errorAnalysis' =>1, //错因分析
  494. 'vocabularyAccumulation' =>1, //词汇积累
  495. 'syntacticAnalysis' =>1, //句法剖析
  496. 'variantTrainingSwitch'=>1,//变式训练开关
  497. 'variantTraining'=>array( //变式训练
  498. 'vocabularyApplication' =>1, //词汇运用'
  499. 'skillInspiration' =>1, //技巧点拨
  500. 'disVariantTraining' =>1, //变式训练
  501. ),
  502. ),
  503. 'grammaFillSwitch'=>1,//语法填空开关
  504. 'grammaFill'=>array( //语法填空
  505. 'errorAnalysis' =>1, //错因分析
  506. 'graVariantTraining' =>1, //变式训练
  507. ),
  508. 'writingGuidanceSwitch'=>1,//写作指导开关
  509. 'writingGuidance'=>array( //写作指导
  510. 'compositionSwitch'=>1,//作文展示开关
  511. 'compositionDisplay'=>array( //作文展示
  512. 'myComposition'=>1, //我的作文
  513. 'excellentComposition'=>1 //优秀作文
  514. ),
  515. 'intelligentDiagnosis' =>1, //智能诊断结果
  516. 'thinkingOfExamination' =>1, //审题思路
  517. 'standardModelText' =>1, //标准范文
  518. 'modelTextHighlights' =>1, //范文亮点
  519. 'writingTemplate' =>1, //写作模板
  520. ),
  521. ),
  522. 'variantTrainingOfCommonProblems' =>1, //共性问题变式训练
  523. 'printSeparately'=>1,//题目答案分开打印
  524. 'oldPaperAnswer'=>1,//原卷答案
  525. 'isMandatoryChangePage'=>1,//"共性问题变式训练"是否强制换页
  526. 'isStudentEditionContainAnswer'=>1,//答案中是否显示“共性问题变式训练”答案
  527. 'numberOfWrongQuestions' =>array( //错题数量
  528. //考后复习部分设置
  529. 'scoringTraining' =>array(
  530. 'readingComprehension' =>'1', //阅读理解 1配1,2配2
  531. 'taskBasedReading' =>1, //短文改错1,2,3==>任务型阅读
  532. 'sevenChooseFive' =>1, //七选五1,2,3
  533. 'gestaltFilling' =>'1', //完形填空 1配1,2配2
  534. 'grammaticalFillIn' =>'1', //语法填空
  535. 'vocabularyApplication' =>10, //词汇运用
  536. ),
  537. ),
  538. 'commonType'=>0,//共性问题变式训练题型
  539. 'productName'=>'英语个性化学习宝',//产品名称
  540. // 'teachingProgress'=>array(//教学进度
  541. // 'nodeIds'=>'4_4_7',
  542. // 'nodeStr'=>'新课标人教版_必修一_Unit 1 Friendship'
  543. // ),
  544. 'exCompositionScope'=>1,//优秀作文选择范围 1-本班 2-本次考试
  545. 'growthTrackExamCount'=>1,//成长轨迹(显示的最小考试场次)
  546. )
  547. );
  548. $productVer[4]=array(
  549. 0 => array(
  550. 'name' => '默认',
  551. 'product_type' => 6,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块
  552. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  553. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  554. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  555. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  556. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  557. 'show_guide' => 0,//显示名师指导 1-是 0-否
  558. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  559. 'st_wrong' => '',//错题本过滤难题
  560. 'st_reduce' => '',//减少提分题
  561. 'show_level' => 0,//提分题分层 1-是 0-否
  562. 'create_time' => $time,//创建时间
  563. 'is_default' => 1,//是否默认设置 1-是 0-否
  564. 'top_kps' => '',//知识点数量
  565. 'custom_config'=>json_encode($englishConfig)
  566. )
  567. );
  568. $englishConfig=$this->englishConfig_4;
  569. $productVer[5]=array(
  570. 0 => array(
  571. 'name' => '默认',
  572. 'product_type' => 7,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇
  573. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  574. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  575. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  576. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  577. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  578. 'show_guide' => 0,//显示名师指导 1-是 0-否
  579. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  580. 'st_wrong' => '',//错题本过滤难题
  581. 'st_reduce' => '',//减少提分题
  582. 'show_level' => 0,//提分题分层 1-是 0-否
  583. 'create_time' => $time,//创建时间
  584. 'is_default' => 1,//是否默认设置 1-是 0-否
  585. 'top_kps' => '',//知识点数量
  586. 'custom_config'=>json_encode($englishConfig)
  587. )
  588. );
  589. }
  590. return $productVer;
  591. }
  592. //新增默认晨读模块
  593. public function initEnglishCdch(){
  594. $englishConfig=$this->englishConfig_4;
  595. $time=time();
  596. $productVer[]=array(
  597. 0 => array(
  598. 'name' => '默认',
  599. 'product_type' => 7,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇
  600. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  601. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  602. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  603. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  604. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  605. 'show_guide' => 0,//显示名师指导 1-是 0-否
  606. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  607. 'st_wrong' => '',//错题本过滤难题
  608. 'st_reduce' => '',//减少提分题
  609. 'show_level' => 0,//提分题分层 1-是 0-否
  610. 'create_time' => $time,//创建时间
  611. 'is_default' => 1,//是否默认设置 1-是 0-否
  612. 'top_kps' => '',//知识点数量
  613. 'custom_config'=>json_encode($englishConfig)
  614. )
  615. );
  616. foreach($productVer as $key => $value){
  617. foreach($value as $k => $v){
  618. $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']}')";
  619. $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;
  620. $this->getDbConnection()->createCommand($sql)->execute();
  621. }
  622. }
  623. return true;
  624. }
  625. //新增默认晨读模块
  626. public function initEnglishMagicWOrd(){
  627. $englishConfig=$this->englishConfig_5;
  628. $time=time();
  629. $productVer[]=array(
  630. 0 => array(
  631. 'name' => '默认',
  632. 'product_type' => 8,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇,8魔法词汇宝
  633. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  634. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  635. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  636. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  637. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  638. 'show_guide' => 0,//显示名师指导 1-是 0-否
  639. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  640. 'st_wrong' => '',//错题本过滤难题
  641. 'st_reduce' => '',//减少提分题
  642. 'show_level' => 0,//提分题分层 1-是 0-否
  643. 'create_time' => $time,//创建时间
  644. 'is_default' => 1,//是否默认设置 1-是 0-否
  645. 'top_kps' => '',//知识点数量
  646. 'custom_config'=>json_encode($englishConfig)
  647. )
  648. );
  649. foreach($productVer as $key => $value){
  650. foreach($value as $k => $v){
  651. $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']}')";
  652. $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;
  653. $this->getDbConnection()->createCommand($sql)->execute();
  654. }
  655. }
  656. return true;
  657. }
  658. //新增默认写作宝
  659. public function initEnglishWriting(){
  660. $englishConfig=$this->englishConfig_6;
  661. $time=time();
  662. $productVer[]=array(
  663. 0 => array(
  664. 'name' => '默认',
  665. 'product_type' => 9,//1-错题本 2-个性化学习方案 3-个性化学习宝 4-自定义模块,7晨读词汇,8魔法词汇宝,9写作宝
  666. 'show_map' => 0,//显示成长轨迹 1-是 0-否
  667. 'show_top' => 0, //显示 题组训练个性化学习宝 1-是 0-否
  668. 'show_kp' => 0,//显示薄弱知识点掌握分析 1-是 0-否
  669. 'show_wrg_origin' => 0,//显示错题原型 1-是 0-否
  670. 'show_wrg_analyze' => 0,//显示错因分析 1-是 0-否
  671. 'show_guide' => 0,//显示名师指导 1-是 0-否
  672. 'st_tuozhan' => '',//拓展训练题使用的学生 1--尖子生 2--优秀生 3--中等生 4--学困生
  673. 'st_wrong' => '',//错题本过滤难题
  674. 'st_reduce' => '',//减少提分题
  675. 'show_level' => 0,//提分题分层 1-是 0-否
  676. 'create_time' => $time,//创建时间
  677. 'is_default' => 1,//是否默认设置 1-是 0-否
  678. 'top_kps' => '',//知识点数量
  679. 'custom_config'=>json_encode($englishConfig)
  680. )
  681. );
  682. foreach($productVer as $key => $value){
  683. foreach($value as $k => $v){
  684. $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']}')";
  685. $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;
  686. $this->getDbConnection()->createCommand($sql)->execute();
  687. }
  688. }
  689. return true;
  690. }
  691. public function getCommonSetting($classId,$subjectId,$type){
  692. $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}";
  693. $res = $this->findBySql($sql);
  694. $check = 1;
  695. if ($res) {
  696. $config = json_decode($res->custom_config,true);
  697. $setting = $config['setting'];
  698. $check = isset($setting['variantTrainingOfCommonProblems']) ? $setting['variantTrainingOfCommonProblems'] : 1;
  699. }
  700. return $check;
  701. }
  702. }