52 lines
1.0 KiB
PHP
Executable File
52 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace vendor\fmsoft\modules\data\controllers;
|
|
|
|
use yii\web\Controller;
|
|
use Yii;
|
|
|
|
/**
|
|
* Default controller for the `data` module
|
|
*/
|
|
|
|
use dataModel; //必须添加这一句,以便引入dataModel外部类库
|
|
|
|
class DefaultController extends Controller
|
|
{
|
|
/**
|
|
* Renders the index view for the module
|
|
* @return string
|
|
*/
|
|
public function actionIndex()
|
|
{
|
|
return $this->render('index');
|
|
}
|
|
|
|
public function actionCreate()
|
|
{
|
|
if(!Yii::$app->request->post()){
|
|
return $this->render('_step1');
|
|
}else{
|
|
$step2 = Yii::$app->request->post('step2');
|
|
$temp = ['dbPrefix','tablePrefix','name','tableTitle','type'];
|
|
$params = array();
|
|
foreach($temp as $k=>$v){
|
|
$params[$v] = $step2[$v];
|
|
}
|
|
|
|
fm_load()->fm_class('dataModel');
|
|
$dataModel = new dataModel;
|
|
$result = $dataModel->get_sql_all($params);
|
|
//$sqls = [];
|
|
//foreach($sqls as $sql){
|
|
//do
|
|
//}
|
|
$sqls = $result;
|
|
return $this->render('_step2',[
|
|
'sqls' => $sqls,
|
|
]);
|
|
}
|
|
|
|
}
|
|
}
|