/** * Lists all Goods models. * @return mixed */ public function actionIndex($order_id = 0) { $searchModel = new GoodsSearch(); if (Yii::$app->user->can('operator')) { $tp = 0; } else { $customers = new Customers(); $tp = $customers->getTP(Yii::$app->user->id); } $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $tp); //$dataProvider->setPagination(['defaultPageSize' => 50]); //var_dump($dataProvider->pagination); //die(); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'order_id' => $order_id]); }
public function actionIndex() { $session = new Sitesession(); $user_id = $session->getUserId(); $user = null; $goods = null; $count = 0; if ($user_id) { $goods = $session->getGoods($user_id); $count = is_array($goods) ? count($goods) : 0; $user = Customer::findOne($user_id); //获取user_id用户信息 /*$connection = \Yii::$app->db; $command = $connection->createCommand('SELECT * FROM customer WHERE id='.$user_id); $user = $command->queryOne();*/ $searchModel = new GoodsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, 6); } else { $searchModel = new CustomerSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'user' => $user, 'goods' => $goods, 'count' => $count]); }
/** * Lists all Goods models. * @return mixed */ public function actionIndex() { $searchModel = new GoodsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }