MainController.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. namespace teach\controllers;
  3. use common\models\xhTrainTeacher;
  4. use common\services\xhPictureCategoryService;
  5. use common\services\xhSetMealService;
  6. use common\services\xhInviteService;
  7. use common\services\xhMerchantAccountService;
  8. use common\services\xhMerchantService;
  9. use common\components\weixinUtil;
  10. use common\components\configDict;
  11. use common\components\stringUtil;
  12. use common\components\util;
  13. use common\services\xhAdminService;
  14. use common\services\xhCommonService;
  15. use common\services\xhApplyOrderService;
  16. use common\services\xhPictureService;
  17. use common\services\xhTrainClassService;
  18. use Yii;
  19. use yii\web\Controller;
  20. class MainController extends Controller
  21. {
  22. public $withoutLogin = ['index'];
  23. public $focusImg=[];
  24. public function beforeAction($action){
  25. $respond = xhPictureService::getPictureList(['categoryId' => 10],true);
  26. $focus = $respond['model'];
  27. $this->focusImg = $focus;
  28. return parent::beforeAction($action);
  29. }
  30. public function actionIndex()
  31. {
  32. return $this->render('index');
  33. }
  34. public function actionCourse()
  35. {
  36. $merchantId = 1;
  37. $matchInfo = [
  38. 1 => ['url' => './start-up', 'background' => 'couse1.jpg'],
  39. 2 => ['url' => './pursue', 'background' => 'couse3.jpg'],
  40. 3 => ['url' => './wedding', 'background' => 'couse2.jpg'],
  41. 4 => ['url' => './interest', 'background' => 'couse4.jpg'],
  42. 5 => ['url' => './diy', 'background' => 'couse5.jpg'],
  43. 6 => ['url' => './balloon', 'background' => 'couse5.jpg'],
  44. ];
  45. $class = xhTrainClassService::getAllClass($merchantId);
  46. return $this->render('course', ['class' => $class, 'matchInfo' => $matchInfo]);
  47. }
  48. public function actionAbout()
  49. {
  50. //学校荣誉
  51. $honorRespond = xhPictureService::getPictureList(['categoryId' => 9],true);
  52. $honor = $honorRespond['model'];
  53. if (count($honor) % 2 == 1) {
  54. array_pop($honor);
  55. }
  56. $packageHonor = array_chunk($honor, 2);
  57. return $this->render('about',['honor'=>$packageHonor]);
  58. }
  59. public function actionSign()
  60. {
  61. $this->layout = 'sign';
  62. return $this->render('sign');
  63. }
  64. public function actionStudent()
  65. {
  66. $pageSize = Yii::$app->request->get('pageSize', 6);
  67. $categoryId = Yii::$app->request->get('categoryId', 1);
  68. $data = ['pageSize' => $pageSize, 'categoryId' => $categoryId];
  69. $respond = xhPictureService::getPictureList($data);
  70. $models = $respond['model'];
  71. $merchantId = 1;
  72. $category = xhPictureCategoryService::getStudent($merchantId);
  73. $arrImg = [
  74. 1 => '/images/glhs/flow1.png',
  75. 2 => '/images/glhs/flow31.png',
  76. 3 => '/images/glhs/flow4.png',
  77. ];
  78. return $this->render('student', ['models' => $models, 'category' => $category, 'categoryId' => $categoryId, 'arrImg' => $arrImg]);
  79. }
  80. public function actionGetPicture()
  81. {
  82. $get = Yii::$app->request->get();
  83. $respond = xhPictureService::getPictureList($get);
  84. $models = $respond['model'];
  85. util::successInfo('操作成功', 'A0001', $models);
  86. }
  87. public function actionShop()
  88. {
  89. return $this->render('shop');
  90. }
  91. public function actionTeacher()
  92. {
  93. $data = xhTrainTeacher::find()->where(['merchantId'=>1])->asArray()->all();
  94. return $this->render('teacher',['data'=>$data]);
  95. }
  96. public function actionWorks()
  97. {
  98. $category = ['wedding' => 4, 'meeting' => 5, 'bouquet' => 6, 'basket' => 7, 'weddingSet' => 8];
  99. //婚礼
  100. $respond = xhPictureService::getPictureList(['categoryId' => $category['wedding']],true);
  101. $wedding = $respond['model'];
  102. //会议
  103. $meetingRespond = xhPictureService::getPictureList(['categoryId' => $category['meeting']],true);
  104. $meeting = $meetingRespond['model'];
  105. //花束
  106. $bouquetRespond = xhPictureService::getPictureList(['categoryId' => $category['bouquet']],true);
  107. $bouquet = $bouquetRespond['model'];
  108. if (count($bouquet) % 2 == 1) {
  109. array_pop($bouquet);
  110. }
  111. $packageBouquet = array_chunk($bouquet, 2);
  112. //礼篮
  113. $basketRespond = xhPictureService::getPictureList(['categoryId' => $category['basket']],true);
  114. $basket = $basketRespond['model'];
  115. if (count($basket) % 2 == 1) {
  116. array_pop($basket);
  117. }
  118. $packageBasket = array_chunk($basket, 2);
  119. //婚礼套餐
  120. $weddingSetRespond = xhPictureService::getPictureList(['categoryId' => $category['weddingSet']],true);
  121. $weddingSet = $weddingSetRespond['model'];
  122. if (count($weddingSet) % 2 == 1) {
  123. array_pop($weddingSet);
  124. }
  125. $packageWedding = array_chunk($weddingSet, 2);
  126. return $this->render('works', [
  127. 'wedding' => $wedding,
  128. 'meeting' => $meeting,
  129. 'bouquet' => $packageBouquet,
  130. 'basket' => $packageBasket,
  131. 'weddingSet' => $packageWedding,
  132. ]);
  133. }
  134. public function actionGuide()
  135. {
  136. return $this->render('guide');
  137. }
  138. public function actionStartUp()
  139. {
  140. $this->layout = 'sign';
  141. $info = xhTrainClassService::getById(1);
  142. return $this->render('startUp', ['info' => $info]);
  143. }
  144. public function actionWedding()
  145. {
  146. $this->layout = 'sign';
  147. $info = xhTrainClassService::getById(3);
  148. return $this->render('wedding', ['info' => $info]);
  149. }
  150. public function actionPursue()
  151. {
  152. $this->layout = 'sign';
  153. $info = xhTrainClassService::getById(2);
  154. return $this->render('pursue', ['info' => $info]);
  155. }
  156. public function actionBalloon()
  157. {
  158. $this->layout = 'sign';
  159. $info = xhTrainClassService::getById(6);
  160. return $this->render('balloon', ['info' => $info]);
  161. }
  162. public function actionInterest()
  163. {
  164. $this->layout = 'sign';
  165. $info = xhTrainClassService::getById(4);
  166. return $this->render('interest', ['info' => $info]);
  167. }
  168. public function actionDiy()
  169. {
  170. $this->layout = 'sign';
  171. $info = xhTrainClassService::getById(5);
  172. return $this->render('diy', ['info' => $info]);
  173. }
  174. }