Exemple #1
0
 public function insertVisitDetails($params)
 {
     $model = new StatVisitDetails();
     $model->load(['StatVisitDetails' => $params]);
     if (!$model->save()) {
         echo "StatVisitDetails";
         print_r($model->errors);
     }
     return $model;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StatVisitDetails::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100]]);
     $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, 'vid' => $this->vid, 'referer_type' => $this->referer_type, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->orderBy('updated_at desc');
     $query->andFilterWhere(['like', 'current_url', $this->current_url])->andFilterWhere(['like', 'referer_name', $this->referer_name])->andFilterWhere(['like', 'referer_keyword', $this->referer_keyword])->andFilterWhere(['like', 'referer_url', $this->referer_url]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StatVisit::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100]]);
     $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, 'status' => $this->status, 'updated_datatype_0' => $this->updated_datatype_0, 'updated_datatype_1' => $this->updated_datatype_1, 'updated_datatype_2' => $this->updated_datatype_2, 'updated_datatype_3' => $this->updated_datatype_3, 'updated_datatype_4' => $this->updated_datatype_4, 'updated_datatype_5' => $this->updated_datatype_5, 'updated_datatype_6' => $this->updated_datatype_6, 'updated_datatype_7' => $this->updated_datatype_7, 'updated_datatype_8' => $this->updated_datatype_8, 'updated_datatype_9' => $this->updated_datatype_9, 'visitor_referrer' => $this->visitor_referrer, 'iptype' => $this->iptype, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at, 'visitor_regtime' => $this->visitor_regtime, 'month_cron' => $this->month_cron]);
     $query->select([StatVisit::tableName() . '.*', 'COUNT(' . StatVisitDetails::tableName() . '.vid) as count']);
     $query->groupBy(StatVisit::tableName() . '.id');
     $query->orderBy('updated_at desc');
     $query->leftJoin(StatVisitDetails::tableName(), StatVisit::tableName() . '.id = ' . StatVisitDetails::tableName() . '.vid');
     $query->andFilterWhere(['like', 'idvisitor', $this->idvisitor])->andFilterWhere(['like', 'location_ip', $this->location_ip])->andFilterWhere(['like', 'visitor_username', $this->visitor_username])->andFilterWhere(['like', 'visitor_datatype_0', $this->visitor_datatype_0])->andFilterWhere(['like', 'visitor_datatype_1', $this->visitor_datatype_1])->andFilterWhere(['like', 'visitor_datatype_2', $this->visitor_datatype_2])->andFilterWhere(['like', 'visitor_datatype_3', $this->visitor_datatype_3])->andFilterWhere(['like', 'visitor_datatype_4', $this->visitor_datatype_4])->andFilterWhere(['like', 'visitor_datatype_5', $this->visitor_datatype_5])->andFilterWhere(['like', 'visitor_datatype_6', $this->visitor_datatype_6])->andFilterWhere(['like', 'visitor_datatype_7', $this->visitor_datatype_7])->andFilterWhere(['like', 'visitor_datatype_8', $this->visitor_datatype_8])->andFilterWhere(['like', 'visitor_datatype_9', $this->visitor_datatype_9])->andFilterWhere(['like', 'iptext', $this->iptext]);
     return $dataProvider;
 }
 /**
  * Finds the StatVisitDetails model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StatVisitDetails the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StatVisitDetails::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }