예제 #1
0
 /**
  * Creates a new StatVisit model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new StatVisit();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
예제 #2
0
 public function insertNewVisitor($params)
 {
     $model = new StatVisit();
     $model->load(['StatVisit' => $params]);
     if (!$model->save()) {
         echo "StatVisit";
         print_r($model->errors);
     }
     return $model;
 }
예제 #3
0
파일: Visit.php 프로젝트: oyoy8629/yii-core
 public function tracker()
 {
     $idvisitor = $this->getIdvisitor();
     if (!($model = $this->findVisitor($idvisitor))) {
         $model = new StatVisit();
     }
     $referrers = new Referrers();
     $details = $referrers->getReferrerInformationFromRequest();
     $model->load(['StatVisit' => $this->load($idvisitor, $details)]);
     $model->save();
     if ($model->id) {
         $details['vid'] = $model->id;
         $details['flag'] = \yii::$app->request->get('rf', 1);
         $this->insertVisitDetails($details);
     }
 }