Special.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Special extends BaseMall {
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/special.lang.php');
  21. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/editable_page.lang.php');
  22. }
  23. public function index() {
  24. $editable_page_id = intval(input('param.special_id'));
  25. $editable_page_model = model('editable_page');
  26. $editable_page_info = $editable_page_model->getOneEditablePage(array('editable_page_id' => $editable_page_id));
  27. if (!$editable_page_info) {
  28. $this->error(lang('param_error'));
  29. }
  30. $editable_page_info['editable_page_theme_config'] = json_decode($editable_page_info['editable_page_theme_config'], true);
  31. View::assign('editable_page', $editable_page_info);
  32. $editable_page_config_model = model('editable_page_config');
  33. $editable_page_config_list=$editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
  34. $config_list=array();
  35. foreach($editable_page_config_list as $key => $val){
  36. $config_info=json_decode($val['editable_page_config_content'], true);
  37. $model_id=$val['editable_page_model_id'];
  38. $var_html=array();
  39. if(!empty($config_info)){
  40. require_once PLUGINS_PATH.'/editable_page_model/'.$model_id.'/config.php';
  41. $model_name='Model'.$model_id;
  42. $model=new $model_name();
  43. $res=$model->filterData($config_info);
  44. if($res['code']){
  45. $res=$model->formatData(json_encode($res['data']));
  46. if($res['code']){
  47. $var_html['config_info']=$res['data'];
  48. }
  49. }
  50. }
  51. $html=View::fetch('../../../plugins/editable_page_model/'.$model_id.'/index',$var_html);
  52. $config_list[]=array(
  53. 'val'=>$val,
  54. 'html'=>$html,
  55. );
  56. }
  57. View::assign('config_list', $config_list);
  58. return View::fetch($this->template_dir . 'index');
  59. }
  60. }
  61. ?>