| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace backend\modules\admin\controllers;
- use backend\controllers\AdminController;
- use common\enums\platform\PlatformEnum;
- use common\enums\StatusEnum;
- use common\models\addons\AddonsOrder;
- use common\models\backend\Admin;
- use common\models\common\PlatformSetting;
- use common\models\mall\Mall;
- use common\models\platform\PlatformOrder;
- use common\models\platform\PlatformOrderStatisticsDay;
- use Yii;
- /**
- * 商城控制器
- *
- * @Author ltm
- * @DateTime 2021-08-13 15:29:41
- * @copyright: Copyright (c) 2020 广东七件事集团
- */
- class PlatformOrderController extends AdminController
- {
- public function actionIndex($keyword = null, $is_recycle = 0)
- {
- $retuest = Yii::$app->request;
- if ($retuest->isAjax) {
- if ($retuest->isPost) {
- $post = Yii::$app->request->post();
- // 检查提交的参数
- $res = Yii::$app->services->validate->validate($post,[
- [['id','level'], 'integer'],
- [['title','consumer_name','order_status','date_end','date_start'], 'safe'],
- [['limit'],'default','value' => '15'],
- ]);
- if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $post = PlatformOrder::exceptNullVal($post);
- if($post['date_start'] && $post['date_end']) $where[] = ['between', 'created_at', strtotime($post['date_start']),strtotime($post['date_end'])];
- if($post['title']) $where[] = ['like', 'title', $post['title']];
- if($post['consumer_name']) $where[] = ['like', 'consumer_name', $post['consumer_name']];
- if(isset($post['order_status']) && $post['order_status'] !== '') $where[] = ['=', 'order_status', $post['order_status']];
- $where[] = ['=','status',StatusEnum::ENABLED];
- $order = 'id desc';
- $params = array('where' => $where, 'order'=>$order, 'limit' => $post['limit']);
- $list = PlatformOrder::listPage($params);
- $select = 'sum(order_num) as order_num,sum(pay_num) as pay_num,sum(cancel_order_num) as cancel_order_num';
- $statics = PlatformOrderStatisticsDay::getOne('',true,'','id desc',$select);
- $list['statistics'] = $statics;
- $list['consumer_type'] = PlatformEnum::getConsumerTypeMap();
- $list['from_type'] = PlatformEnum::getFromTypeMap();
- $this->success('获取成功', $list);
- }
- } else {
- return $this->render($this->action->id);
- }
- }
- }
|