IndexController.class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace Seller\Controller;
  3. use Admin\Model\StatisticsModel;
  4. class IndexController extends CommonController {
  5. protected function _initialize(){
  6. parent::_initialize();
  7. }
  8. public function index(){
  9. //cookie('http_refer',$_SERVER['HTTP_REFERER']);
  10. //cookie('last_login_page');
  11. $is_new = I('get.is_new', 0 );
  12. //获取有多少条的通知
  13. $day_time = strtotime( date('Y-m-d '.'00:00:00') );
  14. $day_key = 'new_ordernotice_'.$day_time;
  15. $day_arr = S( $day_key );
  16. $order_count = 0;
  17. if( !empty($day_arr) )
  18. {
  19. $order_count = count($day_arr);
  20. }
  21. $this->order_count = $order_count;
  22. if( $is_new == 1 )
  23. {
  24. //切换到新后台,
  25. cookie('is_new_backadmin',1);
  26. }else if( $is_new == 2 ){
  27. //切换到旧后台,
  28. cookie('is_new_backadmin',2);
  29. }
  30. $is_show_notice = true;
  31. $is_show_notice001 = D('Home/Front')->get_config_by_name('is_show_notice001');
  32. if( !isset($is_show_notice001) )
  33. {
  34. $data = array();
  35. $data['is_show_notice001'] = 1;
  36. D('Seller/Config')->update($data);
  37. }
  38. $this->is_show_notice001 = $is_show_notice001;
  39. $is_new_backadmin = cookie('is_new_backadmin');
  40. if( empty($is_new_backadmin) || $is_new_backadmin == 2 )
  41. {
  42. $this->display();
  43. }else{
  44. $this->display('new_index');
  45. }
  46. //$this->display();
  47. //$this->display('new_index');
  48. }
  49. public function analys ()
  50. {
  51. $this->display();
  52. }
  53. public function order_count()
  54. {
  55. //语音播报
  56. $voice_notice = D('Home/Front')->get_config_by_name('is_open_order_voice_notice');
  57. //获取有多少条的通知
  58. $day_time = strtotime( date('Y-m-d '.'00:00:00') );
  59. $day_key = 'new_ordernotice_'.$day_time;
  60. $day_arr = S( $day_key );
  61. $order_count = 0;
  62. if( !empty($day_arr) )
  63. {
  64. $order_count = count($day_arr);
  65. }
  66. $info =array();
  67. if(!empty($order_count)){
  68. $info =array(
  69. "resultCode"=>200,
  70. "message"=>"success",
  71. "data"=>$order_count,
  72. "voice_notice"=>$voice_notice
  73. );
  74. }
  75. echo json_encode($info);
  76. die();
  77. }
  78. }