Special.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  10. * 网站地址: https://www.valimart.net/
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Special extends BaseMall {
  17. public function initialize() {
  18. parent::initialize();
  19. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/special.lang.php');
  20. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/editable_page.lang.php');
  21. }
  22. public function index() {
  23. $editable_page_id = intval(input('param.special_id'));
  24. $editable_page_model = model('editable_page');
  25. $editable_page_info = $editable_page_model->getOneEditablePage(array('editable_page_id' => $editable_page_id));
  26. if (!$editable_page_info) {
  27. $this->error(lang('param_error'));
  28. }
  29. $editable_page_info['editable_page_theme_config'] = json_decode($editable_page_info['editable_page_theme_config'], true);
  30. View::assign('editable_page', $editable_page_info);
  31. $editable_page_config_model = model('editable_page_config');
  32. $editable_page_config_list=$editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
  33. $config_list=array();
  34. foreach($editable_page_config_list as $key => $val){
  35. $config_info=json_decode($val['editable_page_config_content'], true);
  36. $model_id=$val['editable_page_model_id'];
  37. $var_html=array();
  38. if(!empty($config_info)){
  39. require_once PLUGINS_PATH.'/editable_page_model/'.$model_id.'/config.php';
  40. $model_name='Model'.$model_id;
  41. $model=new $model_name();
  42. $res=$model->filterData($config_info);
  43. if($res['code']){
  44. $res=$model->formatData(json_encode($res['data']));
  45. if($res['code']){
  46. $var_html['config_info']=$res['data'];
  47. }
  48. }
  49. }
  50. $html=View::fetch('../../../plugins/editable_page_model/'.$model_id.'/index',$var_html);
  51. $config_list[]=array(
  52. 'val'=>$val,
  53. 'html'=>$html,
  54. );
  55. }
  56. View::assign('config_list', $config_list);
  57. return View::fetch($this->template_dir . 'index');
  58. }
  59. }
  60. ?>