Initial commit,修正

This commit is contained in:
2025-07-13 19:37:38 +08:00
parent 38ce288e27
commit 65bbd06981
12384 changed files with 3985464 additions and 8 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace vendor\fmsoft\modules\data;
/**
* data module definition class
*/
class Module extends \yii\base\Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'vendor\fmsoft\modules\data\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}
+51
View File
@@ -0,0 +1,51 @@
<?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,
]);
}
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
$this->title = '数据模型批处理工具-数据表生成器';
?>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<div class="page-header">
<h1>
预定义
</h1>
</div>
<?php $form = ActiveForm::begin(); ?>
<form action="" method="post" class="form-horizontal form" id="setting-form">
<input name="_csrf-backend" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
<div class="form-group">
<label for="step2[database]">数据库名</label><input class="form-control" type="text" name="step2[database]" />
</div>
<div class="form-group">
<label for="step2[dbPrefix]">库前缀</label><input class="form-control" type="text" name="step2[dbPrefix]" />
</div>
<div class="form-group">
<label for="step2[tablePrefix]">表前缀</label><input class="form-control" type="text" name="step2[tablePrefix]" />
</div>
<div class="form-group">
<label for="step2[name]">表名</label><input class="form-control" type="text" name="step2[name]" />
</div>
<div class="form-group">
<label for="step2[tableTitle]">表备注(如:聊天室)</label><input class="form-control" type="text" name="step2[tableTitle]" />
</div>
<div class="form-group">
<label for="step2[type]">表归属类(如:all,sys,chat,shop,site,realty……)</label><input class="form-control" type="text" name="step2[type]" />
</div>
<button type="submit" class="btn btn-success">提交</button>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
+22
View File
@@ -0,0 +1,22 @@
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
global $_FM;
$this->title = '数据模型批处理工具';
?>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<div class="page-header">
<h1>
数据模型批处理工具-数据表生成器
</h1>
</div>
<pre contenteditable="true"><?php print_r($sqls); ?></pre>
</div>
</div>
</div>
+53
View File
@@ -0,0 +1,53 @@
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\grid\GridView;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
$this->title = '数据模型批处理工具';
$this->params['breadcrumbs'][] = $this->title;
$modules = Yii::$app->params['dataModules'];
?>
<div class="page-header">
<h1>
数据模型批处理工具-数据表生成器
</h1>
</div>
<p>
<span class="label label-warning" style="display:inline-block;" >已有模型</span>:
<?php foreach($modules as $k => $v){ ?>
<span class="label label-success" style="display:inline-block;" contenteditable="true">
<?= Html::encode($v) ?> ( <?= Html::encode($k) ?> )
</span>
<?php } ?>
</p>
<?= Html::a('创建新表', ['create'], ['class' => 'btn btn-info']) ?>
<div class="">
<div class="container">
<h1>
备注
</h1>
<p>
<ul>如下结构——
<li><code>数据库:</code><kbd>test</kbd>;
</li><li><code>库前缀:</code><kbd>v1</kbd>——这个一般是各应用程序用来区分数据调用的标识(也可能没有,比如本站);
</li><li><code>表前缀:</code><kbd>c</kbd>——这个一般是应用程序内部各组件用来区分数据调用的标识(本站c表示核心表类);
</li><li><code>表名:</code><kbd>chat_basic</kbd>——表示将要生成一组与chat_basic相关的表来(逻辑:在后面加上表后缀进行定向区分并以便数据模型可以标准化地处理它们);
</li></ul>
该示例将在数据库 test 中生成以下几张表:
<ol>
<li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>self</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>form</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>param</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>order</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>addon</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>data</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>attr</code>;
</li><li><code>v1</code>_<code>c</code>_<code>chat_basic</code>_<code>pre</code>;
</li>
</ol>
</p>
</div>
</div>