IndexController.class.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace Admin\Controller;
  3. use Admin\Model\StatisticsModel;
  4. class IndexController extends CommonController {
  5. protected function _initialize(){
  6. parent::_initialize();
  7. $this->breadcrumb1='首页';
  8. $this->breadcrumb2='首页';
  9. $this->admin_domain = 'http://pinduoduo.liofis.com';
  10. $this->host = base64_encode( strtolower(strval($_SERVER['HTTP_HOST'])));
  11. }
  12. function duoduo_action($action, $version='V1.0') {
  13. $host = base64_encode( strtolower(strval($_SERVER['HTTP_HOST'])));
  14. $url = $this->admin_domain."/seller.php?s=/Upgrade/req_version/version/{$version}/host/{$host}";
  15. $r = sendhttp_get($url);
  16. return json_decode($r, true);
  17. }
  18. function zuitu_upgrade($action, $version='V1.0') {
  19. $result = $this->duoduo_action($action, $version);
  20. return $result;
  21. }
  22. function duoduo_version($version) {
  23. return $this->duoduo_action('version', $version);
  24. }
  25. public function index(){
  26. $config_arr = M('config')->where( array('name' => 'VERSION') )->find();
  27. $version = $config_arr['value'];
  28. $version_meta = $this->duoduo_version($version);
  29. $isnew = true;
  30. $newsubversion = '';
  31. if(!empty($version_meta))
  32. {
  33. $isnew = false;
  34. $newsubversion = end($version_meta);
  35. $newsubversion = $newsubversion['name'];
  36. }
  37. $this->version = $version;
  38. $this->newsubversion = $newsubversion;
  39. $version_meta = array_reverse($version_meta);
  40. $this->version_meta = $version_meta;
  41. $model=new StatisticsModel();
  42. $this->total_ip=count($model->get_all_visitors_ip());
  43. $this->today_ip=count($model->get_visitors_ip_by_date(date('Y-m-d',time())));
  44. //$this->total_member=count($model->get_all_member());
  45. $this->total_member=($model->get_all_member_count());
  46. $this->today_member=count($model->get_today_register_member());
  47. $this->total_money=$model->get_total_sales();
  48. $this->today_money=$model->get_total_sales(array('date_added' => date('Y-m-d')));
  49. $this->total_order=$model->get_total_order();
  50. $this->today_order=$model->get_total_order(array('date_added' => date('Y-m-d')));
  51. $this->total_wait_goods = M('goods')->where(array('status' => 2) )->count();
  52. $this->total_wait_apply = M('apply')->where( array('state' => 0) )->count();
  53. //type normal lock_type 'normal','spike','super_spike','','subject','niyuan','oneyuan','haitao','lottery'
  54. $this->subject_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'subject') )->count();
  55. $this->niyuan_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'niyuan') )->count();
  56. $this->oneyuan_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'oneyuan') )->count();
  57. $this->haitao_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'haitao') )->count();
  58. $this->lottery_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'lottery') )->count();
  59. $this->spike_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'spike') )->count();
  60. $this->super_spike_wait_count = M('goods')->where( array('type' => 'normal', 'lock_type' => 'super_spike') )->count();
  61. $order_model=new \Admin\Model\OrderModel();
  62. $data=$order_model->show_order_page();
  63. $this->empty=$data['empty'];
  64. $this->list=$data['list'];
  65. $this->uc_empty='~~暂无数据';
  66. $this->uc_list=$model->get_user_action();
  67. $this->display();
  68. }
  69. }