Exemplo n.º 1
0
 /**
  * list orders in member center
  * @author cangzhou.wu(wucangzhou@gmail.com)
  * @return string
  */
 public function actionList()
 {
     $this->layout = '/member';
     //@todo add status
     $condition = '';
     $query = Order::find()->where($condition)->addOrderBy('create_at DESC');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     $orderModels = $query->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('list', ['orderModels' => $orderModels, 'pages' => $pages]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find()->orderBy(['create_at' => SORT_DESC]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['order_id' => $this->order_id, 'user_id' => $this->user_id, 'star_id' => $this->star_id, 'total_price' => $this->total_price, 'shipping_fee' => $this->shipping_fee, 'payment_fee' => $this->payment_fee, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'order_no', $this->order_no])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'memo', $this->memo]);
     return $dataProvider;
 }