index.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * cms首页
  4. *
  5. *
  6. *
  7. */
  8. //use Shopnc\Tpl;
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class indexControl extends mobileHomeControl{
  11. public function __construct() {
  12. parent::__construct();
  13. }
  14. /**
  15. * 首页
  16. */
  17. public function indexOp() {
  18. $model_mb_special = Model('mb_special');
  19. $data = $model_mb_special->getMbSpecialIndex();
  20. var_dump($data);
  21. $this->_output_special($data, $_GET['type']);
  22. }
  23. /**
  24. * 专题
  25. */
  26. public function specialOp() {
  27. $model_mb_special = Model('mb_special');
  28. $data = $model_mb_special->getMbSpecialItemUsableListByID($_GET['special_id']);
  29. $this->_output_special($data, $_GET['type'], $_GET['special_id']);
  30. }
  31. /**
  32. * 输出专题
  33. */
  34. private function _output_special($data, $type = 'json', $special_id = 0)
  35. {
  36. $model_special = Model('mb_special');
  37. if($_GET['type'] == 'html')
  38. {
  39. $html_path = $model_special->getMbSpecialHtmlPath($special_id);
  40. if(!is_file($html_path)) {
  41. ob_start();
  42. Tpl::output('list', $data);
  43. Tpl::showpage('mb_special');
  44. file_put_contents($html_path, ob_get_clean());
  45. }
  46. header('Location: ' . $model_special->getMbSpecialHtmlUrl($special_id));
  47. //die;
  48. }
  49. else
  50. {
  51. if(empty($data)) {
  52. $data=array();
  53. }
  54. //$data['site_mobile_logo']=array(C('site_mobile_logo'));
  55. //print_r($data);
  56. output_data($data);
  57. }
  58. }
  59. /**
  60. * android客户端版本号
  61. */
  62. public function apk_versionOp() {
  63. $version = C('mobile_apk_version');
  64. $url = C('mobile_apk');
  65. if(empty($version)) {
  66. $version = '';
  67. }
  68. if(empty($url)) {
  69. $url = '';
  70. }
  71. output_data(array('version' => $version, 'url' => $url));
  72. }
  73. }