StoreSpecial.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class StoreSpecial extends BaseStore
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize();
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/seller_editable_page.lang.php');
  18. }
  19. public function index()
  20. {
  21. $editable_page_id = intval(input('param.special_id'));
  22. $editable_page_model = model('editable_page');
  23. $editable_page_info = $editable_page_model->getOneEditablePage(array('editable_page_id' => $editable_page_id));
  24. if (!$editable_page_info) {
  25. $this->error(lang('param_error'));
  26. }
  27. $editable_page_info['editable_page_theme_config'] = json_decode($editable_page_info['editable_page_theme_config'], true);
  28. View::assign('editable_page', $editable_page_info);
  29. $editable_page_config_model = model('editable_page_config');
  30. $editable_page_config_list = $editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
  31. $config_list = array();
  32. foreach ($editable_page_config_list as $key => $val) {
  33. $config_info = json_decode($val['editable_page_config_content'], true);
  34. $model_id = $val['editable_page_model_id'];
  35. $var_html = array();
  36. if (!empty($config_info)) {
  37. require_once PLUGINS_PATH . '/editable_page_model/' . $model_id . '/config.php';
  38. $model_name = 'Model' . $model_id;
  39. $model = new $model_name();
  40. $res = $model->filterData($config_info);
  41. if ($res['code']) {
  42. $res = $model->formatData(json_encode($res['data']), $this->store_info['store_id']);
  43. if ($res['code']) {
  44. $var_html['config_info'] = $res['data'];
  45. }
  46. }
  47. }
  48. $html = View::fetch('../../../plugins/editable_page_model/' . $model_id . '/index', $var_html);
  49. $config_list[] = array(
  50. 'val' => $val,
  51. 'html' => $html,
  52. );
  53. }
  54. View::assign('config_list', $config_list);
  55. return View::fetch($this->template_dir . 'index');
  56. }
  57. }