Skip to content

Commit

Permalink
增加gii使用说明文档
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyan74 committed Sep 23, 2019
1 parent e534a5a commit 2382ad9
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/guide-zh-CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [表单控件](sys-widget.md)
- [系统组件](sys-subassembly.md)
- [系统JS](sys-js-method.md)
- [Gii](sys-gii.md)
- [权限控制](sys-auth.md)
- [公用支付](sys-payment.md)
- [消息队列](sys-queue.md)
Expand Down
Binary file added docs/guide-zh-CN/images/gii-curd-view-files.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/guide-zh-CN/images/gii-curd-view.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/guide-zh-CN/images/gii-curd.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/guide-zh-CN/start-update-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

> 各个小版本升级例如 2.1.x 升级到 2.2.x 以上不能完美升级最好重新安装
### v2.3.128(待发布)
updated 2019.9.20

- 优化: 公用微信 js 支付,调用 easywechat 的 js 支付视图进行兼容 [@yiirise](https://github.com/yiirise)

### v2.3.127
updated 2019.9.20

Expand Down
110 changes: 110 additions & 0 deletions docs/guide-zh-CN/sys-gii.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
### Gii

目录

- Model
- CURD

使用条件

- 开发模式
- rageframe 版本号 >= 2.3.94
- backend/gii

### Model

- 表字段已经备注
- Code Template 选择 rageframe

那么你选择一个表进行生成 Model 你会发现 attributeLabels 全部替换成为字段备注,不用再重新修改

```
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "{{%addon_article_adv}}".
*
* @property int $id 序号
* @property string $merchant_id 商户id
* @property string $title 标题
* @property string $cover 图片
* @property int $location_id 广告位ID
* @property string $silder_text 图片描述
* @property int $start_time 开始时间
* @property int $end_time 结束时间
* @property string $jump_link 跳转链接
* @property int $jump_type 跳转方式[1:新标签; 2:当前页]
* @property int $sort 优先级
* @property int $status 状态
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class AddonArticleAdv extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%addon_article_adv}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['merchant_id', 'location_id', 'start_time', 'end_time', 'jump_type', 'sort', 'status', 'created_at', 'updated_at'], 'integer'],
[['title'], 'string', 'max' => 30],
[['cover'], 'string', 'max' => 100],
[['silder_text', 'jump_link'], 'string', 'max' => 150],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => '序号',
'merchant_id' => '商户id',
'title' => '标题',
'cover' => '图片',
'location_id' => '广告位ID',
'silder_text' => '图片描述',
'start_time' => '开始时间',
'end_time' => '结束时间',
'jump_link' => '跳转链接',
'jump_type' => '跳转方式[1:新标签; 2:当前页]',
'sort' => '优先级',
'status' => '状态',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
}
```

### CURD

1、设置好模型路径(注意是已经创建好的Model),选择生成控制器命名空间和视图文件路径,选择模板为 rageframe 即可进行生成预览

![image](images/gii-curd.jpg)

2、 勾选你首页需要显示的字段和编辑页面需要显示的字段和控件类型即可直接生成一个定制化的 CURD

![image](images/gii-curd-view.jpg)

3、选择后点击预览,没有问题了可直接点击创建进行生成

![image](images/gii-curd-view-files.jpg)

4、访问对应的路径进行查看,这样子关于页面显示、查询、编辑就完成了,就那么简单


0 comments on commit 2382ad9

Please sign in to comment.