/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Transferorder::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, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'pickuptime' => $this->pickuptime, 'car' => $this->car, 'amount' => $this->amount, 'seat' => $this->seat]); $query->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'phone1', $this->phone1])->andFilterWhere(['like', 'flightnumber', $this->flightnumber])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'from', $this->from])->andFilterWhere(['like', 'to', $this->to])->andFilterWhere(['like', 'anotherd', $this->anotherd])->andFilterWhere(['like', 'anotherd1', $this->anotherd1])->andFilterWhere(['like', 'anotherd2', $this->anotherd2])->andFilterWhere(['like', 'currency', $this->currency])->andFilterWhere(['like', 'return', $this->return])->andFilterWhere(['like', 'gsign', $this->gsign])->andFilterWhere(['like', 'address', $this->address]); return $dataProvider; }
public function actionSummary() { $modelsave = new Transferorder(); $reference = Yii::$app->request->get('reference'); $xml = simplexml_load_file('https://test.millikart.az:7444/gateway/payment/status?mid=transfer365&reference=' . $reference); $a = 'payment-description'; if ($xml->{$a} == 'transfer') { $model = Transferorder::find()->where(['reference' => $reference])->one(); $address = !empty($model->address) ? '<h5 style="font-weight:bold;">Address: ' . $model->address . '</h5>' : null; $faddress = !empty($model->faddress) ? '<h5 style="font-weight:bold;">Address: ' . $model->faddress . '</h5>' : null; $aaddress = !empty($model->aaddress) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress . '</h5>' : null; $aaddress1 = !empty($model->aaddress1) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress1 . '</h5>' : null; $aaddress2 = !empty($model->aaddress2) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress2 . '</h5>' : null; $unvanlar[] = $model->from . $faddress . '➟' . $model->to . $address; $unvanlar[] = !empty($model->anotherd) ? $model->to . '➟' . $model->anotherd . $aaddress : null; $unvanlar[] = !empty($model->anotherd1) ? $model->anotherd . '➟' . $model->anotherd1 . $aaddress1 : null; $unvanlar[] = !empty($model->anotherd2) ? $model->anotherd1 . '➟' . $model->anotherd2 . $aaddress2 : null; } else { if ($xml->{$a} == 'ch') { $model = Rentorder::find()->where(['reference' => $reference])->one(); } } //model asaqi dusur xml datadan description yoxlanilir eger shoferdirse shofer model caqirilir yada eksine transfer. if ($model->status == null) { if ($xml->RC == 00 and $xml->code == 0) { $model->status = '000'; // $model->rrn = $xml->rrn; $model->save(false); if ($xml->{$a} == 'transfer') { require __DIR__ . '/../views/site/mail.php'; } elseif ($xml->{$a} == 'ch') { require __DIR__ . '/../views/site/mailc.php'; } $email = \Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo(['*****@*****.**', '*****@*****.**', '*****@*****.**'])->setSubject('Yeni Sifariş')->setHtmlBody($html)->send(); $email = \Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo([$model->email])->setSubject('Your Order')->setHtmlBody($html)->send(); return $this->render('summary'); } elseif ($xml->RC == 101) { $model->status = $xml['RC']; $model->save(); } elseif ($xml->RC == 119) { $model->status = $xml['RC']; $model->save(); } elseif ($xml->RC == 100) { $model->status = $xml['RC']; $model->save(); } } //$model = Transferorder::find()->where(['reference' => $reference])->one(); //return $this->render('summary',['model' => $model,'xml' => $xml]); }
/** * Finds the Transferorder model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Transferorder the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Transferorder::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }