Index.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 应用管理首页
  7. */
  8. namespace app\fastshop\controller\Manage;
  9. use app\common\controller\Manage;
  10. class Index extends Manage{
  11. public function initialize() {
  12. parent::initialize();
  13. $this->assign('pathMaps', [['name'=>'管理首页','url'=>'javascript:;']]);
  14. }
  15. /**
  16. * 应用管理首页
  17. * @access public
  18. */
  19. public function Index(){
  20. $starttime = empty(input('get.starttime')) ? 0 : strtotime(input('get.starttime/s'));
  21. $endtime = empty(input('get.endtime')) ? 0 : strtotime(input('get.endtime/s'));
  22. $whereorder = [];
  23. $entrust = [];
  24. $rebate = [];
  25. if(!empty($starttime) && !empty($endtime)){
  26. if($starttime > $endtime){
  27. $this->error('开始日期不能大于结束日期');
  28. }
  29. $whereorder[] = ['order_starttime','>=',$starttime];
  30. $whereorder[] = ['order_starttime','<=',$endtime];
  31. $entrust[] = ['create_time','>=',$starttime];
  32. $entrust[] = ['create_time','<=',$endtime];
  33. $rebate[] = ['update_time','>=',$starttime];
  34. $rebate[] = ['update_time','<=',$endtime];
  35. }
  36. $view['order'] = model('order')->where($whereorder)->where(['member_miniapp_id' => $this->member_miniapp_id,'paid_at' => 1])->count();
  37. $view['express'] = model('order')->where($whereorder)->where(['member_miniapp_id' => $this->member_miniapp_id,'express_status' => 1])->count();
  38. $view['entrust'] = model('EntrustList')->where($entrust)->where(['member_miniapp_id' => $this->member_miniapp_id,'is_rebate' => 0])->count();
  39. $view['entrust_rebate'] = model('EntrustList')->where($rebate)->where(['member_miniapp_id' => $this->member_miniapp_id,'is_rebate' => 1])->count();
  40. $view['shopping'] = model('shopping')->where($whereorder)->where(['member_miniapp_id' => $this->member_miniapp_id,'paid_at' => 1])->count();
  41. $view['shoppingexpress'] = model('shopping')->where($whereorder)->where(['member_miniapp_id' => $this->member_miniapp_id,'express_status' => 1])->count();
  42. $view['agent'] = model('Agent')->where(['member_miniapp_id' => $this->member_miniapp_id])->count();
  43. $view['countuser'] = model('SystemUser')->where(['member_miniapp_id' => $this->member_miniapp_id])->count();
  44. $view['starttime'] = $starttime;
  45. $view['endtime'] = $endtime;
  46. return view('/manage/index')->assign($view);
  47. }
  48. }