예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = OmsOrder::find();
     $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(['id' => $this->id, 'platform_id' => $this->platform_id, 'order_status' => $this->order_status, 'add_time' => $this->add_time, 'pay_time' => $this->pay_time, 'shipping_time' => $this->shipping_time, 'finish_time' => $this->finish_time, 'order_amount' => $this->order_amount, 'product_amount' => $this->product_amount, 'product_cost_amount' => $this->product_cost_amount, 'shipping_fee' => $this->shipping_fee, 'pack_fee' => $this->pack_fee, 'profit_fee' => $this->profit_fee, 'profit_rate' => $this->profit_rate, 'is_after' => $this->is_after]);
     $query->andFilterWhere(['like', 'order_sn', $this->order_sn])->andFilterWhere(['like', 'payment_method', $this->payment_method])->andFilterWhere(['like', 'shipping_method', $this->shipping_method])->andFilterWhere(['like', 'currency', $this->currency])->andFilterWhere(['like', 'buyer_username', $this->buyer_username])->andFilterWhere(['like', 'buyer_email', $this->buyer_email])->andFilterWhere(['like', 'tracking_number', $this->tracking_number])->andFilterWhere(['like', 'after_order_sn', $this->after_order_sn]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Finds the OmsOrder model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return OmsOrder the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = OmsOrder::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }