backend/controllers/HashesController.php
/**
     * Creates a new Hashes model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Hashes model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Hashes model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Hashes();
        $hashesModel= new HashesTemp();
        $resTemps=$hashesModel->find()->all();
        $i=1;
        foreach ($resTemps as $resTemp){
            $res=$model->find()->where(['hash_id'=>$resTemp->hash_id])->exists();
            if(!$res){ 
                $model->hash_id=$resTemp->hash_id;
                $model->hash_source=$resTemp->hash_source;
                $model->hash_source_branch=$resTemp->hash_source_branch;
                $model->hash_committer_name=$resTemp->hash_committer_name;
                $model->has_committer_email=$resTemp->has_committer_email;
                $model->has_committer_date=$resTemp->has_committer_date;
                $model->isNewRecord = true;
                $model->save();
            }
        }
        return $this->redirect(['index']);
  根据条件获取gethash值
  return $this->render('create', [
      'model' => $model,
  ]);
        }
    }
public function actionCreate ( ) { $ model = new Hashes ( ) ; $ hashesModel = new HashesTemp ( ) ; $ resTemps = $ hashesModel -> find ( ) -> all ( ) ; $ i = 1 ; foreach ( $ resTemps as $ resTemp ) { $ res = $ model -> find ( ) -> where ( [ 'hash_id' => $ resTemp -> hash_id ] ) -> exists ( ) ; if ( ! $ res ) { $ model -> hash_id = $ resTemp -> hash_id ; $ model -> hash_source = $ resTemp -> hash_source ; $ model -> hash_source_branch = $ resTemp -> hash_source_branch ; $ model -> hash_committer_name = $ resTemp -> hash_committer_name ; $ model -> has_committer_email = $ resTemp -> has_committer_email ; $ model -> has_committer_date = $ resTemp -> has_committer_date ; $ model -> isNewRecord = true ; $ model -> save ( ) ; } } return $ this -> redirect ( [ 'index' ] ) ; }
Creates a new Hashes model.
Creates a new Hashes model .
//        if ($model->load(Yii::$app->request->post()) && $model->save()) { //            return $this->redirect(['view', 'id' => $model->hash_id]); //        } else { //           //            //根据条件获取gethash值 //            return $this->render('create', [ //                'model' => $model, // //            ]); //        }