backend/controllers/HashfilesController.php
/**
     * Lists all Hashfiles models.
     * @return mixed
     */
Lists all Hashfiles models.
@return mixed
Lists all Hashfiles models . @return mixed
public function actionIndex()
    {
        $searchModel = new HashfilesSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        if(Yii::$app->request->post('hasEditable')){
            $hashfileId = Yii::$app->request->post('editableKey');
            $hashfile =  Hashfiles::findOne($hashfileId);
            $out = Json::encode(['output'=>'','message'=>'']);
            $posted = current($_POST['Hashfiles']);
            $post['Hashfiles'] =$posted;
            if($hashfile->load($post)){
                $hashfile->save();
                if($hashfile->hashfile_usestatus=='used'){
                    $data['hashfile_oldhash']=$hashfile->hashfile_newhash;
                    $data['hashfile_project_id']=$hashfile->hashfile_project_id;
                    $data['hashfile_usestatus']='unused';
                    $data['hashfile_date']=date('Y-m-d H:s:i');
                    $rows[]=[
                    ];
                    Yii::$app->db->createCommand()->insert(Hashfiles::tableName(),$data)->execute();
                }
                $value = $hashfile->hashfile_usestatus;
                return Json::encode(['output'=>$value,'message'=>'']);
            }else{
                return Json::encode(['output'=>'','message'=>'']);
            }
        }
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionIndex ( ) { $ searchModel = new HashfilesSearch ( ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> queryParams ) ; if ( Yii :: $ app -> request -> post ( 'hasEditable' ) ) { $ hashfileId = Yii :: $ app -> request -> post ( 'editableKey' ) ; $ hashfile = Hashfiles :: findOne ( $ hashfileId ) ; $ out = Json :: encode ( [ 'output' => '' , 'message' => '' ] ) ; $ posted = current ( $ _POST [ 'Hashfiles' ] ) ; $ post [ 'Hashfiles' ] = $ posted ; if ( $ hashfile -> load ( $ post ) ) { $ hashfile -> save ( ) ; if ( $ hashfile -> hashfile_usestatus == 'used' ) { $ data [ 'hashfile_oldhash' ] = $ hashfile -> hashfile_newhash ; $ data [ 'hashfile_project_id' ] = $ hashfile -> hashfile_project_id ; $ data [ 'hashfile_usestatus' ] = 'unused' ; $ data [ 'hashfile_date' ] = date ( 'Y-m-d H:s:i' ) ; $ rows [ ] = [ ] ; Yii :: $ app -> db -> createCommand ( ) -> insert ( Hashfiles :: tableName ( ) , $ data ) -> execute ( ) ; } $ value = $ hashfile -> hashfile_usestatus ; return Json :: encode ( [ 'output' => $ value , 'message' => '' ] ) ; } else { return Json :: encode ( [ 'output' => '' , 'message' => '' ] ) ; } } return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; }
Lists all Hashfiles models.
Lists all Hashfiles models .
//鎵惧嚭涓嶅悓涓や釜鐗堟湰鐨勬枃浠� //$files=$this->findDifffiles($hashfile); //鎻掑叆鏂扮殑涓�鏉℃暟鎹� // $this->save($runValidation,$data);